test(coverage): boost to 87% local / ~80% SonarCloud (+367 tests, regex fallback paths)#34
Merged
Conversation
…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>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Three rounds of coverage work targeting SonarCloud 80%+ quality gate:
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
AbstractAntlrDetectorhas two paths: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:Test plan
🤖 Generated with Claude Code