The humble linter package
pip install lint-utils
lu check src
or
lu check path/to/file_1.py path/to/file_2/ path/to/dir
short alias: lu check ...
full alias lint-utils check ...
USL001 - Unused object class fields found
RL001 - The reminder has expired
Please enter a comment in the format # lu: RL001[YYYY-MM-DD]: write a note here
class Command:
async def execute(self) -> int:
return 3 # lu: RL001[2025-07-30]: fix later
You can create lint_utils.toml
in root project directory
[lint-utils]
exclude = []
lint.ignore = []
[lint-utils.exclude-base-classes]
USL001 = []
[lint-utils.exclude-classes]
USL001 = []
pyproject.toml
is also supported
...
[tool.lint-utils]
exclude = []
lint.ignore = []
[tool.lint-utils.exclude-base-classes]
USL001 = []
[tool.lint-utils.exclude-classes]
USL001 = []
If you put a file path in the exclude list, it will be ignored during checking.
...
[tool.lint-utils]
exclude = ["path/to/file.py"]
If you add a base class, it and its child classes will be ignored during validation.
...
[tool.lint-utils.exclude-base-classes]
USL001 = ["Exception"]
Example:
# src/exceptions.py
class FieldNameError(Exception):
def __init__(self, field_name: str) -> None:
self._field_name = field_name
This file will be ignored if USL001
rules are followed, because Exception
class putted in tool.lint-utils.exclude-base-classes
If you add a class, it will be ignored during validation.
...
[tool.lint-utils.exclude-classes]
USL001 = ["FieldNameError"]
Example:
# src/exceptions.py
class FieldNameError(Exception):
def __init__(self, field_name: str) -> None:
self._field_name = field_name
This file will be ignored, because FieldNameError
class putted in lint.exclude_classes for USL001
rule
If you add a rule code, it will be ignored during validation.
...
[tool.lint-utils]
lint.ignore = ["USL001"]
In order not to conflict with Ruff and noqa
, it was decided to specify the following design:
class CommandCommand:
def __init__(self, variable: str) -> None:
self._variable = variable # lu: USL001