Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use Ruff's formatter #150

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-json
exclude: "\\.vscode/.*.json"
Expand All @@ -16,24 +16,21 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/tox-dev/pyproject-fmt
rev: "1.2.0"
rev: "1.3.0"
hooks:
- id: pyproject-fmt

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
rev: v0.1.3
hooks:
- id: ruff
name: Ruff lint
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
name: Ruff format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
rev: v1.6.1
hooks:
- id: mypy
pass_filenames: true
Expand Down
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ POETRY := $(shell command -v poetry 2> /dev/null)

.PHONY: lint
lint:
$(POETRY) run flake8 $(NAME)
$(POETRY) run pydocstyle $(NAME)
$(POETRY) run black --check $(NAME)
$(POETRY) run ruff check --fix --show-fixes $(NAME)

.PHONY: format
format:
$(POETRY) run black $(NAME)
$(POETRY) run isort $(NAME)
$(POETRY) run ruff format $(NAME)

.PHONY: about
.SILENT: about
Expand Down
28 changes: 27 additions & 1 deletion poetry.lock

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

11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ fsspec = "~=2023.9.2"
s3fs = {version = "~=2023.9.2", optional = true}

[tool.poetry.group.dev.dependencies]
ruff = ">=0.1"
singer-sdk = {version = "*", extras = ["testing"]}
pytest-github-actions-annotate-failures = "~=0.2.0"
typing-extensions = {version = "^4.7.1", python = "<3.11"}
Expand All @@ -52,14 +53,14 @@ tap-dbf = 'tap_dbf.tap:cli'
[tool.poetry.extras]
s3 = ["s3fs"]

[tool.black]
line-length = 88

[tool.ruff]
ignore = ["ANN101", "DJ", "PD"]
select = ["ALL"]
src = ["tap_dbf", "tests"]
target-version = "py38"

[tool.ruff.lint]
ignore = ["ANN101", "DJ", "PD", "COM812", "ISC001", "CPY"]
preview = true
select = ["ALL"]
unfixable = [
"ERA001", # commented-out-code
]
Expand Down
4 changes: 2 additions & 2 deletions tap_dbf/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def _count_records(self, record_type: bytes = b" ") -> int:
if sep == record_type:
count += 1
self._skip_record(infile)
elif sep in (b"\x1a", b""):
elif sep in {b"\x1a", b""}:
# End of records.
break
else:
Expand Down Expand Up @@ -158,7 +158,7 @@ def _iter_records(

yield self.recfactory(items)

elif sep in (b"\x1a", b""):
elif sep in {b"\x1a", b""}:
# End of records.
break
else:
Expand Down