Skip to content

Commit

Permalink
Fix ruff findings
Browse files Browse the repository at this point in the history
# Conflicts:
#	poetry.lock
  • Loading branch information
eruvanos committed Jun 6, 2024
1 parent 5e7c0a7 commit 431b792
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 32 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ env
.env
venv
.venv
.python-version

__pycache__
*.py[cod]
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ repos:

- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.253'
rev: 'v0.4.8'
hooks:
- id: ruff
65 changes: 36 additions & 29 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,33 +101,11 @@ relative_files = true
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[project]
requires-python = ">= 3.8"

[tool.ruff]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"C", # flake8-comprehensions
"B", # flake8-bugbear
# "N", # naming
# "S", # flake8-bandit
# "PT", # flake8-pytest-style
# "SIM",# flake8-simplify
# "TCH",# flake8-type-checking
# "PL", # Pylint
"PLE", # error
"RUF", # Ruff-specific rules
]
ignore = [
"E501", # line too long, handled by black
"B008", # do not perform function calls in argument defaults
"C901", # too complex
]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F"]
unfixable = []
[tool.ruff]

# Exclude a variety of commonly ignored directories.
exclude = [
Expand Down Expand Up @@ -156,17 +134,46 @@ exclude = [
# Same as Black.
line-length = 120

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Assume Python 3.10.
target-version = "py38"

[tool.ruff.mccabe]
[tool.ruff.lint]

# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"C", # flake8-comprehensions
"B", # flake8-bugbear
# "N", # naming
# "S", # flake8-bandit
# "PT", # flake8-pytest-style
# "SIM",# flake8-simplify
# "TCH",# flake8-type-checking
# "PL", # Pylint
"PLE", # error
"RUF", # Ruff-specific rules
]
ignore = [
"E501", # line too long, handled by black
"B008", # do not perform function calls in argument defaults
"C901", # too complex
]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F", "R"]
unfixable = []

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"doc/conf.py" = ["E402"]

[tool.mypy]
Expand Down
2 changes: 1 addition & 1 deletion ship.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ echo "Run tests"
pytest .

echo "Ruff"
ruff .
ruff check .

echo "Bump version"

Expand Down
3 changes: 2 additions & 1 deletion tests/test_serve.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import time
from multiprocessing import Process
from typing import ClassVar
from unittest import TestCase
from unittest.mock import Mock

Expand All @@ -19,7 +20,7 @@


class InMemBroker(ServiceBroker):
instances = {}
instances: ClassVar = {}

def __init__(self, service_guid="service-test-guid", plan_guid="plan-test-guid"):
self.service_guid = service_guid
Expand Down

0 comments on commit 431b792

Please sign in to comment.