Skip to content

Commit 34966f0

Browse files
committed
style: add ruff config
Signed-off-by: Kiki L Hakiem <[email protected]>
1 parent cb49949 commit 34966f0

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

providers/openfeature-provider-unleash/pyproject.toml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ dev = [
3434
"psycopg2-binary>=2.9.0,<3.0.0",
3535
"testcontainers>=4.12.0,<5.0.0",
3636
"types-requests>=2.31.0",
37+
"ruff>=0.12.10",
3738
]
3839

3940
[tool.uv.build-backend]
@@ -69,6 +70,68 @@ markers = [
6970
"integration: marks tests as integration tests (deselect with '-m \"not integration\"')",
7071
]
7172

73+
[tool.ruff]
74+
target-version = "py39"
75+
exclude = [
76+
".git",
77+
".venv",
78+
"__pycache__",
79+
"venv",
80+
]
81+
82+
[tool.ruff.lint]
83+
select = [
84+
"A",
85+
"B",
86+
"C4",
87+
"C90",
88+
"E",
89+
"F",
90+
"FLY",
91+
"FURB",
92+
"I",
93+
"LOG",
94+
"N",
95+
"PERF",
96+
"PGH",
97+
"PLC",
98+
"PLR0913",
99+
"PLR0915",
100+
"RUF",
101+
"S",
102+
"SIM",
103+
"T10",
104+
"T20",
105+
"UP",
106+
"W",
107+
"YTT",
108+
]
109+
ignore = [
110+
"E501", # the formatter will handle any too long line
111+
]
112+
113+
[tool.ruff.lint.per-file-ignores]
114+
"**/tests/**/*" = [
115+
"S101", # Use of assert detected
116+
"S105", # Possible hardcoded password
117+
"S106", # Possible hardcoded password assigned to argument
118+
"S104", # Possible binding to all interfaces
119+
"T201", # print found
120+
"PERF203", # try-except within a loop incurs performance overhead
121+
"PLR0915", # Too many statements
122+
]
123+
124+
[tool.ruff.lint.isort]
125+
known-first-party = ["openfeature"]
126+
127+
[tool.ruff.lint.pylint]
128+
max-args = 6
129+
max-statements = 30
130+
131+
[tool.ruff.lint.pyupgrade]
132+
# Preserve types, even if a file imports `from __future__ import annotations`.
133+
keep-runtime-typing = true
134+
72135
[project.scripts]
73136
# workaround while UV doesn't support scripts directly in the pyproject.toml
74137
# see: https://github.com/astral-sh/uv/issues/5903

providers/openfeature-provider-unleash/src/scripts/scripts.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,8 @@ def cov() -> None:
2626
def mypy() -> None:
2727
"""Run mypy."""
2828
subprocess.run("mypy", shell=True, check=True)
29+
30+
31+
def lint() -> None:
32+
"""Run ruff linting."""
33+
subprocess.run("ruff check", shell=True, check=True)

uv.lock

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)