nitpick icon indicating copy to clipboard operation
nitpick copied to clipboard

Can't configure `.flake8` comma separated value

Open Avasam opened this issue 3 years ago • 2 comments

Expected behavior

Use CSV for .flake8 ie: ignore-names=closeEvent,paintEvent,keyPressEvent,mousePressEvent,mouseMoveEvent,mouseReleaseEvent

Current behavior

ignore-names=["closeEvent", "paintEvent", "keyPressEvent", "mousePressEvent", "mouseMoveEvent", "mouseReleaseEvent"] or an error if I try to configure nitpick.files.".flake8"

https://github.com/Avasam/nitpick.styles/blob/main/python.toml:1: NIP001  has an incorrect style. Invalid config:
nitpick.files.".flake8": Unknown file. See https://nitpick.rtfd.io/en/latest/nitpick_section.html#nitpick-files.
Violations: ❌ 1 to change manually.

Steps to reproduce

# This throws an error when running `nitpick check`
[nitpick.files.".flake8"]
comma_separated_values = ["flake8.ignore-names"]

[".flake8".flake8]
# PyQt methods
ignore-names = ["closeEvent", "paintEvent", "keyPressEvent", "mousePressEvent", "mouseMoveEvent", "mouseReleaseEvent"]
  1. Configure nitpick TOML style as above
  2. Run nitpick check

Possible Solution

Temporary workaround: I could use strings instead in the toml config, but then I lose the ability to have partial lists (where the user of my nitpick style could add more to ignore-names), as well as multiline configs.

I could just switch to Flake9 or FlakeHeaven to support TOML config given that Flake8's config files are a mess in the first place 😝 But a proper working solution for .flake8 would be nice.

Context

I'm trying to enforce the following config in .flake8:

[flake8]
ignore-names=closeEvent,paintEvent,keyPressEvent,mousePressEvent,mouseMoveEvent,mouseReleaseEvent

Your environment

  • nitpick version used: 0.32.0
  • Python version: Python 3.9.13
  • Operating System and version: Windows 10.0.19044
  • Link to your project:
    • https://github.com/Avasam/nitpick.styles
    • https://github.com/Avasam/Auto-Split/tree/nitpick
    • https://github.com/Avasam/speedrun.com_global_scoreboard_webapp/tree/nitpick

For more information, see the CONTRIBUTING guide.

Avasam avatar Jul 18 '22 21:07 Avasam

But a proper working solution for .flake8 would be nice.

Indeed, I agree. 😅

I hope it's a simple fix, I'll take a look when I have some time. Thanks for the report. 🙏🏻

andreoliwa avatar Sep 19 '22 21:09 andreoliwa

For what it's worth, I changed from flake8 to Ruff, so this is less of a priority to get nitpick working for me.

Avasam avatar Mar 20 '23 20:03 Avasam