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.

Attributes

Name Type Description
linter str The name of the linter to check (“flake8”, “pycodestyle”, “ruff”)
defaults dict The default maximum line length for each linter.
start_dir str The directory from which to start searching for configuration files.

Notes

Adapted from code generated by Perplexity.

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.