Skip to content

barbarrista/lint-utils

Repository files navigation

Lint Utils

The humble linter package

Installation

pip install lint-utils

Usage

lu check src

or

lu check path/to/file_1.py path/to/file_2/ path/to/dir

Aliases

short alias: lu check ...

full alias lint-utils check ...

Rules

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

Configuration

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 = []

exclude

If you put a file path in the exclude list, it will be ignored during checking.

...

[tool.lint-utils]
exclude = ["path/to/file.py"]

tool.lint-utils.exclude-base-classes

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

tool.lint-utils.exclude-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

lint.ignore

If you add a rule code, it will be ignored during validation.

...

[tool.lint-utils]
lint.ignore = ["USL001"]

Line ignoring

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages