-
Notifications
You must be signed in to change notification settings - Fork 300
Minimal pre-commit implementation #3008
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
base: master
Are you sure you want to change the base?
Minimal pre-commit implementation #3008
Conversation
| @@ -0,0 +1,20 @@ | |||
| repos: | |||
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.
Am I right that it would be required to fix linting issues for any changed files?
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.
Yes, only for changed ones.
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.
So If I change 2 lines in several hundred loc file I would be required to fix lint for the whole file. Then feature changes would endup hidden in the linting changes. Is it correct?
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.
Yes, that's the way. We can't partially format file sadly.
But for now it's mostly whitespaces as a starting point so it won't affect much. Later I'll try to make a separate PRs with properly formatted files and new formatters/linters introduction.
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.
BTW, for python there's a formatter called Darker which is compatible with Ruff format, but applies changes only to changed lines. When we get to it, maybe we'll use it instead of simply enabling Ruff across the codebase.
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.
I guess whitespaces only rules are ok for now. But I'm not sure about more complex rules.
I see 3 options:
- Enable rules. Expect PRs to fix linting along with the feature changes.
This would be unconvenient for both, reviewer and author. Especialy for external contributors. We could ask to fix linting in a separate first to split linting and feature changes. But still confusing for external contributors. - Enable rule by rule with appropriate files linting fixes. I guess this is how you want to proceed.
- Enable rules and implement filter pattern to filter out not linted files. Then we could incrementially fix linting and update filter.
Any more ideas on this?
Do you want to proceed with option 2? If yes, maybe we could start with this plan in this PR and fix whitespaces?
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.
2 is the best
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.
I've added Darker and yes, path 2 is the good one. Whitespaces is in around 200+ files. So i'll make it as a separate PR after this one.
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 introduces a minimal pre-commit configuration for the repository with automated linting in CI. The implementation focuses on basic code hygiene checks like whitespace handling, file endings, and security validations, serving as a foundation for future linting tools.
Key Changes:
- Added pre-commit configuration with standard hooks for whitespace, file endings, and basic validation
- Created GitHub Actions workflow to run pre-commit checks on changed files in pull requests
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
.pre-commit-config.yaml |
Defines pre-commit hooks for trailing whitespace, end-of-file fixing, merge conflicts, symlinks, private keys, line endings, and file format validation |
.github/workflows/lint.yml |
Implements CI workflow that downloads OpenVINO, sets up dependencies, and runs pre-commit checks on changed files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3f909bd to
3248f48
Compare
Minimal pre-commit configuration and CI integration.
For now only fixes whitespaces/end-of-file and some other small checks.
Will be used a base for adding other linters.
For the maxed-out Formatting/Linting see PR: #2980