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
SKILL.md: write JSON output to CWD instead of temp dir, recommend
--details-only flag, expand "What to look for" with modifier-sensitive,
context-sensitive, and concentration patterns.
analyze.py: add --details-only flag (pipe-friendly, no summary), add 6
new suspicious pattern detectors: const field init, struct fields, digit-
suffixed type params, naming in interop files, suggestion rule outliers,
concentrated violations.
🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
Write the JSON output to the current directory (not `$TEMP` — that path doesn't work reliably on Windows with Git Bash). Clean up `cslint-validate.json` when done.
42
+
41
43
CsLint exits 0 (clean), 1 (violations found), or 2 (error). Exit code 1 is expected — it means violations were found, which is what we want to analyze. If exit code is 2, report the error and stop.
42
44
43
45
Then run the bundled analysis script to get a summary and flag suspicious patterns:
Use `--details` with no rule IDs to print all violations, or pass specific rule IDs to filter.
64
+
Use `--details-only` (not `--details`) to skip the summary and print only file:lineviolations — this works well with piping and `head`. Pass rule IDs to filter, or omit them to print all violations.
63
65
64
66
## Step 2 — Investigate suspicious patterns
65
67
@@ -74,10 +76,23 @@ Use `--details` on rules that look suspicious from the summary, then **read the
74
76
- Fields in interop/P/Invoke structs — names must match native APIs
75
77
- Local constants flagged by the class-level constant rule
76
78
79
+
**Modifier-sensitive rules (rules that should behave differently based on modifiers):**
80
+
-`const` fields flagged by rules that only apply to mutable fields (e.g., unnecessary initialization — constants *require* an initializer)
81
+
-`static readonly` fields flagged by instance-only rules
82
+
- Fields in structs flagged by class-only rules (e.g., "field should be private" — struct fields are commonly public for data carriers, interop, etc.)
83
+
84
+
**Context-sensitive rules (rules that should consider the containing type/scope):**
85
+
- Fields in `[StructLayout]` interop structs — must be public for marshaling
86
+
- Members in test classes or test harnesses — may follow different conventions
87
+
- Members in nested private types — encapsulation is already provided by the outer type
88
+
77
89
**Style rules (CSLINT200+):**
78
90
- Rule suggestion doesn't apply to the actual code pattern (e.g., suggesting `??` on a ternary that returns different types)
79
91
- Extremely high violation counts for a single rule vs others (outlier)
80
92
93
+
**Concentration pattern:**
94
+
- If >80% of a rule's violations come from <3 files, it often indicates a context the rule doesn't handle (interop files, generated code, lookup tables with alignment whitespace, etc.)
95
+
81
96
Group confirmed false positives by root cause. A single bug in CsLint can produce many false positives.
0 commit comments