Skip to content

Commit

Permalink
switch from prospector to ruff
Browse files Browse the repository at this point in the history
because it's way quicker mainly and can fix as well as complain
  • Loading branch information
cwmeijer committed Aug 9, 2023
1 parent 3bde91b commit 3edcdd2
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 0 additions & 2 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 0 additions & 29 deletions .prospector.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
74 changes: 74 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ install_requires =
dev =
bump2version
coverage [toml]
prospector[with_pyroma]
ruff
isort
pytest
pytest-cov
Expand Down

0 comments on commit 3edcdd2

Please sign in to comment.