- Tests Passing: 162/258 (62.8%)
- Tests Failing: 90 (34.9%)
- Goal: 250+/258 (96%+)
- Run
./scripts/install-git-hooks.shonce after cloning to enable the local grammar-sync hook (scripts/check-grammar-sync.sh). This keeps the generated enums insrc/languages/current whenever you switch branches.
File: src/metrics/cognitive.rs
Line 243: Delete this line:
stats.boolean_seq.reset();Full context (should look like this after edit):
#[inline]
fn increase_nesting(stats: &mut Stats, nesting: &mut usize, depth: usize, lambda: usize) {
stats.nesting = *nesting + depth + lambda;
increment(stats);
*nesting += 1;
// DELETED: stats.boolean_seq.reset();
}Then run:
cargo test --lib metrics::cognitive:: 2>&1 | tail -5Expected output:
test result: ok. 25 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- ✅ 25 cognitive complexity tests
- ✅ 4 cyclomatic complexity tests
- ✅ Unlocks 61 more tests for Phase 2-4
Result: 162 → 191 tests passing (+14%)
- ANALYSIS_SUMMARY.md - Executive summary
- PHASE1_IMPLEMENTATION_GUIDE.md - Detailed explanation
- TEST_FAILURE_CATEGORIZATION.md - Full categorization
- ACTIONABLE_FIXES_SUMMARY.md - Ranked by impact/effort
- ROOT_CAUSE_SUMMARY.md - Original analysis
- BOOLEAN_OPERATOR_INVESTIGATION.md - Python limitation
- Delete 1 line in cognitive.rs
- Run:
cargo test --lib metrics::cognitive:: - Verify: 25 tests pass
- Fix LOC blank line detection
- Review:
src/metrics/loc.rsandsrc/comment_rm.rs - Expected: +12 tests
- Fix function parameter detection
- Review:
src/metrics/nargs.rs - Handle C macros specially
- Expected: +31 tests
- Fix exit point detection
- Edge case cleanup
- Expected: +4 tests
# Phase 1: Cognitive
cargo test --lib metrics::cognitive:: 2>&1 | grep "test result"
# Phase 2: LOC
cargo test --lib metrics::loc:: 2>&1 | grep "test result"
# Phase 3: Parser fixes
cargo test --lib metrics::{nargs,nom,ops}:: 2>&1 | grep "test result"
# Full suite
cargo test --lib 2>&1 | grep "test result"| Phase | Time | Result | Rate |
|---|---|---|---|
| Start | — | 162 passing | 62.8% |
| 1 | 2 min | 191 passing | 74% |
| 2 | 1-2 hrs | 203 passing | 79% |
| 3 | 3-4 hrs | 234 passing | 91% |
| 4 | 1-2 hrs | 250+ passing | 96%+ |
Cognitive: 25 tests (Python, C, JavaScript boolean operators)
Cyclomatic: 4 tests (auto-fix from cognitive)
LOC: Blank line and comment detection (C/C++, Python)
NArgs: 14 tests (function parameters)
NOM: 4 tests (method counting)
Ops: 8 tests (operator counting)
Halstead: 5 tests (auto-fix from ops)
Exit: 4 tests (return statement detection)
Spaces: 1 test (scope operators)
Python boolean operators: Architectural limitation
C++ macros: Parser grammar limitation
Edge cases: Complex patterns
| File | Changes |
|---|---|
src/metrics/cognitive.rs |
Line 243: DELETE |
src/metrics/loc.rs |
Phase 2 review |
src/comment_rm.rs |
Phase 2 review |
src/metrics/nargs.rs |
Phase 3 fix |
src/metrics/nom.rs |
Phase 3 fix (depends on nargs) |
src/metrics/ops.rs |
Phase 3 fix (depends on nargs) |
src/c_langs_macros/ |
Phase 3: Special handling |
src/metrics/exit.rs |
Phase 4 fix |
# After Phase 1
git add src/metrics/cognitive.rs
git commit -m "fix: Remove aggressive boolean sequence reset in cognitive metrics
This fix allows boolean operators (and, or, &&, ||) to be counted
in cognitive complexity metrics, resolving 25 direct test failures
and 4 cascading cyclomatic complexity test failures."
# After each phase
git status # Verify clean
cargo test --lib 2>&1 | tail -5 # Check progress- Line 243 deleted from cognitive.rs
-
cargo test --lib metrics::cognitive::shows all 25 pass - Full test suite shows 191 passing (up from 162)
- Changes committed to git
- 250+ tests passing
- All 4 phases completed
- Documentation updated
- Changes committed and pushed
Open cognitive.rs, search for increase_nesting, verify the function has 4 lines only.
Make sure you deleted the exact line. Use git diff to verify:
git diff src/metrics/cognitive.rs
# Should show exactly 1 line removed: stats.boolean_seq.reset();Ensure indentation is correct. Use:
cargo fmt # Auto-format
cargo build --lib # Check compilation| Document | For | Time |
|---|---|---|
| ANALYSIS_SUMMARY.md | Overview | 5 min |
| PHASE1_IMPLEMENTATION_GUIDE.md | Step-by-step guide | 10 min |
| TEST_FAILURE_CATEGORIZATION.md | Complete breakdown | 20 min |
| ACTIONABLE_FIXES_SUMMARY.md | Quick reference | 10 min |
| ROOT_CAUSE_SUMMARY.md | Technical deep dive | 15 min |
- Delete line 243 from
src/metrics/cognitive.rs - Run
cargo test --lib - See 191 tests passing (up from 162)
- Read ANALYSIS_SUMMARY.md for next steps
- Repeat Phases 2-4 for remaining 59 failures
Total time to 96% pass rate: 5-8 hours