beeware / briefcase

Tools to support converting a Python project into a standalone native application.
https://briefcase.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
2.68k stars 371 forks source link

Flake8 line limit is inconsistent with Black #2064

Open freakboy3742 opened 2 hours ago

freakboy3742 commented 2 hours ago

What is the problem or limitation you are having?

Briefcase's flake8 configuration (set in tox.ini because of... reasons) enforces a line length of 119. However, Black format enforces an 88 character limit. So - our code is being formatted to 88 character lines, but that won't format some comments and strings, which can lead to PRs that don't auto-flag a formatting issue.

Describe the solution you'd like

Briefcase's flake8 configuration should set an 88 characters limit (to match Black).

Existing code that exceeds the 88 character limit should be reformatted.

Describe alternatives you've considered

None

Additional context

After changing the tox.ini configuration, pre-commit run --all will highlight all the problem lines.

rmartin16 commented 2 hours ago

Of potential note, Black has exceptions to its line length limits; e.g. long literal strings. I'm not sure if flake8 has the same exceptions. Furthermore, I think that docformatter was helping to enforce these rules....but it's been disabled too. (And while moot, consolidating on Ruff would almost certainly remove these sorts of conflicts...)

freakboy3742 commented 2 hours ago

Yeah - most of the exceptions are things like long method names that black can't break, but Flake8 will report as an issue. Most of those are actually in Toga, in "duplicate argument name" ObjC methods.

As for Ruff: I'm becoming a lot more amenable to the idea. CPython is now using Ruff; and the appeal of having a single, consistent formatting tool is appealing - and the community around that tool seems more healthy than the one around flake8, in particular.

Regardless - any adoption of Ruff would be predicated by having consistent line length, so fixing this issue would be at least a co-requisite.