Conversation
…sLike analyzers
Java's analyzer already had a private addDetail(increment, reason, line,
column) helper to record a complexity detail and add its increment to the
running total. The other five analyzers (C#, Go, Rust, Python, and the
shared JS/TS analyzer) each repeated the same 7-line
this.complexity += increment; this.details.push({...}) block inline at
8 call sites total, several duplicated 2x within the same file.
Extracted the same addDetail() helper into each of those analyzers,
matching Java's existing pattern, and replaced every inline occurrence
with a single call. Pure refactor, no behavior change.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #656 +/- ##
==========================================
+ Coverage 98.77% 98.78% +0.01%
==========================================
Files 12 12
Lines 3920 3962 +42
Branches 438 438
==========================================
+ Hits 3872 3914 +42
Misses 48 48 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approved
The refactor consistently preserves the existing increments, locations, reasons, and nesting values.
Review effort: Balanced
Findings: None
What changed in this PR
Refactors complexity-detail recording across language analyzers without changing behavior.
Changes:
- Adds consistent private
addDetailhelpers. - Replaces duplicated score/detail update blocks.
| File | Description |
|---|---|
rustAnalyzer.ts |
Extracts detail recording helper. |
pythonAnalyzer.ts |
Consolidates lambda and node detail updates. |
jsLikeAnalyzer.ts |
Consolidates node and nested-function updates. |
goAnalyzer.ts |
Consolidates node and alternative-branch updates. |
csharpAnalyzer.ts |
Extracts detail recording helper. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
askpt
approved these changes
Sep 19, 2026
askpt
deleted the
repo-assist/refactor-shared-adddetail-helper-20260919-d35107de17532faf
branch
September 19, 2026 12:08
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.
🤖 This pull request was created by Repo Assist, an automated AI assistant.
Summary
javaAnalyzer.tsalready had a privateaddDetail(increment, reason, line, column)helper that records a complexity detail and adds its increment to the running total. The other five analyzers (csharpAnalyzer.ts,goAnalyzer.ts,rustAnalyzer.ts,pythonAnalyzer.ts,jsLikeAnalyzer.ts) each repeated the identical 7-line pattern inline:at 8 call sites total (2x each in Go, Python, and jsLike).
Changes
addDetail(increment, reason, line, column)method tocsharpAnalyzer.ts,goAnalyzer.ts,rustAnalyzer.ts,pythonAnalyzer.ts, andjsLikeAnalyzer.ts, mirroring the existing helper injavaAnalyzer.ts.this.complexity += ...; this.details.push({...})block with a singlethis.addDetail(...)call.Pure refactor — no behavior change, no new dependencies. Consistent with prior DRY extractions in this file family (
isOutermostInSameOperatorChain,getBinaryLogicalOperator,hasLabelChild,findEnclosingTypeName).Test Status
Coverage: 99.26% stmts / 96.38% branches / 100% functions / 99.26% lines (thresholds 95/88/97/95 met, unchanged from baseline).
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
releaseassets.githubusercontent.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.
Add this agentic workflow to your repo
To install this agentic workflow, run