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 pre-commit hooks and ruff #106

Merged
merged 5 commits into from
Jul 17, 2024

Conversation

fpgmaas
Copy link
Collaborator

@fpgmaas fpgmaas commented Jul 15, 2024

The PR proposes to add pre-commit hooks and ruff to the project. I used the same configuration as used in deptry; by combining the options

[tool.ruff]
fix = true

and

hooks:
  - id: ruff
    args: [--exit-non-zero-on-fix]

we can use the pre-commit hooks to both auto-fix locally, and validate in the CI/CD pipeline.

For now, most issues that were not auto-fixable I added to the ignore, to keep this PR manageable:

[tool.ruff.lint]
ignore = [
    "E501",  # Line too long
    "E712",  # Avoid equality comparisons to `False`; use `if not ...:` for false checks
    "F401",  # imported but unused;
    "F403",  # `from X import *` used; unable to detect undefined names
    "F405",  # X may be undefined, or defined from star imports
    "F841",  # Local variable `e_info` is assigned to but never used
]

When this is merged we should go over these in a new PR

@fpgmaas fpgmaas force-pushed the pre-commit-and-ruff branch from 3a63609 to 90ff4e2 Compare July 16, 2024 18:19
@fpgmaas fpgmaas marked this pull request as draft July 16, 2024 18:25
@fpgmaas fpgmaas force-pushed the pre-commit-and-ruff branch from 90ff4e2 to c9f92d0 Compare July 16, 2024 20:36
@fpgmaas fpgmaas marked this pull request as ready for review July 16, 2024 20:36
@fpgmaas fpgmaas requested a review from SemyonSinchenko July 17, 2024 04:18
@fpgmaas fpgmaas force-pushed the pre-commit-and-ruff branch from 0e97f39 to ec73630 Compare July 17, 2024 07:12
@fpgmaas fpgmaas force-pushed the pre-commit-and-ruff branch from 2e00c0a to 01568a5 Compare July 17, 2024 07:28
Copy link
Collaborator

@SemyonSinchenko SemyonSinchenko left a comment

Choose a reason for hiding this comment

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

LGTM!

@SemyonSinchenko SemyonSinchenko merged commit 39c3bb1 into MrPowers:main Jul 17, 2024
7 checks passed
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.

2 participants