Usage
Install Lintel and learn about its usage:
pip install lintel
lintel --help
Configuration Files
Lintel supports ini-like and toml configuration files. In order for Lintel to use a configuration file automatically, it must be named one of the following options.
setup.cfgtox.inipyproject.toml
When searching for a configuration file, Lintel looks for one of the file specified above in that exact order in
the first specified path if that path is a directory or
the current working directory, if no source files were specified or the the first specified path is not a directory.
A configuration file can also be provided via the --config CLI option.
ini-like configuration files must have a [lintel] section while toml
configuration files must have a [tool.lintel] section.
Available Options
Get available configuration options by running:
lintel --help
Example
[lintel]
ignore = D100,D203,D405
Ignore error codes in-file
Lintel supports module-level or inline commenting to skip specific checks on specific modules, classes, or functions/methods. The supported comments that can be added are:
# lintel: noqaon the module level deactivates Lintel for a module.# noqa: D100on the module level deactivates the D100 check for a module.# noqainline skips all checks for the function or class on that line.# noqa: D102,D203inline can be used to skip specific checks for a specific class or function.
For example, this will skip the check for a period at the end of a function docstring:
>>> def bad_function(): # noqa: D400
... """Omit a period in the docstring as an exception"""
... pass
Usage with pre-commit
lintel can be included as a hook for pre-commit. The easiest way to get
started is to add this configuration to your .pre-commit-config.yaml:
- repo: https://github.com/Mr-Pepe/lintel rev: 0.1.1.dev1+g4b77343 # pick a git hash / tag to point to hooks: - id: lintel
See the pre-commit docs for how to customize this configuration.