Skip to content

Official API for seeing selected error codes / document existing way of doing it #1776

Closed
@jakkdl

Description

@jakkdl

describe the request

When implementing python-trio/flake8-async#91 I wanted to be able to access what error codes have been selected/ignored by the user.
https://flake8.pycqa.org/en/latest/plugin-development/plugin-parameters.html#registering-options mentions creating a parallel --select option, but having to register --select, --ignore, --extend-select, --extend-ignore etc and also recreating flake8's complicated logic for those seemed like a foolish task - and I ended up working around that by importing DecisionEngine and Decision from flake8.style_guide. It ended up working fairly well, though it became very involved to get it working in my tests - also needing to import flake8.main.options.register_default_options and manually adding extended_default_select and extended_default_ignore to get DecisionEngine.decision_for to work.

It all works in the end, but this seems like something that maybe should be easily accessible without having to delve into flake8's code and yank out undocumented functionality that one cannot rely on being stable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions