diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 681c4b8..f785673 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -91,7 +91,7 @@ jobs: run: | python3 -m pip install --upgrade pip setuptools python3 -m pip install .[dev,publishing] - - name: Check style against standards using prospector - run: prospector + - name: Check style against standards using ruff + run: ruff . - name: Check import order run: isort --check-only distance_explainer --diff diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 97995f1..4f20a4a 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -29,8 +29,6 @@ jobs: python3 --version - name: Install dependencies run: python3 -m pip install .[dev] - - name: Check style against standards using prospector - run: prospector --zero-exit --output-format grouped --output-format pylint:pylint-report.txt - name: Run unit tests with coverage run: pytest --cov --cov-report term --cov-report xml --junitxml=xunit-result.xml tests/ - name: Correct coverage paths diff --git a/.prospector.yml b/.prospector.yml deleted file mode 100644 index a500048..0000000 --- a/.prospector.yml +++ /dev/null @@ -1,29 +0,0 @@ -# prospector configuration file - ---- - -output-format: grouped - -strictness: medium -doc-warnings: false -test-warnings: true -member-warnings: false - -ignore-paths: - - docs - -pyroma: - run: true - -pycodestyle: - full: true - -pydocstyle: - disable: [ - # Disable because not part of PEP257 official convention: - # see http://pep257.readthedocs.io/en/latest/error_codes.html - D203, # 1 blank line required before class docstring - D212, # Multi-line docstring summary should start at the first line - D213, # Multi-line docstring summary should start at the second line - D404, # First word of the docstring should not be This - ] diff --git a/README.dev.md b/README.dev.md index 64f6c38..7327932 100644 --- a/README.dev.md +++ b/README.dev.md @@ -62,13 +62,13 @@ coverage report ## Running linters locally -For linting we will use [prospector](https://pypi.org/project/prospector/) and to sort imports we will use +For linting we will use ruff and to sort imports we will use [isort](https://pycqa.github.io/isort/). Running the linters requires an activated virtual environment with the development tools installed. ```shell # linter -prospector +ruff . # recursively check import style for the distance_explainer module only isort --check-only distance_explainer diff --git a/pyproject.toml b/pyproject.toml index 9f5a7c3..c1be512 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,3 +19,77 @@ skip_missing_interpreters = true commands = pytest extras = dev """ + +[tool.ruff] +# Enable Pyflakes `E` and `F` codes by default. +select = [ + "F", # Pyflakes + "E", # pycodestyle (error) + "W", # pycodestyle (warning) + # "C90", # mccabe + "I", # isort + "D", # pydocstyle + # "PL", # Pylint + # "PLC", # Convention + # "PLE", # Error + # "PLR", # Refactor + # "PLW", # Warning + +] +ignore = [ + 'D100', # Missing module docstring + # The following list excludes rules irrelevant to the Google style + 'D203', + 'D204', + 'D213', + 'D215', + 'D400', + 'D401', + 'D404', + 'D406', + 'D407', + 'D408', + 'D409', + 'D413', +] + +# Allow autofix for all enabled rules (when `--fix`) is provided. +fixable = ["A", "B", "C", "D", "E", "F", "I"] +unfixable = [] + +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".hg", + ".mypy_cache", + ".nox", + ".pants.d", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "venv", + ".venv", + "scripts", +] +per-file-ignores = {} + + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +target-version = "py39" +line-length = 120 + +[tool.ruff.isort] +known-first-party = ["distance_explainer"] +force-single-line = true +no-lines-before = ["future","standard-library","third-party","first-party","local-folder"] diff --git a/setup.cfg b/setup.cfg index ef8caaf..0e4b483 100644 --- a/setup.cfg +++ b/setup.cfg @@ -53,7 +53,7 @@ install_requires = dev = bump2version coverage [toml] - prospector[with_pyroma] + ruff isort pytest pytest-cov