Skip to content

Commit

Permalink
chore: use ruff-format & modernize config (#164)
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored Nov 16, 2023
1 parent 5a20e8f commit 08b7473
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 24 deletions.
8 changes: 2 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@ repos:
- id: check-symlinks
- id: check-yaml

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.11.0
hooks:
- id: black-jupyter

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.5"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.0
Expand All @@ -51,7 +47,7 @@ repos:
hooks:
- id: blacken-docs
args: ["-E"]
additional_dependencies: [black==22.8.0]
additional_dependencies: [black~=23.11]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
Expand Down
5 changes: 1 addition & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

|Scikit-HEP| |PyPI version| |Conda-forge version| |Zenodo DOI|

|GitHub Actions Status: CI| |Code Coverage| |Code style: black|
|GitHub Actions Status: CI| |Code Coverage|


``hepunits`` collects the most commonly used units and constants in the
Expand Down Expand Up @@ -155,6 +155,3 @@ to ensure an explicit conversion to the desired unit dividing by it (GeV in the

.. |Code Coverage| image:: https://codecov.io/gh/scikit-hep/hepunits/graph/badge.svg?branch=master
:target: https://codecov.io/gh/scikit-hep/hepunits?branch=master

.. |Code style: black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
27 changes: 13 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,16 @@ warn_unused_configs = true
python_version = "3.7"
files = ["src"]
strict = true
show_error_codes = true
warn_unreachable = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]


[tool.ruff]
select = [
"E", "F", "W", # flake8
"B", "B904", # flake8-bugbear
src = ["src"]

[tool.ruff.lint]
extend-select = [
"B", # flake8-bugbear
"I", # isort
"ARG", # flake8-unused-arguments
"C4", # flake8-comprehensions
Expand All @@ -114,21 +116,18 @@ select = [
"UP", # pyupgrade
"YTT", # flake8-2020
]
ignore = [
"PT013", # Okay to import approx from pytest
"PLR", # Design related pylint codes
]
src = ["src"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"T20",
"F405",
"F403",
"F405",
"PLR2004", # Magic value in comparisons
"PT013", # Okay to import approx from pytest
"T20",
]

[tool.repo-review]
ignore = [
"RTD", # ReadTheDocs
"PY0004", # Has docs folder
"RTD", # ReadTheDocs
"PY004", # Has docs folder
]

0 comments on commit 08b7473

Please sign in to comment.