You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: enforce SonarQube/Codacy linter compliance across library
Add a Linter Compliance section to CLAUDE.md documenting the SonarQube,
Codacy, Pylint, Flake8, and Bandit rules the codebase must satisfy, and
bring existing modules into compliance: flatten deeply nested login
flows, replace broad except swallows with specific exceptions, chain
raises with `from` to preserve tracebacks, switch manual lock
acquire/release to `with` blocks, remove redundant `object` inheritance
and empty-placeholder f-strings, replace `dict()`/`list()` literals,
and stop shadowing stdlib names. No behavioral changes; existing tests
(53) still pass.
All code must pass static analysis from SonarQube, Codacy, Pylint, and Flake8. The rules below encode the most common quality-gate failures for this codebase — follow them proactively rather than waiting for a linter report.
115
+
116
+
### Complexity & Size Limits
117
+
-**Cognitive Complexity ≤ 15** per function (SonarQube `python:S3776`). Refactor deeply nested conditionals into early-returns or helper functions.
118
+
-**Cyclomatic Complexity ≤ 10** per function (Pylint `R0912`). Split branchy logic.
-**No XML parsing with `xml.etree` / `xml.sax` / `minidom`** on untrusted input — use `defusedxml` (Bandit `B314`-`B320`).
164
+
165
+
### Imports & Structure
166
+
- No wildcard imports (`from x import *`) outside `__init__.py` re-export (Pylint `W0401`).
167
+
- No relative imports beyond one level (`from ..x`). Prefer absolute (`from je_mail_thunder.x`).
168
+
- Imports ordered: stdlib, third-party, local — separated by blank lines (Flake8 `isort`).
169
+
- No circular imports (Pylint `R0401`).
170
+
171
+
### Formatting
172
+
- 4-space indentation, no tabs (Flake8 `W191`).
173
+
- Two blank lines between top-level defs, one blank line between methods (PEP 8 / Flake8 `E302`/`E303`).
174
+
- No trailing whitespace (Flake8 `W291`), files end with a single newline (Flake8 `W292`).
175
+
- No multiple statements on one line (Flake8 `E701`/`E702`).
176
+
177
+
### Documentation
178
+
- Every public module, class, and function has a docstring (Pylint `C0111` / `missing-docstring`). Use `:param` / `:return:` / `:raises:` style already in use.
179
+
- No misleading docstrings — update them when behavior changes.
180
+
181
+
### Enforcement Workflow
182
+
- Before committing: run `pip install pylint flake8 bandit` and locally execute `pylint je_mail_thunder`, `flake8 je_mail_thunder`, `bandit -r je_mail_thunder`.
183
+
- Treat any new SonarQube / Codacy finding on changed lines as a blocker. Do not suppress rules (`# noqa`, `# pylint: disable=`) without a comment explaining why and which specific rule is being suppressed.
0 commit comments