Skip to content

Commit 4a0371c

Browse files
committed
chore: linting improvements
1 parent b46d500 commit 4a0371c

2 files changed

Lines changed: 106 additions & 2 deletions

File tree

pyproject.toml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ matplotlib = "^3.9.1"
1414
numpy = "^1.26.3"
1515
loguru = "^0.7.2"
1616
tqdm = "^4.66.1"
17+
great-expectations = "^0.18.19"
1718
scipy = "^1.13.0"
1819
scikit-learn = "^1.4.2"
1920
matplotlib-set-diagrams = "~0.0.2"
@@ -53,4 +54,97 @@ show_missing = true
5354
skip_covered = true
5455

5556
[tool.ruff]
57+
target-version = "py310"
5658
line-length=120
59+
show-fixes = true
60+
61+
[tool.ruff.lint]
62+
ignore = [
63+
"ANN101",
64+
"ANN102",
65+
"EM101",
66+
"TRY003", # Disable until we start creating proper exception classes
67+
"PT011", # Disable until we start creating proper exception classes
68+
"PTH123", # Not using open() to open files
69+
]
70+
select = [
71+
"A", # Builtins
72+
"ANN", # Annotations
73+
"ARG", # Unused arguments
74+
"B", # Bugbear
75+
"BLE", # Blind except
76+
"C4", # Comprehensions
77+
"C90", # mccabe
78+
"COM", # Commas
79+
"D",
80+
"D1", # Undocumented public elements
81+
"D2", # Docstring conventions
82+
"D3", # Triple double quotes
83+
"D4", # Docstring text format
84+
"DTZ", # Datetimes
85+
"EM", # Error messages
86+
"ERA", # Commented-out code
87+
"EXE", # Executable
88+
"F", # Pyflakes
89+
"FA", # __future__ annotations
90+
"FLY", # F-strings
91+
# "FURB", # Refurb
92+
"G", # Logging format
93+
"I", # Isort
94+
"ICN", # Import conventions
95+
"INP", # Disallow PEP-420 (Implicit namespace packages)
96+
"INT", # gettext
97+
"ISC", # Implicit str concat
98+
# "LOG", # Logging
99+
"N", # PEP-8 Naming
100+
"NPY", # Numpy
101+
"PERF", # Unnecessary performance costs
102+
"PGH", # Pygrep hooks
103+
"PIE", # Unnecessary code
104+
"PL", # Pylint
105+
"PT", # Pytest
106+
"PTH", # Use Pathlib
107+
"PYI", # Stub files
108+
"Q", # Quotes
109+
"RET", # Return
110+
"RUF", # Ruff
111+
"RSE", # Raise
112+
"S", # Bandit
113+
"SIM", # Code simplification
114+
"SLF", # Private member access
115+
"SLOT", # __slots__
116+
"T10", # Debugger
117+
"T20", # Print
118+
"TCH", # Type checking
119+
"TID", # Tidy imports
120+
"TRY", # Exception handling
121+
"UP", # Pyupgrade
122+
"W", # Warnings
123+
"YTT", # sys.version
124+
]
125+
126+
127+
[tool.ruff.lint.per-file-ignores]
128+
# https://beta.ruff.rs/docs/rules/
129+
"__init__.py" = ["F401","F403","F405","D104"]
130+
"tests/*" = ["ANN", "ARG", "INP001", "S101", "SLF001"]
131+
"*.ipynb" = ["T201"]
132+
133+
[tool.ruff.lint.pylint]
134+
max-args = 15
135+
max-branches = 20
136+
max-returns = 10
137+
max-statements = 80
138+
139+
[tool.ruff.lint.flake8-tidy-imports]
140+
ban-relative-imports = "all"
141+
142+
[tool.ruff.lint.flake8-quotes]
143+
docstring-quotes = "double"
144+
multiline-quotes = "double"
145+
146+
[tool.ruff.lint.mccabe]
147+
max-complexity = 10
148+
149+
[tool.ruff.lint.pydocstyle]
150+
convention = "google"

tests/test_gain_loss.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
"""Tests for the GainLoss class in the gain_loss module."""
2+
13
import pytest
4+
25
from pyretailscience.gain_loss import GainLoss
36

47

58
@pytest.mark.parametrize(
6-
"focus_p1, comparison_p1, focus_p2, comparison_p2, focus_diff, comparison_diff, expected",
9+
("focus_p1", "comparison_p1", "focus_p2", "comparison_p2", "focus_diff", "comparison_diff", "expected"),
710
[
811
# Test when a new customer is added (focus_p1 and comparison_p1 are 0)
912
(0, 0, 100, 0, 100, 0, (100, 0, 0, 0, 0, 0)),
@@ -52,8 +55,15 @@
5255
],
5356
)
5457
def test_process_customer_group(
55-
focus_p1, comparison_p1, focus_p2, comparison_p2, focus_diff, comparison_diff, expected
58+
focus_p1,
59+
comparison_p1,
60+
focus_p2,
61+
comparison_p2,
62+
focus_diff,
63+
comparison_diff,
64+
expected,
5665
):
66+
"""Test the process_customer_group method of the GainLoss class."""
5767
result = GainLoss.process_customer_group(
5868
focus_p1=focus_p1,
5969
comparison_p1=comparison_p1,

0 commit comments

Comments
 (0)