Skip to content

Commit

Permalink
Merge pull request #222 from jGaboardi/fix_giddy_linting
Browse files Browse the repository at this point in the history
use `ruff` for formatting -- streamline infra
  • Loading branch information
weikang9009 authored Jul 3, 2024
2 parents 58407eb + 02cb668 commit ab9fc0b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
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

0 comments on commit ab9fc0b

Please sign in to comment.