Skip to content

Commit

Permalink
Switch to formatting with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
tmke8 committed Feb 23, 2024
1 parent cc5cce9 commit 69b4260
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 109 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install black
- name: Install ruff
run: |
pip install black
- name: Format with black
pip install ruff
- name: Format with ruff
run: |
python -m black --check src
ruff format --diff .
lint_with_ruff:

Expand All @@ -39,4 +39,4 @@ jobs:
pip install ruff
- name: Lint with ruff
run: |
ruff check --output-format=github src
ruff check --output-format=github .
120 changes: 25 additions & 95 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ torch = "^2.0.1"
torchvision = ">=0.15.2"

[tool.poetry.group.dev.dependencies]
black = "*"
ruff = "*"
mypy = "*"
pytest = "*"
Expand All @@ -64,13 +63,12 @@ pandas-stubs = "*"
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.black]
line-length = 100
target-version = ['py310']

[tool.ruff]
target-version = "py310"
line-length = 100
extend-exclude = ["hydra_plugins"]

[tool.ruff.lint]
select = ["I", "F", "E", "W", "UP"]
ignore = [
"F541", # f-string without placeholder
Expand All @@ -81,9 +79,8 @@ ignore = [
"UP038", # isinstance check with unions
]

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-third-party = [
"black",
"click",
"click_option_group",
"ethicml",
Expand All @@ -108,11 +105,14 @@ force-sort-within-sections = true
split-on-trailing-comma = false
classes = ["MISSING", "LAFTR", "NICOPP"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = [
"F403", # star import
]
"analysis/*" = ["E402"] # import at top of file
"analysis/*" = [
"E402", # import at top of file
"F401", # unused import
]

[tool.pyright]
pythonVersion = "3.10"
Expand Down

0 comments on commit 69b4260

Please sign in to comment.