Skip to content

test(coverage): boost to 87% local / ~80% SonarCloud (+367 tests, regex fallback paths)#34

Merged
aksOps merged 3 commits into
mainfrom
coverage/boost-80pct-r2
Apr 4, 2026
Merged

test(coverage): boost to 87% local / ~80% SonarCloud (+367 tests, regex fallback paths)#34
aksOps merged 3 commits into
mainfrom
coverage/boost-80pct-r2

Conversation

@aksOps

@aksOps aksOps commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Three rounds of coverage work targeting SonarCloud 80%+ quality gate:

  • 2,349 → 2,716 tests (+367 new, 0 failures)
  • 87.0% local non-grammar line coverage (up from 80.7%)
  • Expected SonarCloud: ~80%+ (consistent ~7% gap between JaCoCo and SonarCloud counting)

Root causes fixed

Round 1 — Expand existing detector tests (+315 tests)

Python, Go, Rust, Scala, C++, Kotlin, Proto, Shell detectors from 3-21% → 70%+
Java detectors, model classes, FlowViews, C#, frontend, linkers, cache, MCP tools.

Round 2 — Target remaining high-miss classes (+52 tests, the key insight)

Unlocked the regex fallback path in 10 Python ANTLR detectors and 3 Java detectors.

Every detector extending AbstractAntlrDetector has two paths:

  1. ANTLR parse tree path (< 500KB content)
  2. detectWithRegex() fallback path (> 500KB or parser failure)

Zero existing tests triggered detectWithRegex(). By padding test content to > 500KB (Python) or injecting a NUL byte to break JavaParser (Java), we now cover the entire fallback path for:

Detector Regex path triggered by
PythonStructuresDetector, DjangoModelDetector, DjangoAuthDetector content > 500KB
FastAPIAuthDetector, CeleryTaskDetector, DjangoViewDetector content > 500KB
FlaskRouteDetector, FastAPIRouteDetector, PydanticModelDetector, SQLAlchemyModelDetector content > 500KB
SpringRestDetector, SpringSecurityDetector, JpaEntityDetector NUL byte forces JavaParser failure

Test plan

  • 2,716 tests — 0 failures, 0 errors
  • 87.0% local non-grammar line coverage
  • SonarCloud scan triggered on merge to main

🤖 Generated with Claude Code

aksOps and others added 3 commits April 4, 2026 09:00
…ud coverage

Added comprehensive tests for 10 Python detectors and FlowViews, covering
all major branches: AST/regex paths, node properties, edges, negative cases,
and determinism. New FlowViewsTest covers all 5 view builders with a stub
FlowDataSource.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds 188 new tests targeting the highest-miss classes reported by SonarCloud:
- JavaDetectorsBranchCoverageTest: ClassHierarchyDetector (all node kinds, edges,
  visibility, inner/outer classes, regex fallback branches), SpringRestDetector
  (all HTTP methods, class-level prefix, produces/consumes, non-endpoint skip,
  RestTemplate/WebClient/FeignClient CALLS edges), SpringSecurityDetector
  (@EnableWebSecurity, @EnableMethodSecurity, SecurityFilterChain, @PreAuthorize
  hasRole/hasAnyRole, @secured multi-role, @RolesAllowed, authorizeHttpRequests),
  JpaEntityDetector (ManyToMany, @Version, targetEntity, table bare value),
  PublicApiDetector (public/protected/static/abstract, skips getter/setter/
  toString, interface methods, DEFINES edges), ConfigDefDetector (@value,
  @ConfigurationProperties, Kafka ConfigDef.define, deduplication, method params),
  MicronautDetector (GET/POST/PUT/DELETE, @singleton, @client, @Inject,
  @scheduled, @eventlistener, no-indicator guard).
- KubernetesDetectorExpandedTest: StatefulSet, DaemonSet, Job, CronJob, Pod,
  ConfigMap, Secret, Namespace, Ingress with rules and default backend, cross-
  resource Ingress→Service CONNECTS_TO edges, container ports/env vars, init
  containers, labels/annotations preservation, yaml_multi filtering.
- McpToolsExpandedTest: all topology tools (service_detail, service_dependencies,
  service_dependents, blast_radius, find_path, find_bottlenecks, find_circular_deps,
  find_dead_services, find_node) with empty-node and with-data scenarios; all
  run_cypher mutation keywords blocked (CREATE/DELETE/MERGE/SET/REMOVE/DROP/
  DETACH/FOREACH/CALL); get_capabilities full matrix and language filter;
  get_evidence_pack/get_artifact_metadata null-assembler paths; error-handling
  branches for every delegating tool.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@aksOps aksOps merged commit b294c16 into main Apr 4, 2026
6 checks passed
@sonarqubecloud

sonarqubecloud Bot commented Apr 4, 2026

Copy link
Copy Markdown

@aksOps aksOps changed the title test(coverage): round 2 — boost to 82.7% (+315 tests targeting highest-miss classes) test(coverage): boost to 87% local / ~80% SonarCloud (+367 tests, regex fallback paths) Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant