It is generally recommended to avoid using some words in your code to avoid being considered offensive or inappropriate by some developers.
For example, words like "blacklist" and "whitelist" in your code, as they can be considered offensive or inappropriate by some people. The use of these terms is associated by some people with discrimination, and using them may be seen as insensitive or offensive to some readers. For this reason, and especially if your developers come from diverse backgrounds, it is recommended to avoid such wording.
Instead of using these terms, you can use more neutral language such as "blocklist" or "allowlist" to describe lists of items that should be blocked or allowed, respectively. Using neutral language can help to make your code more inclusive and welcoming to a wider range of users.
Here are a few examples of words and phrases that you might want to avoid to make your code more inclusive:
- Blacklist/whitelist: These terms have a history of association with racism and discrimination, and may be seen as offensive or inappropriate by some readers.
- Master/slave: These terms are often used to refer to the primary and secondary copies of data in a database, but they have a history of association with slavery and may be seen as offensive by some readers.
- Dummy/stub: These terms are often used to refer to placeholder objects in code, but they can be seen as condescending or belittling by some readers.
It is important to be mindful of the language you use in your code and to choose words that are neutral and inclusive. Using inclusive language can help to make your code more welcoming and accessible to a wider range of users.
Codiga provides a static code analyzer that works at every step of your development process. With the Codiga IDE plugins, you can ensure that non-inclusive words are being detected and replacements are suggested, as shown below. You can also check the same rules in your CI/CD pipeline at every pull request.
To use Codiga in your IDE:
- Download Codiga for your IDE
- Add a
codiga.ymlfile at the root of your project with the content below (you will be using the
If you also want to check your code at each pull and push request, install Codiga on your repository as well:
The rule checks for function names as well as variable names. You can explore the rules and test them yourself by visiting the ruleset on the Codiga Hub.
Make your Python code more inclusive as well!
If you are also using Python, consider using the
python-inclusive ruleset that ensures
that your Python code follows inclusive coding guidelines.