Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generic plugin hook for configuration #1657

Closed
bryevdv opened this issue Aug 8, 2022 · 2 comments
Closed

Add generic plugin hook for configuration #1657

bryevdv opened this issue Aug 8, 2022 · 2 comments

Comments

@bryevdv
Copy link

bryevdv commented Aug 8, 2022

describe the request

Currently flake8 recognizes two entry points for plugins:

  • flake8.extension
  • flake8.report

I would like to propose adding a new plugin hook flake8.configuration for intercepting and processing flake8 configuration options.

It seems that a configuration hook (if present) should be applied here:

parsed_config = config.parse_config(manager, cfg, cfg_dir)

A hook woud accept the parsed_config dict, and then return a new or modified dict that is used by the subsequent codepath. The approach would preserve (and further solidify) the status quo that command line options take precedence over parsed config values (whatever their origin). This approach also seems minimally invasive to the current codebase.

I believe this feature would a number of benefits to flake8 users and developers:

  • Easy to explain semantics: A config hook accepts the standard flake8 parsed config, and may modify it or replace it.
  • Affords a path to self-service for users wanting to configure flake8 by other mechanisms (e.g. database, API, env vars, secrets stores, or other files) that avoids burdening flake8 developers with commitments for use-cases that are too niche or new.

Is the implementation outline above technically sound from a high level perspective? If so, would a Pull Request for this feature be considered?

@asottile
Copy link
Member

asottile commented Aug 8, 2022

dupe #1105

@asottile asottile closed this as completed Aug 8, 2022
@asottile
Copy link
Member

asottile commented Aug 8, 2022

please don't work on this now, the work will be wasted because the internals are in flux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants