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

use ruff for formatting -- streamline infra #222

Merged
merged 2 commits into from
Jul 3, 2024
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
8 changes: 2 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
files: "giddy\/"
repos:
- repo: https://github.com/psf/black
rev: "24.3.0"
hooks:
- id: black
language_version: python3
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.3.5"
rev: "v0.5.0"
hooks:
- id: ruff
- id: ruff-format

ci:
autofix_prs: false
Expand Down
2 changes: 1 addition & 1 deletion giddy/directional.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def permute(self, permutations=99, alternative="two.sided"):
P = NEG * L + (1 - NEG) * S
self.p = P
else:
print("Bad option for alternative: %s." % alternative)
print(f"Bad option for alternative: {alternative}")

def _calc(self, Y, w, k):
wY = weights.lag_spatial(w, Y)
Expand Down
16 changes: 4 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ Repository = "https://github.com/pysal/giddy"

[project.optional-dependencies]
dev = [
"black",
"ruff",
"pre-commit",
]
Expand All @@ -65,20 +64,12 @@ include = [
"giddy.*",
]

[tool.black]
line-length = 88
extend-exclude = '''
(
docs/conf.py
)
#'''

[tool.ruff]
line-length = 88
select = ["E", "F", "W", "I", "UP", "N", "B", "A", "C4", "SIM", "ARG"]
target-version = "py39"
lint.select = ["E", "F", "W", "I", "UP", "N", "B", "A", "C4", "SIM", "ARG"]
exclude = ["giddy/tests/*", "docs/*"]
[tool.ruff.per-file-ignores]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = [
"F401" # imported but unused
]
Expand All @@ -97,6 +88,7 @@ exclude = ["giddy/tests/*", "docs/*"]
"E501", # Line too long
]


[tool.coverage.run]
source = ["./giddy"]

Expand Down
Loading