diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 79a00cdbe..a3339b08b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,7 +43,7 @@ repos: - id: check-readthedocs - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.1 + rev: v0.1.3 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix, --show-fixes] @@ -51,17 +51,11 @@ repos: (?x)^( cookiecutter/.* )$ - -- repo: https://github.com/psf/black - rev: 23.10.1 - hooks: - - id: black + - id: ruff-format exclude: | - (?x)^( - cookiecutter/.*| - singer_sdk/helpers/_simpleeval.py| - tests/core/test_simpleeval.py - )$ + (?x)^( + cookiecutter/.* + )$ - repo: https://github.com/pycqa/flake8 rev: 6.1.0 diff --git a/pyproject.toml b/pyproject.toml index 60ea27e19..9535eb7f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -211,6 +211,11 @@ build-backend = "poetry.core.masonry.api" pytest11 = { reference = "singer_sdk:testing.pytest_plugin", extras = ["testing"], type = "console" } [tool.ruff] +line-length = 88 +src = ["samples", "singer_sdk", "tests"] +target-version = "py37" + +[tool.ruff.lint] exclude = [ "cookiecutter/*", "singer_sdk/helpers/_simpleeval.py", @@ -220,8 +225,9 @@ ignore = [ "ANN101", # Missing type annotation for `self` in method "ANN102", # Missing type annotation for `cls` in class method "N818", # Exception name should be named with an Error suffix + "COM812", # missing-trailing-comma + "ISC001", # single-line-implicit-string-concatenation ] -line-length = 88 select = [ "F", # Pyflakes "E", # pycodestyle (error) @@ -269,13 +275,11 @@ select = [ "PERF", # perflint "RUF", # ruff ] -src = ["samples", "singer_sdk", "tests"] -target-version = "py37" unfixable = [ "ERA", # Don't remove commented out code ] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "docs/conf.py" = [ "D", # pydocstyle/flake8-docstrings "I002", # isort: missing-required-import @@ -291,32 +295,32 @@ unfixable = [ "singer_sdk/testing/*.py" = ["S101"] "singer_sdk/testing/templates.py" = ["ANN401"] -[tool.ruff.flake8-annotations] +[tool.ruff.lint.flake8-annotations] allow-star-arg-any = true mypy-init-return = true suppress-dummy-args = true -[tool.ruff.flake8-import-conventions] +[tool.ruff.lint.flake8-import-conventions] banned-from = ["typing"] -[tool.ruff.flake8-import-conventions.extend-aliases] +[tool.ruff.lint.flake8-import-conventions.extend-aliases] typing = "t" -[tool.ruff.flake8-pytest-style] +[tool.ruff.lint.flake8-pytest-style] fixture-parentheses = false parametrize-names-type = "csv" -[tool.ruff.isort] +[tool.ruff.lint.isort] known-first-party = ["singer_sdk", "samples", "tests"] required-imports = ["from __future__ import annotations"] -[tool.ruff.pep8-naming] +[tool.ruff.lint.pep8-naming] classmethod-decorators = [ "singer_sdk.cli.plugin_cli", ] -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] convention = "google" -[tool.ruff.pylint] +[tool.ruff.lint.pylint] max-args = 9 diff --git a/samples/sample_tap_hostile/hostile_streams.py b/samples/sample_tap_hostile/hostile_streams.py index e711b769f..0da506242 100644 --- a/samples/sample_tap_hostile/hostile_streams.py +++ b/samples/sample_tap_hostile/hostile_streams.py @@ -28,9 +28,7 @@ class HostilePropertyNamesStream(Stream): @staticmethod def get_random_lowercase_string(): - return "".join( - random.choice(string.ascii_lowercase) for _ in range(10) # noqa: S311 - ) + return "".join(random.choice(string.ascii_lowercase) for _ in range(10)) # noqa: S311 def get_records( self,