-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### What kind of change does this PR introduce? * Removed the configuration blocks in setup.cfg for `pydocstyle` and `pycodestyle`, and removed most of the checking performed by `flake8` (flake8 still needed for `flake8-alphabetize` and `flake8-rst`). * Updated `pyproject.toml` with Ruff-based equivalent linting configuration * Updated `tox.ini` and `Makefile` to use Ruff. Reordered order of linting calls to trigger more typical violations first. * Updated dependencies. ### Does this PR introduce a breaking change? Yes. Ruff is now a dev dependency, while `pycodestyle` and `pydocstyle` are no longer required. The checks that were being performed by those libraries are now redundant thanks to the new configuration. ### Other information: Ruff is a linter for Python (built with Rust) that is blazingly fast and has been in development for around 1.5 years. [Ruff v0.1.0 was released today](https://astral.sh/blog/ruff-v0.1.0).
- Loading branch information
Showing
47 changed files
with
251 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,13 +71,13 @@ dev = [ | |
"netCDF4 >=1.4", | ||
"platformdirs >=3.2", | ||
"pre-commit >=2.9", | ||
"pydocstyle >=5.1.1", | ||
"pybtex", | ||
"pylint", | ||
"pytest", | ||
"pytest-cov", | ||
"pytest-socket", | ||
"pytest-xdist[psutil] >=3.2", | ||
"ruff >=0.1.0", | ||
"tokenize-rt", | ||
"tox", | ||
# "tox-conda", # Will be added when a [email protected]+ compatible plugin is released. | ||
|
@@ -210,3 +210,68 @@ markers = [ | |
"requires_docs: mark tests that can only be run with documentation present (deselect with '-m \"not requires_docs\"')", | ||
"requires_internet: mark tests that require internet access (deselect with '-m \"not requires_internet\"')" | ||
] | ||
|
||
[tool.ruff] | ||
src = ["xclim"] | ||
line-length = 150 | ||
target-version = "py38" | ||
exclude = [ | ||
".git", | ||
"docs", | ||
"build", | ||
".eggs", | ||
"tests" | ||
] | ||
ignore = [ | ||
"D205", | ||
"D400", | ||
"D401" | ||
] | ||
select = [ | ||
"C9", | ||
"D", | ||
"E", | ||
"F", | ||
"W" | ||
] | ||
|
||
[tool.ruff.flake8-bandit] | ||
check-typed-exception = true | ||
|
||
[tool.ruff.flake8-import-conventions.aliases] | ||
"matplotlib.pyplot" = "plt" | ||
"xclim.indices" = "xci" | ||
numpy = "np" | ||
pandas = "pd" | ||
scipy = "sp" | ||
xarray = "xr" | ||
|
||
[tool.ruff.format] | ||
line-ending = "auto" | ||
|
||
[tool.ruff.isort] | ||
known-first-party = ["xclim"] | ||
case-sensitive = true | ||
detect-same-package = false | ||
lines-after-imports = 1 | ||
no-lines-before = ["future", "standard-library"] | ||
|
||
[tool.ruff.mccabe] | ||
max-complexity = 15 | ||
|
||
[tool.ruff.per-file-ignores] | ||
"docs/*.py" = ["D100", "D101", "D102", "D103"] | ||
"tests/*.py" = ["D100", "D101", "D102", "D103"] | ||
"xclim/**/__init__.py" = ["F401", "F403"] | ||
"xclim/core/indicator.py" = ["D214", "D405", "D406", "D407", "D411"] | ||
"xclim/core/locales.py" = ["E501", "W505"] | ||
"xclim/core/missing" = ["D103"] | ||
"xclim/indices/_agro.py" = ["E501"] | ||
"xclim/indices/fire/_cffwis.py" = ["D103"] | ||
"xclim/sdba/utils.py" = ["D103"] | ||
|
||
[tool.ruff.pycodestyle] | ||
max-doc-length = 180 | ||
|
||
[tool.ruff.pydocstyle] | ||
convention = "numpy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.