Skip to content

Commit

Permalink
style: format toml
Browse files Browse the repository at this point in the history
fix: update toml section headings according to ruff

build: update ruff version

build: update pre-commit setup

fix: update ruff command
  • Loading branch information
gsong committed Sep 29, 2024
1 parent b20c0b3 commit 6506fe7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
10 changes: 3 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,19 @@ repos:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: detect-private-key
- id: mixed-line-ending
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.0.285
rev: v0.6.8
hooks:
# Run the linter.
- id: ruff
- repo: https://github.com/python/black
rev: 21.9b0
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.4.1
hooks:
- id: prettier
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ check: lint test ## Run linter and software tests
check-ci: lint test-ci ## Run linter and software tests on CI

lint: ## lint the project
ruff .
ruff check .
black --check .

format: ## Run code formatting
Expand Down
48 changes: 26 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

[build-system]
requires = [
"setuptools>=42", # At least v42 of setuptools required!
"versioningit",
"setuptools>=42", # At least v42 of setuptools required!
"versioningit",
]
build-backend = "setuptools.build_meta"

Expand All @@ -19,13 +19,12 @@ log_level = "DEBUG"
log_cli_level = "DEBUG"
testpaths = ["tests"]
xfail_strict = true
markers = [
]
markers = []

[tool.ruff]
line-length = 80

select = [
lint.select = [
# Bandit
"S",
# Bugbear
Expand All @@ -52,51 +51,56 @@ select = [
# return
"RET",
# from `.flake8` file
"T", # T4
"T", # T4
"B9",
]

extend-exclude = [
"__init__.py",
]
extend-exclude = ["__init__.py"]

ignore = [
lint.ignore = [
"E203",
"E266",
"E501",
"ERA001", # Found commented-out code
"RET505", # Unnecessary `else` after `return` statement
"ERA001", # Found commented-out code
"RET505", # Unnecessary `else` after `return` statement
# "W503", # Unknown rule selector
]

# from `.isort.cfg` file
[tool.ruff.isort]
[tool.ruff.lint.isort]
combine-as-imports = true
force-wrap-aliases = true
known-third-party = ["dateutil", "dogpile", "dotenv", "pytest", "requests", "six"]
known-third-party = [
"dateutil",
"dogpile",
"dotenv",
"pytest",
"requests",
"six",
]
split-on-trailing-comma = false

# from `.flake8` file
[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
# Flag errors (`C901`) whenever the complexity level exceeds the configured value.
max-complexity = 7


[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"S101", # Use of `assert` detected
"S101", # Use of `assert` detected
]
"epo_ops/api.py" = [
"A001", # Variable `range` is shadowing a Python builtin
"A002", # Argument `input` is shadowing a Python builtin
"C408", # Unnecessary `dict` call (rewrite as a literal)
"A001", # Variable `range` is shadowing a Python builtin
"A002", # Argument `input` is shadowing a Python builtin
"C408", # Unnecessary `dict` call (rewrite as a literal)
]
# FIXME: Improve this situation wrt. SQL injection, even it is not be an actual attack vector.
"*sqlite.py" = [
"S608", # Possible SQL injection vector through string-based query construction
"S608", # Possible SQL injection vector through string-based query construction
]
"tests/middlewares/throttle/conftest.py" = [
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
]


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
extras_require={
"develop": [
"black<25",
"ruff<0.5; python_version >= '3.7'",
"ruff<0.7; python_version >= '3.7'",
"twine<6",
"wheel<1",
],
Expand Down

0 comments on commit 6506fe7

Please sign in to comment.