From 6506fe75f5f006d40f63bcfebf2518371547d5c3 Mon Sep 17 00:00:00 2001 From: George Song Date: Sat, 28 Sep 2024 18:16:28 -0700 Subject: [PATCH] style: format toml fix: update toml section headings according to ruff build: update ruff version build: update pre-commit setup fix: update ruff command --- .pre-commit-config.yaml | 10 +++------ Makefile | 2 +- pyproject.toml | 48 ++++++++++++++++++++++------------------- setup.py | 2 +- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 07ccdcf..8476471 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ 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 @@ -12,15 +12,11 @@ repos: - 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 diff --git a/Makefile b/Makefile index 536b2fb..6a54f62 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/pyproject.toml b/pyproject.toml index b4cc0f7..c56708a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" @@ -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 @@ -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 ] diff --git a/setup.py b/setup.py index 7957a3b..5851f7e 100644 --- a/setup.py +++ b/setup.py @@ -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", ],