Skip to content

Commit

Permalink
Add Ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Dec 2, 2024
1 parent 34f7e11 commit 60e14b0
Show file tree
Hide file tree
Showing 53 changed files with 282 additions and 287 deletions.
2 changes: 0 additions & 2 deletions .bandit.yaml

This file was deleted.

38 changes: 15 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,32 +63,24 @@ repos:
rev: v0.1.8
hooks:
- id: ripsecrets
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.1
hooks:
- id: autoflake
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
hooks:
- id: pyupgrade
- id: ruff-format
args:
- --py39-plus
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 24.10.0
- --line-length=110
- repo: https://github.com/PyCQA/prospector
rev: v1.13.3
hooks:
- id: black
#- repo: https://github.com/PyCQA/prospector
# rev: v1.8.4
# hooks:
# - id: prospector
# args:
# - --tool=pydocstyle
# - --die-on-tool-error
# - --output-format=pylint
- id: prospector
args:
- --tool=ruff
- --die-on-tool-error
- --output-format=pylint
additional_dependencies:
- prospector-profile-duplicated==1.8.0 # pypi
- prospector-profile-utils==1.13.0 # pypi
- ruff==0.8.1 # pypi
- repo: https://github.com/sbrunner/jsonschema-validator
rev: 0.3.2
hooks:
Expand Down
14 changes: 5 additions & 9 deletions .prospector.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
inherits:
- duplicated
- utils:base
- utils:fix
- utils:no-design-checks

strictness: veryhigh
doc-warnings: false
- utils:unsafe

ignore-patterns:
- ^tilecloud/scripts/tc_.*.py
- ^examples/.*.py

pylint:
ruff:
disable:
- cyclic-import # see: https://github.com/PyCQA/pylint/issues/850

bandit:
options:
config: .bandit.yaml
- D102 # Missing docstring in public method
- D107 # Missing docstring in `__init__`
4 changes: 2 additions & 2 deletions bin/favicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
from shapely.ops import cascaded_union


def box(minx: float, miny: float, maxx: float, maxy: float) -> Polygon:
def _box(minx: float, miny: float, maxx: float, maxy: float) -> Polygon:
return Polygon(((minx, miny), (maxx, miny), (maxx, maxy), (minx, maxy)))


if __name__ == "__main__":
GOLDEN_RATIO = (1 + math.sqrt(5)) / 2

Y0 = int(3 - (2 + GOLDEN_RATIO) / 2) - 0.5
rectangle = box(1, Y0, 5, 2 + Y0)
rectangle = _box(1, Y0, 5, 2 + Y0)
circle1 = Point(1, 1 + Y0).buffer(1)
circle2 = Point(1 + 1 / GOLDEN_RATIO, 2 + Y0).buffer(1 / GOLDEN_RATIO)
circle3 = Point(5 - GOLDEN_RATIO, 2 + Y0).buffer(GOLDEN_RATIO)
Expand Down
32 changes: 30 additions & 2 deletions poetry.lock

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ prometheus = ["prometheus_client"]
all = ["azure-storage-blob", "azure-identity", "boto3", "pyramid", "redis", "prometheus_client"]

[tool.poetry.group.dev.dependencies]
prospector = { version = "1.13.3", extras = ["with_bandit", "with_mypy", "with_pyroma"] }
prospector = { version = "1.13.3", extras = ["with_bandit", "with_mypy", "with_pyroma", "with_ruff"] }
prospector-profile-duplicated = "1.8.0"
prospector-profile-utils = "1.12.2"
pytest = "8.3.4"
Expand Down
Loading

0 comments on commit 60e14b0

Please sign in to comment.