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

chore: Move to using Ruff for pre-commit #2124

Merged
merged 4 commits into from
Mar 14, 2023

Conversation

henryiii
Copy link
Member

@henryiii henryiii commented Feb 28, 2023

Description

This moves the flake8 & pyupgrade checks into a single Ruff check, and moves the config to pyproject.toml. There are a lot of checks that could be added (see https://scikit-hep.org/developer/style#ruff), I've just stuck to replicating the current config. The one loss is flake8-encodings, someone could request this added to Ruff.

I've skipped the failing checks for notebooks, might be worth checking to see if they are valid.

Checklist Before Requesting Reviewer

  • Tests are passing
  • "WIP" removed from the title of the pull request
  • Selected an Assignee for the PR to be responsible for the log summary

Before Merging

For the PR Assignees:

  • Summarize commit messages into a comprehensive review of the PR
* Drop flake8, yesqa, pyupgrade, and nbqa-pyupgrade pre-commit hooks in favor of Ruff.
   - Remove .flake8 config file as no longer used.
   - Remove nbqa config options for pyupgrade in pyproject.toml and add ruff config options.

@codecov
Copy link

codecov bot commented Feb 28, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (49c116e) 98.30% compared to head (1d2d271) 98.30%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2124   +/-   ##
=======================================
  Coverage   98.30%   98.30%           
=======================================
  Files          69       69           
  Lines        4531     4531           
  Branches      645      645           
=======================================
  Hits         4454     4454           
  Misses         45       45           
  Partials       32       32           
Flag Coverage Δ
contrib 97.88% <100.00%> (ø)
doctest 61.15% <0.00%> (ø)
unittests-3.10 96.31% <100.00%> (ø)
unittests-3.8 96.33% <100.00%> (ø)
unittests-3.9 96.35% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/pyhf/cli/spec.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@henryiii
Copy link
Member Author

I've opened an issue about flake8-encodings in astral-sh/ruff#3278.

@matthewfeickert
Copy link
Member

Thanks for this PR @henryiii and sorry that I'm so slow in getting to it.

I've skipped the failing checks for notebooks, might be worth checking to see if they are valid.

Which checks are these? It looks like everything is passing. Or am I missing something that you are now skipping in the PR?

@matthewfeickert matthewfeickert added CI CI systems, GitHub Actions chore Other changes that don't modify src or test files labels Mar 13, 2023
.pre-commit-config.yaml Outdated Show resolved Hide resolved
henryiii and others added 4 commits March 13, 2023 21:58
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
@matthewfeickert matthewfeickert changed the title chore: move to using Ruff chore: Move to using Ruff Mar 14, 2023
Comment on lines -225 to -226
[tool.nbqa.mutate]
pyupgrade = 1
Copy link
Member

Choose a reason for hiding this comment

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

A note to self, the reason this is safe to remove is that the option was deprecated in v1.0.0. c.f. https://github.com/nbQA-dev/nbQA/blob/26f3ce04cd29bdfcda487fefdbae78925e80a5ff/nbqa/cmdline.py#L37

@matthewfeickert matthewfeickert changed the title chore: Move to using Ruff chore: Move to using Ruff for pre-commit Mar 14, 2023
@matthewfeickert matthewfeickert merged commit 8393ccd into scikit-hep:main Mar 14, 2023
matthewfeickert added a commit that referenced this pull request Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Other changes that don't modify src or test files CI CI systems, GitHub Actions
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants