grantjenks / blue

The slightly less uncompromising Python code formatter.
https://blue.readthedocs.io/
Other
387 stars 21 forks source link

feat: remove flake8 dependency #96

Open kaweantonio opened 1 year ago

kaweantonio commented 1 year ago

Fixes: #78

Blue relies on flake8 to parse config files like 'setup.cfg', 'tox.ini' and '.blue'. This was done using ConfigParser and ConfigFileFinder classes, but in flake8 v5/6 these classes have been removed.

To fix the problem, all flake8 related code was removed and replace with a new function that parses the config files. This is all done using ConfigParser class from configparser module.

The new function is largely inspired by Flake8 own implementation, mainly the load_config and parse_config functions.

kaweantonio commented 1 year ago

@warsaw can you review this PR?

kaweantonio commented 1 year ago

@krcb197 The fix only looks in the current working directory, but shouldn't be hard to improve load_configs_from_file to match Black behavior/logic. I'll update my PR in the next days to include this change.

kaweantonio commented 1 year ago

@krcb197 PR updated applying Black logic for config files. Waiting for your review :)

krcb197 commented 1 year ago

Looks good to me