Skip to content

Conversation

@sgonorov
Copy link
Contributor

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

@sgonorov sgonorov self-assigned this Nov 13, 2025
@github-actions github-actions bot added category: GHA CI based on Github actions no-match-files labels Nov 13, 2025
@@ -0,0 +1,20 @@
repos:
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Collaborator

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?

Copy link
Contributor Author

@sgonorov sgonorov Nov 13, 2025

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.

Copy link
Contributor Author

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.

Copy link
Collaborator

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:

  1. 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.
  2. Enable rule by rule with appropriate files linting fixes. I guess this is how you want to proceed.
  3. 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?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 is the best

Copy link
Contributor Author

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.

@Wovchena Wovchena requested a review from Copilot November 13, 2025 09:59
Copy link
Contributor

Copilot AI left a 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.

@github-actions github-actions bot added the category: cmake / build Cmake scripts label Nov 13, 2025
@sgonorov sgonorov force-pushed the precommit_min_implementation branch from 3f909bd to 3248f48 Compare November 14, 2025 09:25
@sgonorov sgonorov requested a review from as-suvorov November 14, 2025 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: cmake / build Cmake scripts category: GHA CI based on Github actions no-match-files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants