Package: blocklint
blocklintblocklintis a command line utility for finding non-inclusive wording.
This project is inspired byAlex.js.AboutIf you've used a modern IDE, you know the importance of immediate feedback
for compilation errors or even stylistic slip ups.  Knowing all variables
should be declared or that lines must be less than 80 characters long is good,
but adhering to those rules takes a back seat when in the flow of writing
code.  A linter brings these issues back into your consciousness by
highlighting the problematic lines of code.  Over time, the enforced style
becomes more intuitive but the linter is always there to nudge you if you slip.We are in the midst of changing attitudes towards words and phrases that are
not inclusive. Not only are developers acknowledging the offensive history of
terms like "master/slave" and "blacklist/whitelist", but we are taking active
steps to remove their usage and replace them with more appropriate language.
This tool is not a commentary on inclusion, but rather a utility to detect
whatever words you'd like to remove from code.Alex.jsis one option for highlighting offensive language,
but it is geared towards text documents such as markdown, misses common
constructs in source code and is also overly broad and prone to false
positives.  Blocklint is built with source code in mind and is more limited
in scope.Requirements and InstallationBlocklint is written in python and uses minimal, standard libraries.  It has
been tested for python >= 3.7  To install:pip install blocklintinto an appropriate environment.UsageWithout any arguments, blocklint will search all files in the current directory
for uses of master, slave, blacklist and whitelist:$pwd/path/to/blocklint/blocklint
$blocklint
/path/to/blocklint/blocklint/main.py:40:60:useof"blacklist"/path/to/blocklint/blocklint/main.py:40:37:useof"master"/path/to/blocklint/blocklint/main.py:40:44:useof"slave"/path/to/blocklint/blocklint/main.py:40:50:useof"whitelist"/path/to/blocklint/blocklint/main.py:55:53:useof"blacklist"/path/to/blocklint/blocklint/main.py:55:30:useof"master"/path/to/blocklint/blocklint/main.py:55:37:useof"slave"/path/to/blocklint/blocklint/main.py:55:43:useof"whitelist"Optionally, multiple files and directories can be specified to search.  The
detected words can be customized through several options; setting any will
clear the defaults.  Multiple words are specified as comma separated values:blocklist: Will match any occurrence of the word, ignoring case and special
characters.wordlist: Will match the word, ignoring case and special characters but
respecting word boundaries.exactlist: Will match the word as entered respecting word boundaries.Only the first match of a word in a line will be returned, but multiple words
can match on a single line.  Here are some examples:$blocklint--blocklisttest,asdf<(echothisTESTwillmatchaswilla_S-d:F)/dev/fd/63:1:29:useof"asdf"/dev/fd/63:1:5:useof"test"$blocklint--wordlisttest,asdf<(echothisTESTwillnotmatchbutT=E-ST,will)/dev/fd/63:1:29:useof"test"$blocklint--exactlistTest<(echothisTest,tEST,T-estfailbutTest!matches)/dev/fd/63:1:32:useof"Test"The-e,--end-posflag will provide the end position of the match in addition
to the start position.The--stdinflag will take values from stdin instead of a file or directory.The--skip-filesflag takes a comma-or-newline separated list of paths to files
that should not be checked by blocklint. This is useful when running blocklint on
a large directory.ConfigurationBlocklint supports the standardiniconfiguration format used by many other
linting tools, includingflake8.Command line arguments have highest priority, and override any arguments derived
from configuration files. Next highest are local filestox.ini,setup.cfg,
and.blocklint. Finally, a global config in~/.blocklintmay be used.Config files should contain a blocklint section in ini format, for example:[blocklint]
max_issue_threshold=10
blocklist=test,asdf
end_pos=store_trueOther example blocklists can be foundhere.Skipping linesIn addition to skipping entire files with the--skip-filesoption, single
lines can be skipped by including the (regex) phraseblocklint:.*pragma.
For example:defmain(blacklist,white_list):# blocklint: pragmaforiteminblacklist:# blocklint: some other information pragma...will pass all checks.IntegrationsThe integration directory contains information on using blocklint for:ALEpre-commitDon't see the tool you use?  Submit a pull request or issue!