Git, Linters and SourceLevel: how tools enable a more inclusive language and diverse culture
Tags: developmenttools, git, communication, inclusivelanguage
Published: 2020-07-22 16:56:59

---
title: Git, Linters and SourceLevel: how tools enable a more inclusive language and diverse culture
published: true
date: 2020-07-22 10:45:27 UTC
tags: DevelopmentTools,git,communication,InclusiveLanguage
canonical_url: https://sourcelevel.io/blog/git-linters-and-sourcelevel-how-tools-enable-a-more-inclusive-language-and-diverse-culture
cover_image: https://mk0sourcelevel699i08.kinstacdn.com/wp-content/uploads/pompxtcvyho-2048x1536.jpg
---

Are terminologies meaningful in software development? Yes, a lot! As developers, we’re continually writing code, and we do that by passing messages. Each message carries a lot of context and semantics. Therefore we’re always evolving how to do it in a better way.

There is this vastly known anecdote that says that there are only [two hard things in Computer Science](https://martinfowler.com/bliki/TwoHardThings.html): caching invalidation and  **naming**  things.

Terminology is in the roots of communication, and therefore is as vital for writing quality code as writing User Stories, documentation, and even naming branches.

If you care a lot about communicating effectively, I think we must use an  **inclusive language**  to do so.

Inclusive writing is the usage of the language with neutrality. Inclusiveness has a positive impact on our lives, as they don’t offend interlocutors based on abilities/disabilities, age, gender, sexuality, race, ethnicity, religion, etc.

It would be best to read [this content guide](https://content-guide.18f.gov/inclusive-language/) that describes how to be more inclusive when writing. The impact of fostering more inclusive writing implies changes in how we write software. Besides, sooner or later, we see that it affects many aspects of everyday life communication. ![🌱](https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f331.png)

Some time ago, [a proposal](https://lkml.org/lkml/2020/7/4/229) regarding the `master` branch name in [Git](https://sourcelevel.io/blog/tag/git) came up. I got pleased that the concern of an inclusive language arrived in the [tool I use every day for development](https://sourcelevel.io/blog/category/development-tools). The proposal addresses replacing the master branch name by a more inclusive one, [such as `main`, `primary`, or `principal`](http://49decddd39e5f6132ccd7d9fdc3d7c470b0061bb)..

At SourceLevel, we have opted for using `main` as the default branch name. Did you know you can change the default branch in your Git repositories? You can do it by both **GitLab**  (_Project Settings > Repository_) and  **GitHub**  (_Repository Settings > Branches_).

Changing the default branch of your repositories may break some tools. In the case of SourceLevel, we already support the custom default branch, and it synchronizes with GitHub and GitLab. Changing on those tools automatically replicates in our tool.

## Steps for changing your default branch

In the examples below, I rename the `master` branch to `main`. You should discuss with your team and find the name that better suits you.

Firstly, we need to rename it locally:

```
$ git branch -m master main
$ git push origin main -u
```

And you’re done! These two commands rename your local `master` branch and then push it to the remote server. It’s a secure way to start, once the commands don’t delete the remote `master` branch.

Note that after changing the name to main, everyone who clones the repository gets the new default branch set. However, people who had previously cloned the repository are still pointing to the master branch.

To move forward with the change, everyone in your team needs to run a [few commands](https://twitter.com/xunit/status/1269881005877256192). For a complete guide, I strongly recommend reading [Damien Cosset’s blog post](https://dev.to/damcosset/replacing-master-in-git-2jim).

## Using SourceLevel as an Inclusive Language watchdog

Now that we have a more inclusive branch name, there may be references to other terms that we should avoid. They may appear in variables, methods, or even comments.

So, we need to look for them the whole codebase. This part can demand lots of hard work, depending on the size and terminology used throughout codebases.

Changing the existing code doesn’t prevent you or your team from using exclusive language again. What if a bot could notify you when a contravention appears? You can use the [`grep` linter](https://docs.sourcelevel.io/engines/grep/) as a watchdog!

Configure your `.sourcelevel.yml` file adding rules that look for exclusive language and suggest more appropriate terms for each Pull or Merge Requests using SourceLevel’s [automated code review](https://sourcelevel.io/automated-code-review) feature. It should look something like this:

```
engines:
  grep:
    config:
      patterns:
        allowlist:
          pattern: "/white[_\\-]?list/i"
          annotation: Do not use 'Whitelist'. Prefer the term 'Allowlist'
          categories: Style
          path_patterns:
          - "**/*.ex"
          - "**/*.exs"
        blocklist:
          pattern: "/black[_\\-]?list/i"
          annotation: Do not use 'Blacklist'. Prefer the term 'Blocklist'
          categories: Style
          path_patterns:
          - "**/*.ex"
          - "**/*.exs"
    enabled: true
```

After pushing it to the main branch, SourceLevel can help you achieve a more inclusive language throughout the codebase!

## In short

Using an inclusive language is crucial for fostering a diverse culture. Git has changed the naming conventions to be more language-inclusive, and so you should change. Our development tools, like GitHub and GitLab, already supports the change.

SourceLevel deals very nicely with repositories that changed the `master` branch to a more appropriate word. Besides, you can use the `grep` linter the look for exclusive terms contained in the source code.

As the inclusive language gap may happen in other aspects of our lives, have you already thought about them?

Raise the discussion in your team and use the tools to favor a more inclusive world ![💚](https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f49a.png)!

The post [Git, Linters and SourceLevel: how tools enable a more inclusive language and diverse culture](https://sourcelevel.io/blog/git-linters-and-sourcelevel-how-tools-enable-a-more-inclusive-language-and-diverse-culture) appeared first on [SourceLevel](https://sourcelevel.io).