Karen Inspect is a Python linter designed to make code "HR-approved" by catching "naughty" words, offensive language, and enforcing strict rules that would make an overzealous HR representative proud.
whitelist
, blacklist
, master
, slave
, and more.stupid
or lazy
, result in "IMMEDIATE TERMINATION" warnings.Violations found in noncompliant_py_file.py:
Line 3: print("This is a dummy function with a whitelist.")
Found 'whitelist' -> Rule: Karen prefers more inclusive language. Use "allowlist" instead. (WARNING)
Line 7: print("My boss is stupid, and I feel lazy after my lunch break.")
Found 'lunch break' -> Rule: You can have a break, but don’t mention it. (WARNING)
Found 'lazy' -> Rule: We don’t tolerate calling anyone lazy here. (IMMEDIATE TERMINATION)
Found 'stupid' -> Rule: Calling things or people stupid is unacceptable. (IMMEDIATE TERMINATION)
To install the linter in your environment:
pip install karen-inspect
You can integrate Karen Inspect with Git to automatically lint your Python code before committing by adding it as a pre-commit hook.
Install pre-commit if you haven’t already:
pip install pre-commit
Add the following to your .pre-commit-config.yaml
:
repos:
- repo: https://github.com/amshamah419/Karen-Inspect
rev: v0.1.0
hooks:
- id: karen-inspect
Install the pre-commit hook:
pre-commit install
Now, every time you make a commit, Karen Inspect will automatically check your Python files for violations.
Run the linter from the command line, specifying the Python file you want to inspect:
karen-inspect path/to/your/python_file.py
The linter supports rules which HR has learned over the years, such as:
Contributions, feature requests, and complaints (from "Karen") are welcome!
Feel free to open an issue or submit a pull request.