-
Notifications
You must be signed in to change notification settings - Fork 10
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
Flake8 --config
option not supported
#10
Comments
Hi. And thanks. Yeah, I don't like my repos to be cluttered with a variety of config files, one for each tool, and it seems that many people feel the same. As for this particular case, I'm not surprised at all it crashes. You're giving Flake8 a According to Flake8's documentation of the
Flake8-pyproject already does just that. It ignores "all other config files that exist" if you run it from the folder that contains
|
I think the detail you're missing is one can have a monorepo-ish repo, with 2+ subpackages inside one repo. Each subpackage has its own unique To add to this, since a repos:
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
name: flake8 subfolder 1
alias: flake8-subfolder1
files: ^subfolder1/
args:
- "--config=subfolder1/setup.cfg"
additional_dependencies:
- flake8-bugbear
- flake8-docstrings Ideally I can leverage Flake-pyproject and change to this: args:
- "--config=subfolder1/pyproject.toml" However, without |
I see. But then the problem is that you cannot set the working directory for the pre-commit command. This seems to be a frequent complaint: pre-commit/pre-commit#1417. There are also a number of other packages that do the same, or almost the same, as this one here. I've mentioned some (probably not all) of them in #2. Since they each patch Flake8 somewhat differently, you might find one that works for your use case. |
Thanks for sharing the alternatives! And let's just ignore the pre-commit anecdote, I feel it's beside the point. I will say, given this project's core goal is integrating a new config file type to flake8, imo it's surprising to not support flake8's non-default path to config option. It feels like Open to answering any follow up questions, thanks for entertaining this nonetheless! |
You have a point there. Though I also wrote in the ReadMe that users have to run the The reason for this scope limitation is that it simplifies the code quite a bit. Which is always a good thing. I want to spend as little time as possible maintaining this. I just want to use it in CI, for other projects. But I'm not against adding this, provided it doesn't complicate things too much. Based on your use case, it looks like it would be easy to test with the fixtures that already exist. So the test suite would only need minor changes. I may look into this at some point. But if you want to give it a shot, please do. The first step would be to find out where in its code Flake8 parses that |
--config
option not supported
I went another way for solving the same issue instead: #11 Currently running for myself, but I would also understand if this is not the way that you would choose to solve it. Let me know if I can adapt it somehow so that it might also help out others. :) Great plugin, in any case! I really like not having to run a separate command for having my config in |
@justcallmelarry That looks pretty good, thanks! Definitely doesn't add too much complexity, and even comes with a test. I'll just have to find some time to cut a new release, but I'll merge that eventually. |
A custom command-line option |
Already using it, love it!! ❤️ |
@jamesbraza did this work out for you using pre-commit? I tried to use it but somehow the --toml-config is not applied when run using pre-commit - repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
- flake8-pyproject
- flake8-bugbear
args:
- --toml-config web/pyproject.toml
files: ^web/ However running Edit: Just found out what's going on. The following was the output: So I changed the - --toml-config=web/pyproject.toml Now it works... 👀 I will open a bug report with pre-commit, it seems that it doesn't handle the args correctly. |
Glad you figured it out. I have |
Firstly, this is an awesome project, I have been waiting for this for years! So before I begin, keep it up, you're helping make the Python community amazing!
When I go to the directory with
pyproject.toml
and invokeflake8
, everything works fine. 👍However, when I try
flake8 --config pyproject.toml
, I get the following:All of the lines reported (60, 65, 102, 111, 168) correspond with the ending
]
from a list. Also, some of them are for configs for other tools (e.g.pylint
).For example, line 60 and 65 are shown below (I added a comment to make it clear):
Is there anything you can do about this? I use
flake8 --config
in CI, so currently I can't use Flake8-pyproject until this is fixed.Versions
I am using Python 3.10.3 and the following:
The text was updated successfully, but these errors were encountered: