Skip to content

Commit 8d214e9

Browse files
blink1073lwasser
authored andcommitted
Adopt ruff
1 parent ef4f47f commit 8d214e9

File tree

5 files changed

+20
-40
lines changed

5 files changed

+20
-40
lines changed

.flake8

Lines changed: 0 additions & 9 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,16 @@ repos:
3737
additional_dependencies:
3838
- tomli
3939

40-
# Linting hook for Python code (see the file .flake8)
41-
- repo: https://github.com/PyCQA/flake8
42-
rev: "7.0.0"
40+
# Linting and formatting for Python code (see pyproject.toml for config)
41+
- repo: https://github.com/astral-sh/ruff-pre-commit
42+
# Ruff version.
43+
rev: v0.4.10
4344
hooks:
44-
- id: flake8
45-
46-
# Code formatting hook
47-
- repo: https://github.com/psf/black
48-
rev: 24.4.2
49-
hooks:
50-
- id: black
51-
52-
# Best practice style for module imports
53-
- repo: https://github.com/PyCQA/isort
54-
rev: 5.13.2
55-
hooks:
56-
- id: isort
57-
files: \.py$
58-
args: ["--profile", "black", --line-length=79]
45+
# Run the linter.
46+
- id: ruff
47+
args: [ --fix ]
48+
# Run the formatter.
49+
- id: ruff-format
5950

6051
# Ensure GitHub workflows match the expected schema.
6152
- repo: https://github.com/sirosen/check-jsonschema

pyproject.toml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,17 @@ run-report = "run-coverage --cov-report=xml:coverage.xml"
7979

8080
### Tool configuration ###
8181

82-
[tool.black]
82+
[tool.ruff]
8383
line-length = 79
84-
target-version = ['py310']
8584

86-
[tool.isort]
87-
profile = "black"
88-
multi_line_output = 3
89-
py_version = 27
85+
[tool.ruff.lint]
86+
ignore = ["E501"]
87+
select = [
88+
"C9",
89+
"E",
90+
"F",
91+
"W",
92+
]
9093

91-
# Precommit ignores this config so i added a .flake8 file
92-
# but why did it ignore it?
93-
[tool.flake8]
94-
extend-ignore = ["E203", "W503"]
94+
[tool.ruff.lint.mccabe]
95+
max-complexity = 18

src/pyosmeta/cli/process_reviews.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626

2727
def main():
28-
2928
github_api = GitHubAPI(
3029
org="pyopensci",
3130
repo="software-submission",
@@ -52,7 +51,6 @@ def main():
5251
# First add gh meta to each dict
5352
print("Parsing & validating", key)
5453
try:
55-
5654
final_reviews[key] = ReviewModel(**review)
5755
except ValidationError as ve:
5856
print(key, ":", ve)

tests/unit/test_parse_categories.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def test_get_categories(
5555
expected_categories: list[str | None],
5656
process_issues,
5757
):
58-
5958
# Call the get_categories method
6059
categories = process_issues.get_categories(issue_list, "## Scope", 3)
6160

0 commit comments

Comments
 (0)