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

Consolidate pre-commit logic #422

Merged
merged 2 commits into from
Feb 13, 2024
Merged

Conversation

camposandro
Copy link
Contributor

@camposandro camposandro commented Feb 12, 2024

This pull request consolidates the code quality checks, removing the dedicated code style analysis pipeline and using pre-commit to handle the checks both locally and on the CI. Closes #410.

  • Removes the code_style.yml.jinja script
  • Adjusts pre-commit.ci to run over all files, not just changed files
  • Adjusts pre-commit.ci to disable fail-fast so all code style issues are surfaced at once
  • Makes the unit test hook run last because it's the most expensive

If configured, a bot will push automatic fixes to non-draft PRs to apply code formatting, ordering of imports and clear notebook outputs, if there are any (example). Most linting issues need to be addressed manually by the user.

Checklist

  • This PR is meant for the lincc-frameworks/python-project-template repo and not a downstream one instead.
  • This change is linked to an open issue
  • This change includes integration testing, or is small enough to be covered by existing tests

@camposandro camposandro self-assigned this Feb 12, 2024
Copy link
Collaborator

@drewoldag drewoldag left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks!

@camposandro camposandro marked this pull request as ready for review February 13, 2024 15:48
Copy link
Collaborator

@drewoldag drewoldag left a comment

Choose a reason for hiding this comment

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

Still looking good. Thanks for the extra work!

@camposandro camposandro merged commit 9d5ad05 into main Feb 13, 2024
13 checks passed
@camposandro camposandro deleted the issue/410/consolidate-pre-commit branch February 13, 2024 20:00
@@ -1,4 +1,3 @@
fail_fast: true
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we leave the fail_fast behavior in, for running locally, but take it out in the CI? Or could I enable it locally by default? I find it useful to not run the unit tests if I know I'm going to have to change something and just run everything all over again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately there seems to be no way of running pre-commit with a fail_fast flag. We could potentially create two separate pre-commit-config, one for the CI and another for the local runs. Might be overkill but we could remove all the hooks we're actually not using on the CI and make the configuration more clear to the users. What is your opinion on this? Tagging @drewoldag too.

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.

Consolidate and improve pre-commit logic
3 participants