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

Autopep8 enforces the maximum line length differently #2750

Closed
3 tasks done
falkoschindler opened this issue Mar 22, 2024 · 3 comments
Closed
3 tasks done

Autopep8 enforces the maximum line length differently #2750

falkoschindler opened this issue Mar 22, 2024 · 3 comments
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@falkoschindler
Copy link
Contributor

falkoschindler commented Mar 22, 2024

Description

As noticed by @petergaultney in #2704 (comment), the CONTRIBUTING.md file recommends running

autopep8 --max-line-length=120 --experimental  --in-place --recursive .

to auto-format the code, which causes quite some changes in the codebase, which is usually formatted with the autopep8 VSCode extension. There are 15 files with too long lines that get wrapped. I tried removing the --experimental argument, which doesn't seem to make a difference.

  • Somehow we need to find a configuration that yields the same results via VSCode or the command line.
  • By the way, I wonder what --experimental is supposed to do. Maybe we can remove it.
  • And while at it, we should fix these 15 files, which violate the maximum line length. - Naah, we leave them for now.
@petergaultney
Copy link
Contributor

petergaultney commented Apr 1, 2024

one minor add-on question here: would y'all consider introducing something like pre-commit so that at least a few of these things can be set up as git commit hooks for developers? It's not something that can get enforced locally, but it does make it a little easier for devs not to miss running them.

It's usually quite easy to get a basic pre-commit config set up, and I'd be happy to make the PR (and change the CONTRIBUTING document to let people know that they can install it)

@falkoschindler
Copy link
Contributor Author

@petergaultney Yes, there have been attempts towards pre-commit hooks recently (PR #2563 and PR #2619) and we're definitely considering it. But I guess we need to find a "recipe" first, which works on all machines and yields same results like the IDE integration(s) we're recommending to use.

@codingpaula
Copy link
Contributor

When I run the autopep8 command without the --experimental flag, it doesn't change these 15 files for me. And since the changes for the long lines in these cases are in some cases a little weird, the easiest option would be to remove the --experimental from the suggested command. Then VSCode and the command yield the same result.

@falkoschindler falkoschindler added this to the 1.4.20 milestone Apr 4, 2024
@falkoschindler falkoschindler added documentation Improvements or additions to documentation and removed help wanted Extra attention is needed labels Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants