carstencodes / flake518

A small wrapper around flake8 enabling pyproject.toml
MIT License
11 stars 3 forks source link

`exclude` option does not behave like `flake8`’s #3

Closed benjamineskola closed 2 years ago

benjamineskola commented 2 years ago

(Flake518 v.1.1.0, Flake8 v3.9.2, on MacOS 12.1.)

For a Django project I’ve converted my .flake8 file into a [tool.flake8] section in pyproject.toml:

[tool.flake8]
exclude = ["library/migrations"]
…

However, the ./library/migrations directory is not being ignored by flake518 when I run it.

In debug mode the output includes the following:

The following configuration is written: {'flake8': {'exclude': 'library/migrations', …}}

I’ve managed to narrow down a few things that it’s not:

carstencodes commented 2 years ago

Thanks for reporting. Due to some medical issues, I'm currently in hospital. So the solution may take some time.

The config file itself is passed as an argument to the flake8 cli call and runs flake8 in process.

Could you try copying the file to a certain location and calling

flake8 --config path/to/file

If the issue continues, than it is an issue with flake8 not with flake518.

If it works, then flake8 has changed their main method and I might have to adopt the implementation.

benjamineskola commented 2 years ago

I've investigated further and it seems like the issue is due to the location of the temporary config file: flake8 is calculating exclude paths relative to the location of its config file, if they contain / (exclude paths without / can be anywhere).

So if I copy flake518's generated configuration into the project root and execute flake8 --config ./tmp.cfg this works, but if I copy it to my homedir and run flake8 --config ~/tmp.cfg it will not.

The fix for this is to ensure that flake518 creates its temporary config file in the same location, e.g., by passing the dir parameter to NamedTemporaryFile in adapter.py#225. I can open a PR for this for you.

Thanks for creating flake518!

carstencodes commented 2 years ago

Thanks for investigating and narrowing it down to that certain issues.

I appreciate your PR, but I have some suggestions.

Thanks for creating flake518!

You're welcome. Thanks for using.

I'll leave the issue open until the issue is tested, ok?