-
-
Notifications
You must be signed in to change notification settings - Fork 308
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
Create sharable configuration presets for Flake8 #1105
Comments
In GitLab by @asottile on Jul 20, 2019, 07:20 The configuration situation in flake8 is already the most complicated part -- it's going to be a hard sell to complicate it even further. There's also the downside in that implicit configuration is reasonably hard to track down. As for your copy paste, you can reduce at least the following settings:
I still think I lean towards explicit configuration here -- even though it means some copy paste and needing something like all-repos to distribute updates |
I'm surprised I didn't comment on this back on GitLab. Needless to say, @asottile is 100% correct. Config management is already incredibly complicated because of the history of the project. It's been near impossible to deprecate things to make it maintainable (the last attempt was during 3.0). |
Oh, wow. Great work on moving to GitHub! And as I was mentioned in this issue: Example: extends:
- typed-linter/recommended
- flake8/recommended
overrides:
- glob: some/**/*.py
checks:
- name: flake8/W504
level: none
settings:
type-engine:
name: typed-linter/mypy
reporter:
name: typed-linter/rich Link: https://github.com/wemake-services/typed-linter/ (it is private for now, but can be helpful in the future) I think that this issue can be closed. |
I think I'm still going to do this, just not at this time. I'm planning to rework the configuration bits with this in mind |
I think there might be an easier way to do this @asottile without a giant refactoring being necessary |
In GitLab by @sobolevn on Jul 20, 2019, 02:35
Problem
I am writing quite a complex plugin with lots of configuration options.
Moreover, I also depend on a lot of other plugins as dependencies.
Here's how my configuration looks like for an end user, contents of
setup.cfg
:Notice, that I also use
flake8-isort
and[isort]
option, there also might be other sections like[mypy]
forflake8-mypy
, or[bandit]
forflake8-bandit
or any other plugins whenflake8
acts like a wrapper for other tools.Currently, we will only talk about
[flake8]
section, since sadly we are not responsible for other tools.I do not want my users to copy-paste these settings for several reasons:
Real world use-cases
Several other linters have this feature. Some of them even consider it as a key feature.
When working for EsLint for example, one can just create a module with a single javascript file and reuse it everywhere.
I propose the same for
flake8
.Each user can create its own set of rules for an organisation / set of projects and reuse it without this amount of copy-paste.
Implementation details
Things to point out:
Configuration priority
Higher takes the priority over lower:
setup.cfg
/.flake8
--sharable-configuration
Creating new sharable configuration
I guess that reusing entry points here is the best option.
Then:
pip install my-flake8-config
flake8 --sharable-configuration=myconfig
Configuration class API
I am not sure about this. But my vision would be something like:
Conclusion
This feature allows to transfer configuration in a reliable and clean way, brings no breaking changes, follows the best practices of other lint tools.
Original issue from
wemake-python-styleguide
: wemake-services/wemake-python-styleguide#164The same feature I proposed for
isort
: PyCQA/isort#970I am super excited to help!
The text was updated successfully, but these errors were encountered: