Open luzfcb opened 2 years ago
Thank you for your suggestion. However, this issue tracker is for issues with the Python.org website itself. Issues affecting the cpython code base and development process should be reported on the cpython issue tracker (https://github.com/python/cpython/issues).
@ned-deily I think there was a misunderstanding.
yes, I know this repository is for the Python.org website. My proposal is for the Python.org website codebase (which is made using Django framework) and not cpython.
Would it be possible to reopen the issue, since it is still pertinent to the Python.org website project, and not is a suggestion for the cpython project?
Sorry for the misunderstanding and thanks for clarifying the issue title!
See https://github.com/python/pythondotorg/issues/2539 and https://github.com/python/pythondotorg/pull/2540 which will format with Ruff and take care of some of these.
Is your feature request related to a problem? Please describe.
As the Python.org website is an open source project and a project open to external contributions, it is necessary for long-term maintenance and to lessen the workload of the maintainers to define what the project expects in terms of minimum code quality and perhaps also in terms of code style, thus making it easier for potential external contributors to contribute to the project.
The Python ecosystem has many tools that can analyze, suggest fixes, and automatically apply fixes to many of the common programming and code styling errors.
Making it as simple as possible to contribute to running the linter test suite and applying fixes is also an important factor in facilitating code contribution and review.
Describe the solution you'd like
My proposal is to add the below list of lint and fixers tools:
pre-commit
can keep separate virtualenvs for the tools, keep them isolated and up-to-date as per the pre-commit configuration file. Furthermore, it allows you to easily run all the tools simply by running thepre-commit
command.fix-byte-order-marker
- removes UTF-8 byte order marker 6.2check-case-conflict
- Check for files with names that would conflict on a case-insensitive filesystem like MacOS HFS+ or Windows FAT. 6.3check-merge-conflict
- Check for files that contain merge conflict strings. 6.4check-symlinks
- Checks for symlinks which do not point to anything. 6.5debug-statements
- Check for debugger imports and py37+ breakpoint() calls in python source. 6.6detect-private-key
- Checks for the existence of private keys. 6.7mixed-line-ending
- Replaces or checks mixed line ending. 6.8end-of-file-fixer
- Makes sure files end in a newline and only a newline. 6.9double-quote-string-fixer
- This hook replaces double quoted strings with single quoted strings, but keet when the double quoted string contains a single quotes. This ensures that the codebase maintains compatibility with the Python interpreter's default behavior regarding the visual representation of strings. 6.10no-commit-to-branch
- Used to avoid committing directly in specific branches like themain
branch. This helps encourage the use of branches and helps prevent the contributor from making changes to the protected branch and end up having too many git conflicts when creating/rebasing a pull-requesteditorconfig
support, while VS Code is required to install the plugin manually.Probably someone will suggest
black
. I don't like parts of the style of code generated byblack
, mainly because code that was purposely implemented in multiple lines in order to make it easier to use git diff in the future can be converted to single line code, which makes investigating changes via diff and git history much more complicated that should be. Sinceblack
is extremely opinionated and most rules are mandatory and cannot be configured, I like to avoidblack
whenever I can in my projects. I think it's up to the project to decide what's good for the project and what's not. That said, in case the maintainers wantblack
to be set, then I can include it in the list above;If the maintainers agree with the proposal or part of the proposal, I commit to implementing them in the next few weeks in separate pull requests.