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

Enable style checks #293

Merged
merged 3 commits into from
Oct 2, 2024
Merged

Conversation

braingram
Copy link
Collaborator

@braingram braingram commented Oct 1, 2024

Style checks (via pre-commit) have not been checking any files in this repo as part of the CI.
See this recent run on main:
https://github.com/spacetelescope/stcal/actions/runs/11017955113/job/30597119856#step:10:63
With all checks showing:

check for added large files..........................(no files to check)Skipped

If I run them locally I see a large number of automatic changes:
36 files changed, 1091 insertions(+), 942 deletions(-)
and even after these see 79 ruff errors, many from codespell and 6 from reporeview.

In an effort to check something this PR:

  • fixes the check-style job to check files
  • disables all failing ruff and pre-commit rules (maybe we can re-enable these one-by-one in follow-up PRs)

With this PR the checks run:
https://github.com/spacetelescope/stcal/actions/runs/11130795981/job/30930929199?pr=293#step:10:49

Tasks

  • update or add relevant tests
  • update relevant docstrings and / or docs/ page
  • Does this PR change any API used downstream? (if not, label with no-changelog-entry-needed)
    • write news fragment(s) in changes/: echo "changed something" > changes/<PR#>.<changetype>.rst (see below for change types)
    • run regression tests with this branch installed ("git+https://github.com/<fork>/stcal@<branch>")
news fragment change types...
  • changes/<PR#>.apichange.rst: change to public API
  • changes/<PR#>.bugfix.rst: fixes an issue
  • changes/<PR#>.general.rst: infrastructure or miscellaneous change

@@ -30,7 +30,7 @@ deps =
pre-commit
commands =
pre-commit install-hooks
pre-commit run {posargs:--color always --all-files --show-diff-on-failure}
pre-commit run --color always --all-files --show-diff-on-failure {posargs}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since the CI runs this with a trailing -- tox was skipping the important --all-files and instead trying to run on only non-committed files of which there were none.

Copy link
Collaborator

Choose a reason for hiding this comment

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

sneaky!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could leave it there to always be green 😆

@braingram braingram marked this pull request as ready for review October 1, 2024 17:58
@braingram braingram requested a review from a team as a code owner October 1, 2024 17:58
@braingram braingram requested review from zacharyburnett and removed request for a team October 1, 2024 17:58
Copy link

codecov bot commented Oct 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.19%. Comparing base (8988d2c) to head (5f94030).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #293      +/-   ##
==========================================
+ Coverage   84.76%   85.19%   +0.43%     
==========================================
  Files          44       46       +2     
  Lines        8542     8804     +262     
==========================================
+ Hits         7241     7501     +260     
- Misses       1301     1303       +2     

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

@@ -12,8 +12,8 @@ repos:
- id: check-symlinks
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace
# - id: end-of-file-fixer
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are these removed? Don't we want these checks? And why comment them out, instead of deleting them?

Copy link
Collaborator Author

@braingram braingram Oct 2, 2024

Choose a reason for hiding this comment

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

Doh, I had clicked auto-merge so this got merged as soon as you approved it. I can follow this up with a PR to remove them if that's what you'd like.

I commented them out because these are all failing and likely have been for some time. The PR that enabled them had a bug in the workflow where it ran the checks but never supplied any files to check (so it was checking nothing). See #293 (comment) for a comment on where this bug is fixed. Here's a PR that uncomments all the checks to show the extent of the failures:
#294
The reported diff for the checks is over 5000 lines long:
https://github.com/spacetelescope/stcal/actions/runs/11142692931/job/30966194873?pr=294
(and doesn't fix all the failures as many require manual updates).

I chose to not remove them because I assumed that the maintainers want these checks to run. If that's not the case I'd say we remove them entirely. If re-enabling the checks is preferred I was thinking it would be easiest to enable them perhaps one-by-one since each will require file changes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure what's the best approach for this. It could be good to have them commented out, so we have explicit documentation for what is not used, but removing them to clean up the script could be good, too. I just wanted to make sure you wanted the comments left in the scripts.

hooks:
- id: sp-repo-review
additional_dependencies: ["repo-review[cli]"]
# - repo: https://github.com/pre-commit/mirrors-prettier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this commented out and not simply removed?

args: ["--write-changes"]
additional_dependencies:
- tomli
# - repo: https://github.com/codespell-project/codespell
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this commented out instead of just removed?

"W", "E", # pycodestyle (part of default flake8)
"I", # isort (import sorting)
select = [
#"F", # Pyflakes (part of default flake8)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are these commented out instead of just removed?

@braingram braingram merged commit 787aa81 into spacetelescope:main Oct 2, 2024
24 of 26 checks passed
@braingram braingram deleted the enable_style_checks branch October 2, 2024 11:01
braingram added a commit to braingram/stcal that referenced this pull request Oct 2, 2024
This reverts commit 787aa81, reversing
changes made to e4dbc44.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants