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

Add some pre-commit linters and clean tabs and trailing blanks #14872

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

guillaumelambert
Copy link
Contributor

@guillaumelambert guillaumelambert commented Apr 27, 2023

  • add a pre-commit linters configuration to clean tabs and trailing blanks
  • add a tox profile to ease running pre-commit linters locally and across different CI solutions
  • add it to azure tempate
  • run these linters and clean trailing blanks except where it causes troubles

Why I did it

ease code review and maintainability

Work item tracking
  • Microsoft ADO (number only):

How I did it

How to verify it

run tox and/or pre-commit locally

Which release branch to backport (provide reason below if selected)

potentially all but not sure

@guillaumelambert guillaumelambert force-pushed the tox_linters branch 8 times, most recently from cd97b3d to 25c4a10 Compare May 5, 2023 07:19
@guillaumelambert guillaumelambert force-pushed the tox_linters branch 8 times, most recently from 4d49a53 to c44899e Compare May 12, 2023 08:06
@guillaumelambert guillaumelambert force-pushed the tox_linters branch 14 times, most recently from 81ba881 to 4ee999d Compare May 16, 2023 21:56
@guillaumelambert guillaumelambert force-pushed the tox_linters branch 4 times, most recently from d82355e to 26b0fd5 Compare May 17, 2023 11:39
- add a pre-commit yaml configuration file with a basic profile to
  remove trailing blanks
- add a rule to exclude from its scope
  - patch files (generated from git diff)
    Trailing blanks are part of their syntax.
  - .conf files in the src folder
    Their trailing blanks removal make some tests fail during build.
  - jinja templates in docker folder
    Though trailing blank should not be part of the jinja2 syntax,
    these files use a known hack that requires trailing blanks.
    Their removal makes build fail.
- create a tox configuration to run/install/uninstall/autoupdate
  pre-commit in a python venv
- create a tox profile for the CI
  to run pre-commit only on files modified since this commit
- add a shell script to ease running pre-commit inside various CI

Issue sonic-net#15114

Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
Issue sonic-net#15114

Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
Issue sonic-net#15114

Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant