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: Use Ruff lint config #2381

Merged
merged 1 commit into from
Nov 17, 2023
Merged

Conversation

matthewfeickert
Copy link
Member

Description

Use the Ruff lint config option as recommended in the Scientific Python Development Guide.

  • RF202: Use (new) lint config section.

Thanks for adding this to repo-review, @henryiii!

$ pipx run 'sp-repo-review[cli]' . | tail -n 10
├── RF103 pyupgrade must be selected ✅
├── RF201 Avoid using deprecated config settings ✅
└── RF202 Use (new) lint config section ✅

Documentation:
├── RTD100 Uses ReadTheDocs (pyproject config) ✅
├── RTD101 You have to set the RTD version number to 2 ✅
├── RTD102 You have to set the RTD build image ✅
└── RTD103 You have to set the RTD python version ✅

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
* Use the Ruff lint config option as recommended in the Scientific
  Python Development Guide.
   - RF202: Use (new) lint config section.
   - c.f. https://learn.scientific-python.org/development/guides/style/#ruff

* Use the Ruff lint config option as recommended in the Scientific
  Python Development Guide.
   - RF202: Use (new) lint config section.
   - c.f. https://learn.scientific-python.org/development/guides/style/#ruff
@matthewfeickert matthewfeickert added chore Other changes that don't modify src or test files need-to-backport tmp label until can be backported to patch release branch labels Nov 17, 2023
@matthewfeickert matthewfeickert self-assigned this Nov 17, 2023
Copy link

codecov bot commented Nov 17, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ba5543b) 98.28% compared to head (09ded95) 98.28%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2381   +/-   ##
=======================================
  Coverage   98.28%   98.28%           
=======================================
  Files          69       69           
  Lines        4539     4539           
  Branches      803      803           
=======================================
  Hits         4461     4461           
  Misses         45       45           
  Partials       33       33           
Flag Coverage Δ
contrib 97.86% <ø> (ø)
doctest 60.71% <ø> (ø)
unittests-3.10 96.29% <ø> (ø)
unittests-3.11 96.29% <ø> (ø)
unittests-3.8 96.32% <ø> (ø)
unittests-3.9 96.34% <ø> (ø)

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

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

@matthewfeickert matthewfeickert merged commit f04796f into main Nov 17, 2023
20 checks passed
@matthewfeickert matthewfeickert deleted the chore/use-ruff-lint-config branch November 17, 2023 14:35
@henryiii
Copy link
Member

FYI, you can paste the HTML version into issues. :)

pipx run sp-repo-review[cli] gh:scikit-hep/pyhf@main --format html

General

  • Detected build backend: hatchling.build
  • Detected license(s): Apache Software License
?NameDescription
PY001 Has a pyproject.toml
PY002 Has a README.(md|rst) file
PY003 Has a LICENSE* file
PY004 Has docs folder
PY005 Has tests folder
PY006 Has pre-commit config
PY007 Supports an easy task runner (nox or tox)

PyProject

?NameDescription
PP002 Has a proper build-system table
PP003 Does not list wheel as a build-dep
PP301 Has pytest in pyproject
PP302 Sets a minimum pytest to at least 6
PP303 Sets the test paths
PP304 Sets the log level in pytest
PP305 Specifies xfail_strict
PP306 Specifies strict config
PP307 Specifies strict markers
PP308 Specifies useful pytest summary
PP309 Filter warnings specified

GitHub Actions

?NameDescription
GH100 Has GitHub Actions config
GH101 Has nice names
GH102 Auto-cancel on repeated PRs
GH103 At least one workflow with manual dispatch trigger
GH200 Maintained by Dependabot
GH210 Maintains the GitHub action versions with Dependabot
GH211 Do not pin core actions as major versions

Pre-commit

?NameDescription
PC100 Has pre-commit-hooks
PC110 Uses black or ruff-format
PC111 Uses blacken-docs
PC140 Uses mypy
PC160 Uses codespell
PC170 Uses PyGrep hooks (only needed if RST present)

Must have https://github.com/pre-commit/pygrep-hooks repo in .pre-commit-config.yaml

PC180 Uses prettier

Must have https://github.com/pre-commit/mirrors-prettier repo in .pre-commit-config.yaml

PC190 Uses Ruff
PC191 Ruff show fixes if fixes enabled
PC901 Custom pre-commit CI message

MyPy

?NameDescription
MY100 Uses MyPy (pyproject config)
MY101 MyPy strict mode
MY102 MyPy show_error_codes deprecated

Must not have show_error_codes. Use hide_error_codes instead (since MyPy v0.990).

MY103 MyPy warn unreachable
MY104 MyPy enables ignore-without-code
MY105 MyPy enables redundant-expr
MY106 MyPy enables truthy-bool

Ruff

?NameDescription
RF001 Has Ruff config
RF002 Target version must be set
RF003 src directory specified if used
RF101 Bugbear must be selected

Must select the flake8-bugbear B checks. Recommended:

[tool.ruff.lint]
extend-select = [
  "B",  # flake8-bugbear
]
RF102 isort must be selected

Must select the isort I checks. Recommended:

[tool.ruff.lint]
extend-select = [
  "I",  # isort
]
RF103 pyupgrade must be selected
RF201 Avoid using deprecated config settings
RF202 Use (new) lint config section

Documentation

?NameDescription
RTD100 Uses ReadTheDocs (pyproject config)
RTD101 You have to set the RTD version number to 2
RTD102 You have to set the RTD build image
RTD103 You have to set the RTD python version

@matthewfeickert matthewfeickert added the pre-commit Related to pre-commit hooks label Nov 17, 2023
matthewfeickert added a commit that referenced this pull request Jan 5, 2024
* Use the Ruff lint config option as recommended in the Scientific
  Python Development Guide.
   - RF202: Use (new) lint config section.
   - c.f. https://learn.scientific-python.org/development/guides/style/#ruff
@matthewfeickert matthewfeickert removed the need-to-backport tmp label until can be backported to patch release branch label Jan 5, 2024
matthewfeickert added a commit that referenced this pull request Jan 5, 2024
* Backport:
   - PR #2378
   - PR #2380
   - PR #2381
   - PR #2382
   - PR #2383
   - PR #2386
   - PR #2412
   - PR #2414
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 pre-commit Related to pre-commit hooks
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

2 participants