LineLengthDetector
linelength.LineLengthDetector(linter, start_dir='.')Detect the configured line length for a given Python linter.
This class searches for relevant configuration files in the directory tree, extracts the maximum line length setting for the specified linter, and returns the default value if no configuration is found.
This uses to apply to flake8, pycodestyle and ruff but was amended to just flake8 following #192. However, the class structure has been left similar to before, so it can be easily extended to other tools in future.
Attributes
| Name | Type | Description |
|---|---|---|
| defaults | dict | The default maximum line length for each linter. |
| linter | str | The name of the linter to check. |
| start_dir | Path | The directory from which to start searching for configuration files. |
Methods
| Name | Description |
|---|---|
| get_line_length | Get the configured maximum line length for the specified linter. |
get_line_length
linelength.LineLengthDetector.get_line_length()Get the configured maximum line length for the specified linter.
Returns
| Name | Type | Description |
|---|---|---|
| int | The maximum line length. |