Skip to content

Commit

Permalink
Format with ruff instead of black
Browse files Browse the repository at this point in the history
  • Loading branch information
blairconrad committed Nov 8, 2023
1 parent f543460 commit 7dc20fc
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 30 deletions.
22 changes: 14 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
{
"python.formatting.provider": "black",
"python.linting.enabled": true,
"python.linting.flake8Enabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.pytestArgs": [],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"cSpell.words": [
"Anonymizer",
"DICOGNITO",
Expand All @@ -19,5 +12,18 @@
"pydicom",
"randomizer",
"recursed"
]
],
"python.linting.enabled": true,
"python.linting.flake8Enabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.pytestArgs": [],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}
}
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ updated tests.

## Style

We use [Ruff](https://ruff.rs/) as a linter and [black](https://black.readthedocs.io/en/stable/)
as a formatter. Please follow existing conventions. Any deviations will cause the build to fail.
We use [Ruff](https://ruff.rs/) as linter and formatter.
Please follow existing conventions. Any deviations will cause the build to fail.

## Making Changes

Expand Down
26 changes: 10 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
[tool.black]
line-length = 120
target_version = ['py38', 'py39', 'py310', 'py311']
include = '\.pyi?$'
exclude = '''
(
/(
\.eggs # exclude a few common directories in the
| \.git # root of the project
| \.tox
| \.venv
| build
| dist
)/
)
'''
[tool.mypy]
show_error_codes=true
show_error_context=true
Expand Down Expand Up @@ -51,10 +35,20 @@ select = ["ALL"]

ignore = [
"ANN101", # choosing not to type-annotate self at this time.
"COM812", # may cause conflicts when used with the formatter.
"COM819", # may cause conflicts when used with the formatter.
"D203", # can either force a blank line before docstring or forbid.
"D206", # may cause conflicts when used with the formatter.
"D212", # can either force multi-line docstring to start on first or second line.
"E501", # may cause conflicts when used with the formatter.
"ISC001", # may cause conflicts when used with the formatter.
"PTH", # choosing not to swith to pathlib at this time.
"Q000", # may cause conflicts when used with the formatter.
"Q001", # may cause conflicts when used with the formatter.
"Q002", # may cause conflicts when used with the formatter.
"Q003", # may cause conflicts when used with the formatter.
"T201", # print calls are intentional.
"W191", # may cause conflicts when used with the formatter.
]

[tool.ruff.flake8-annotations]
Expand Down
3 changes: 3 additions & 0 deletions src/dicognito/release_notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### Additional Items
- Lint and format code using [Ruff](https://ruff.rs/) ([#153](https://github.com/blairconrad/dicognito/issues/153), [#156](https://github.com/blairconrad/dicognito/issues/156))

## 0.16.0

### Changed
Expand Down
7 changes: 3 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ envlist = py38,py39,py310,py311,py312
# install pytest in the virtualenv where commands will be executed
package = wheel
deps =
black
mypy
pydicom >= 2.3.1 # sync with setyp.py
pytest >= 7.0.1
ruff == 0.0.291
ruff == 0.1.2

commands =
# NOTE: you can run any command line tool here - not just tests
black --check --diff --quiet .
ruff .
ruff format --check .
ruff check .
mypy src tests
pytest {tty:--color=yes} {posargs}

0 comments on commit 7dc20fc

Please sign in to comment.