Skip to content

Commit

Permalink
feat: Replace black, flake8, isort & pydocstyle with Ruff (#47)
Browse files Browse the repository at this point in the history
# Description

* Replaces black, flake8, pydocstyle & isort with Ruff
* Adds `.pre-commit-config.yaml` file
* Fix some linting issues highlighted by Ruff in default setting, while
disabling a 5 rules. The following rules are disabled:
    - ANN001
    - ANN401
    - S608
    - SLF001
    - EM101
    
`ANN001` * `ANN401` are disabled because the codebase has a few
instances where params / return values don't specify type or return
`Any`.

`S608` flags string based queries. It will require a deeper refactor to
leverage sqlalchemy exclusively.

`SFL001` flags accesses to private members. This is done to patch
`_confirm_primitive_property`.

`EM101` flags strings passed to Exceptions, which I felt was safe to do.

closes: #43

---------

Co-authored-by: Edgar Ramírez Mondragón <[email protected]>
  • Loading branch information
haleemur and edgarrmondragon authored Sep 23, 2024
1 parent c519d8e commit 38c8cc5
Show file tree
Hide file tree
Showing 7 changed files with 163 additions and 224 deletions.
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-json
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.7
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
hooks:
- id: mypy
166 changes: 28 additions & 138 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 29 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,45 @@ sqlalchemy = "~=2.0.34"
cryptography = ">=3.4.6,<42.0.0"

[tool.poetry.group.dev.dependencies]
black = "^22.3.0"
flake8 = "^3.9.2"
isort = "^5.10.1"
mypy = "^0.991"
pydocstyle = "^6.1.1"
singer-sdk = {extras = ["testing"], version = "*"}
tox = "^3.24.4"
types-requests = "^2.26.1"
ruff = "^0.6.7"

[tool.isort]
profile = "black"
multi_line_output = 3 # Vertical Hanging Indent
src_paths = "tap_snowflake"

[tool.ruff]
line-length = 88
src = ["target_snowflake"]
target-version = "py38"

[tool.ruff.lint]
ignore = [
"ANN001",
"ANN401",
"S608",
"SLF001",
"EM101",
]
select = ["ALL"]

[tool.ruff.format]
quote-style = "double"
exclude = ["*.pyi"]

[tool.ruff.lint.isort]
known-first-party = ["target_snowflake"]

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.mccabe]
max-complexity = 10

[build-system]
requires = ["poetry-core>=1.0.8", "poetry-dynamic-versioning"]
build-backend = "poetry_dynamic_versioning.backend"
Expand Down
Loading

0 comments on commit 38c8cc5

Please sign in to comment.