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

move ruff and bandit checks to pre-commit #8646

Merged
merged 7 commits into from
Jul 15, 2024

Conversation

zacharyburnett
Copy link
Collaborator

@zacharyburnett zacharyburnett commented Jul 15, 2024

uses pre-commit for linting, formatting, and security checking. By default, pre-commit is run only on changes lines. Putting these checks in .pre-commit-config.yaml ensures that we can pin the ruff version to make sure that new rules don't break style checks randomly

Checklist for PR authors (skip items if you don't have permissions or they are not applicable)

  • added entry in CHANGES.rst within the relevant release section
  • updated or added relevant tests
  • updated relevant documentation
  • added relevant milestone
  • added relevant label(s)
  • ran regression tests, post a link to the Jenkins job below.
    How to run regression tests on a PR
  • All comments are resolved
  • Make sure the JIRA ticket is resolved properly

@zacharyburnett zacharyburnett self-assigned this Jul 15, 2024
@github-actions github-actions bot added testing automation Continuous Integration (CI) and testing automation tools labels Jul 15, 2024
@zacharyburnett zacharyburnett marked this pull request as ready for review July 15, 2024 15:39
@zacharyburnett zacharyburnett requested a review from a team as a code owner July 15, 2024 15:39
@zacharyburnett zacharyburnett requested review from braingram and removed request for a team July 15, 2024 15:39
@braingram
Copy link
Collaborator

I always get this mixed up but does adding this file also mean the pre-commit bot will auto-fix PRs?

@braingram
Copy link
Collaborator

I'm also failing to find where pre-commit runs in the CI.

Perhaps we need a new workflow to run pre-commit (perhaps like the one in asdf).

We could also enable the bot (but I don't trust it as you already know).

Copy link

codecov bot commented Jul 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.60%. Comparing base (2d15511) to head (d0dbbe7).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8646   +/-   ##
=======================================
  Coverage   59.60%   59.60%           
=======================================
  Files         391      391           
  Lines       39286    39286           
=======================================
  Hits        23418    23418           
  Misses      15868    15868           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@braingram
Copy link
Collaborator

:-O I think we should dial back those pre-commit hooks or exclude more files. The log for the pre-commit job is over 50k lines long...

@zacharyburnett
Copy link
Collaborator Author

:-O I think we should dial back those pre-commit hooks or exclude more files. The log for the pre-commit job is over 50k lines long...

yeah it looks like it was ruff format, trim-trailing-whitespace, and end-of-file-fixer. I thought they would only run on changed files, though...

Copy link
Collaborator

@braingram braingram left a comment

Choose a reason for hiding this comment

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

Thanks!

Once this is merged the branch protection rules can be updated to check for pre-commit instead of check-style.

@zacharyburnett zacharyburnett merged commit dd76184 into spacetelescope:master Jul 15, 2024
23 checks passed
@zacharyburnett zacharyburnett deleted the lint/pre_commit branch July 15, 2024 17:13
@nden nden added this to the Build 11.1 milestone Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation Continuous Integration (CI) and testing automation tools installation msa_flagging no-changelog-entry-needed testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants