Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .claude/commands/swp/test/audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ Detects anti-patterns BEFORE they cause test failures.

| ID | Pattern | Severity | Count (baseline) |
|----|---------|----------|------------------|
| swp-test-001 | `assert X is not None` (trivial) | warning | 133 |
| swp-test-001 | `assert X is not None` (trivial) | warning | 74 |
| swp-test-002 | `patch.object` without `wraps=` | warning | 76 |
| swp-test-003 | Assert without error message | info | - |
| swp-test-004 | `plt.subplots()` (verify cleanup) | info | 59 |
| swp-test-006 | `len(x) > 0` without type check | info | - |
| swp-test-009 | `isinstance(X, object)` (disguised trivial) | warning | 0 |

### Good Patterns to Track (Adoption Metrics)

Expand Down Expand Up @@ -77,6 +78,15 @@ mcp__ast-grep__find_code(
language="python",
max_results=30
)

# 5. Disguised trivial assertion (swp-test-009)
# isinstance(X, object) is equivalent to X is not None
mcp__ast-grep__find_code(
project_folder="/path/to/SolarWindPy",
pattern="isinstance($OBJ, object)",
language="python",
max_results=50
)
```

**FALLBACK: CLI ast-grep (requires local `sg` installation)**
Expand Down Expand Up @@ -163,6 +173,7 @@ This skill is for **routine audits** - quick pattern detection before/during tes
| Anti-Pattern | Fix | TEST_PATTERNS.md Section |
|--------------|-----|-------------------------|
| `assert X is not None` | `assert isinstance(X, Type)` | #6 Return Type Verification |
| `isinstance(X, object)` | `isinstance(X, SpecificType)` | #6 Return Type Verification |
| `patch.object(i, m)` | `patch.object(i, m, wraps=i.m)` | #1 Mock-with-Wraps |
| Missing `plt.close()` | Add at test end | #15 Resource Cleanup |
| Default parameter values | Use distinctive values (77, 2.5) | #2 Parameter Passthrough |
179 changes: 0 additions & 179 deletions benchmarks/fitfunctions_performance.py

This file was deleted.

2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --allow-unsafe --extra=docs --output-file=docs/requirements.txt pyproject.toml
Expand Down
Loading