Skip to content

Commit

Permalink
Merge pull request #1120 from afuetterer/ruff
Browse files Browse the repository at this point in the history
chore: modernize ruff config to work with ruff >= v0.2
  • Loading branch information
vitalik authored Apr 30, 2024
2 parents c1464aa + 74de6c8 commit 5b4c006
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ jobs:
- name: Ruff format
run: ruff format --check ninja tests
- name: Ruff lint
run: ruff ninja tests
run: ruff check ninja tests
- name: mypy
run: mypy ninja tests/mypy_test.py
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Alternatively, manually check your code with:

```
ruff format --check ninja tests
ruff ninja tests
ruff check ninja tests
mypy ninja
```

Expand All @@ -67,7 +67,7 @@ Or reformat your code with:

```
ruff format ninja tests
ruff ninja tests --fix
ruff check ninja tests --fix
```

or using Makefile:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ install: ## Install dependencies
.PHONY: lint
lint: ## Run code linters
ruff format --preview --check ninja tests
ruff --preview ninja tests
ruff check --preview ninja tests
mypy ninja

.PHONY: fmt format
fmt format: ## Run code formatters
ruff format --preview ninja tests
ruff --preview --fix ninja tests
ruff check --preview --fix ninja tests

.PHONY: test
test: ## Run tests
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ dev = ["pre-commit"]

[tool.ruff]
target-version = "py37"

[tool.ruff.lint]
select = [
"B", # flake8-bugbear
"C", # flake8-comprehensions
Expand All @@ -85,7 +87,7 @@ ignore = [
"C901", # too complex
]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"ninja/compatibility/datastructures.py" = ["C416"]
"ninja/utils.py" = ["B004"]
"tests/*" = ["C408"]
Expand Down

0 comments on commit 5b4c006

Please sign in to comment.