Skip to content
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 line limit is inconsistent with Black #2064

Open
freakboy3742 opened this issue Nov 20, 2024 · 2 comments
Open

Flake8 line limit is inconsistent with Black #2064

freakboy3742 opened this issue Nov 20, 2024 · 2 comments
Labels
enhancement New features, or improvements to existing features. good first issue Is this your first time contributing? This could be a good place to start!

Comments

@freakboy3742
Copy link
Member

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.

@freakboy3742 freakboy3742 added enhancement New features, or improvements to existing features. good first issue Is this your first time contributing? This could be a good place to start! labels Nov 20, 2024
@rmartin16
Copy link
Member

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
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features, or improvements to existing features. good first issue Is this your first time contributing? This could be a good place to start!
Projects
None yet
Development

No branches or pull requests

2 participants