flakeheaven._patched._checkers

class flakeheaven._patched._checkers.FlakeHeavenCheckersManager(baseline: Optional[str], **kwargs)[source]

Bases: flake8.checker.Manager

Patched flake8.checker.Manager to provide plugins support

Initialize our Manager instance.

Parameters
  • style_guide (flake8.style_guide.StyleGuide) – The instantiated style guide for this instance of Flake8.

  • arguments (list) – The extra arguments parsed from the CLI (if any)

  • checker_plugins (flake8.plugins.manager.Checkers) – The plugins representing checks parsed from entry-points.

_get_rules(plugin_name: str, filename: str) List[str][source]
_handle_results(filename: str, results: list, plugin_name: str, ignored_codes: Tuple[str, ...]) int[source]
_should_process(argument: str, filename: str, check_type: str, check: Dict[str, Any]) bool[source]
is_path_excluded(filename: str) bool[source]

Patched is_path_excluded.

We patch it to exclude files not specified explicitly. It is helpful when you want to run flakeheaven with –diff and explicitly passed paths at the same time.

Run flakeheaven only on changes in example.py:

git diff | flakeheaven lint –diff example.py

make_checkers(paths: Optional[List[str]] = None) None[source]

Reloaded checkers generator to provide one checker per file per rule. Original make_checkers provides checker per file with all rules mixed. It makes difficult to filter checks by codes after all.

report() Tuple[int, int][source]

Reloaded report generation to filter out excluded error codes.

  • use checker.filename as path instead of checker.display_name

  • pass checker into _handle_results to get plugin name.

class flakeheaven._patched._checkers.FlakeHeavenFileChecker(filename, checks, options)[source]

Bases: flake8.checker.FileChecker

A little bit patched FileChecker to support –safe

Initialize our file checker.

Parameters
  • filename (str) – Name of the file to check.

  • checks (dict) – The plugins registered to check the file.

  • options (argparse.Namespace) – Parsed option values from config and command-line.

_make_processor() Optional[flakeheaven._patched._processor.FlakeHeavenProcessor][source]
_processed_plugin: str = 'pycodestyle'
report(error_code: Optional[str], line_number: int, column: int, text: str) str[source]

Copy-pasted report method to store Result in self.results instead of tuple and provide plugin_name.

run_check(plugin: Dict[str, Any], **arguments)[source]

Run the check in a single plugin.

run_checks() Tuple[str, List[flakeheaven._patched._checkers.Result], Dict[str, Any]][source]

Run checks against the file.

snapshot: flakeheaven._logic._snapshot.Snapshot
class flakeheaven._patched._checkers.Result(plugin_name, error_code, line_number, column, text, line)[source]

Bases: tuple

Create new instance of Result(plugin_name, error_code, line_number, column, text, line)

_asdict()

Return a new OrderedDict which maps field names to their values.

_field_defaults = {}
_field_types = {'column': <class 'int'>, 'error_code': <class 'str'>, 'line': <class 'str'>, 'line_number': <class 'int'>, 'plugin_name': <class 'str'>, 'text': <class 'str'>}
_fields = ('plugin_name', 'error_code', 'line_number', 'column', 'text', 'line')
_fields_defaults = {}
classmethod _make(iterable)

Make a new Result object from a sequence or iterable

_replace(**kwds)

Return a new Result object replacing specified fields with new values

property column

Alias for field number 3

property error_code

Alias for field number 1

property line

Alias for field number 5

property line_number

Alias for field number 2

property plugin_name

Alias for field number 0

property text

Alias for field number 4

flakeheaven._patched._checkers.is_relative_to(path: pathlib.Path, maybe_parent: pathlib.Path)[source]