-
Notifications
You must be signed in to change notification settings - Fork 382
Configure Neovim and pre-commit to run flake8 and pylint #1339
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
Configure Neovim and pre-commit to run flake8 and pylint #1339
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances Python code quality enforcement by enabling flake8 and pylint linters in both the development environment (Neovim) and the pre-commit pipeline. The changes also remove the obsolete fix-encoding-pragma hook, which is unnecessary for Python 3+.
Key Changes
- Enabled flake8 and pylint in Neovim's ALE linter configuration for real-time feedback during development
- Uncommented and activated the flake8 pre-commit hook to catch issues before commits
- Removed the deprecated
fix-encoding-pragmahook that added UTF-8 encoding declarations
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
.pre-commit-config.yaml |
Enabled flake8 pre-commit hook and removed obsolete encoding pragma fixer |
.nvim.lua |
Added flake8 and pylint to ALE linters for Python files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
becddb8 to
5225375
Compare
|
Pylint rolled out v4.x overnight, which we're not able to use because of other dependencies. So I reworked the GitHub CI/CD to use our dependencies (pyproject.toml) to determine the pylint to install and use. Thanks, |
|
I'd rather not have flake8, pylint, etc. as part of pre-commit. Pre-commit has most of the cleanup tasks that change indentation, non-utf characters, etc. Having pylint and flake8 as part of pre-commit takes too long. |
My thinking is that pre-commit when running as a commit hook (how I most rely on it) runs only on the files being committed, so placing them there presents a gatepost for incremental code improvement, given reasonable rules definition. Their execution time is order-n on the files being scanned, so for properly-sized commits the increase is negligible. That's the use case I'm trying to address. And I HATE getting whacked in the GitHub lint workflows for something that could have been caught in pre-commit. Having said that, I think we need to steer clear of using 'pre-commit run --all-files' as part of a regular commit or CI/CD lifecycle. That's something that can be controlled from the Makefile and the GitHub workflows independently. (Let me know if I need to do some "typical commit" benchmarking to convince you.) |
|
@crivetimihai Perhaps two commit files?
|
Signed-off-by: Jonathan Springer <[email protected]>
Signed-off-by: Jonathan Springer <[email protected]>
Signed-off-by: Jonathan Springer <[email protected]>
Signed-off-by: Jonathan Springer <[email protected]>
Signed-off-by: Jonathan Springer <[email protected]>
…sts and build check Signed-off-by: Jonathan Springer <[email protected]>
The pre-commit target was using 'uv pre-commit run' which is not a valid uv subcommand. Changed to 'uv run pre-commit run' to properly invoke the pre-commit tool through uv's run command. Signed-off-by: Mihai Criveti <[email protected]>
f74a758 to
a09067f
Compare
Summary
fix-encoding-pragmahook (Python 3+ doesn't require encoding declarations)Benefits
Test plan
pre-commit run flake8executes successfully