Skip to content

Commit

Permalink
Switch to Ruff for linting (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek authored Nov 20, 2022
1 parent b0911bb commit 8cb2922
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 18 deletions.
11 changes: 0 additions & 11 deletions .flake8

This file was deleted.

7 changes: 2 additions & 5 deletions hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,15 @@ detached = true
dependencies = [
"bandit>=1.7.4",
"black>=22.6.0",
"flake8>=5.0.0",
"flake8-bugbear>=22.10.25",
"flake8-quotes>=3.3.1",
"flake8-tidy-imports>=4.8.0",
"isort>=5.10.1",
"mypy>=0.990",
"ruff>=0.0.125",
]
[envs.lint.scripts]
typing = "mypy --install-types --non-interactive {args:backend/src/hatchling src/hatch tests}"
security = "bandit --quiet --recursive --skip B101,B102,B105,B110,B112,B301,B307,B324,B403,B404,B603,B604,B606,B607 {args:.}"
style = [
"flake8 {args:.}",
"ruff {args:.}",
"black --check --diff {args:.}",
"isort --check-only --diff {args:.}",
]
Expand Down
33 changes: 32 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,38 @@ exclude = [
"/scripts",
]

[tool.hatch.build.targets.wheel]
[tool.ruff]
line-length = 120
select = [
"B",
"C",
"E",
"F",
"W",
"B003",
"B006",
"B007",
"Q000",
"Q001",
"Q002",
"Q003",
"I252",
]
ignore = [
"B027",
"C901",
]

[tool.ruff.flake8-quotes]
inline-quotes = "single"

[tool.ruff.flake8-tidy-imports]
ban-relative-imports = "all"

[tool.ruff.per-file-ignores]
# tests can use relative imports
"tests/*" = ["I252"]
"tests/**/*" = ["I252"]

[tool.mypy]
disallow_untyped_defs = false
Expand Down
2 changes: 1 addition & 1 deletion src/hatch/cli/env/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def show(app, envs, force_ascii, as_json):

if config.get('features'):
if app.project.metadata.hatch.metadata.allow_ambiguous_features:
matrix_columns['Features'][i] = '\n'.join(sorted({f for f in config['features']}))
matrix_columns['Features'][i] = '\n'.join(sorted(set(config['features'])))
else:
matrix_columns['Features'][i] = '\n'.join(
sorted({normalize_project_name(f) for f in config['features']})
Expand Down

0 comments on commit 8cb2922

Please sign in to comment.