Skip to content

Fix/dependency cycles by file - #4634

Merged
christian-huehn-mw merged 7 commits into
mainfrom
fix/dependency-cycles-by-file
Oct 28, 2026
Merged

christian-huehn-mw merged 7 commits into
mainfrom
fix/dependency-cycles-by-file

Conversation

@christian-huehn-mw

@christian-huehn-mw christian-huehn-mw commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

{Meaningful title}

Please read the CONTRIBUTING.md before opening a PR.

Closes: #

Description

Descriptive pull request text, answering:

  • What problem/issue are you fixing?
  • What does this PR implement and how?

Definition of Done

A PR is only ready for merge once all the following acceptance criteria are fulfilled:

  • Changes have been manually tested
  • All TODOs related to this PR have been closed
  • There are automated tests for newly written code and bug fixes
  • All bugs discovered while working on this PR have been submitted as issues (if not already an open issue)
  • Documentation (GH-pages, analysis/visualization READMEs, parser READMEs, --help, etc.) has been updated (almost always necessary except for bug fixes)
  • CHANGELOG.md has been updated

Screenshots or gifs

Summary by CodeRabbit

  • New Features
    • Dependency maps now distinguish C++ friend relationships and links between declarations and their implementation parts across files.
    • Friend and implementation-part edges have distinct visual styles and legend entries.
  • Bug Fixes
    • Cycle detection now distinguishes same-named declarations in different files and detects cycles involving declarations split across files.
  • Documentation
    • Updated dependency usage descriptions and documented a known parsing gap for certain conditional Delphi routine bodies.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3291d4ec-cef6-4ff6-a211-a8e335f875be
Commits

Reviewing files that changed from the base of the PR and between 4b544b9 and 073336c.

Files selected for processing: 57
  • analysis/CHANGELOG.md
  • analysis/analysers/parsers/DependencyParser/README.md
  • analysis/analysers/parsers/DependencyParser/docs/edge-flags.md
  • analysis/analysers/parsers/DependencyParser/docs/name-resolution/cpp.md
  • analysis/analysers/parsers/DependencyParser/docs/name-resolution/delphi.md
  • analysis/analysers/parsers/DependencyParser/src/main/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/analysis/analyzers/TseMappings.kt
  • analysis/analysers/parsers/DependencyParser/src/main/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/analysis/model/TypeOfUsage.kt
  • analysis/analysers/parsers/DependencyParser/src/main/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/DeclarationCycles.kt
  • analysis/analysers/parsers/DependencyParser/src/main/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/FileLevelAggregator.kt
  • analysis/analysers/parsers/DependencyParser/src/main/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/LogicalProjection.kt
  • analysis/analysers/parsers/DependencyParser/src/main/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/ProcessingPipeline.kt
  • analysis/analysers/parsers/DependencyParser/src/main/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/cycledetection/CycleAnalyzer.kt
  • analysis/analysers/parsers/DependencyParser/src/main/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/cycledetection/algorithms/StronglyConnectedComponentDetection.kt
  • analysis/analysers/parsers/DependencyParser/src/main/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/cycledetection/model/Cycle.kt
  • analysis/analysers/parsers/DependencyParser/src/main/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/cycledetection/model/NodeInformation.kt
  • analysis/analysers/parsers/DependencyParser/src/main/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/dependencies/DependencyResolverService.kt
  • analysis/analysers/parsers/DependencyParser/src/main/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/levelization/Levelizer.kt
  • analysis/analysers/parsers/DependencyParser/src/test/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/CyclicEdgeWayBack.kt
  • analysis/analysers/parsers/DependencyParser/src/test/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/DeclarationCyclesTest.kt
  • analysis/analysers/parsers/DependencyParser/src/test/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/FileLevelAggregatorTest.kt
  • analysis/analysers/parsers/DependencyParser/src/test/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/ProcessingPipelineTest.kt
  • analysis/analysers/parsers/DependencyParser/src/test/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/dependencies/DependencyResolverServiceTest.kt
  • analysis/treeSitterExcavationSite/src/main/kotlin/de/maibornwolff/treesitter/excavationsite/languages/cpp/extractors/usedtypes/ClassScopeExtractor.kt
  • analysis/treeSitterExcavationSite/src/main/kotlin/de/maibornwolff/treesitter/excavationsite/shared/domain/DependencyResult.kt
  • analysis/treeSitterExcavationSite/src/test/kotlin/de/maibornwolff/treesitter/excavationsite/languages/cpp/CppDependencyUsedTypeTest.kt
  • dev_docs/cc-json-2.0-format.md
  • dev_docs/cc-json-2.0.schema.json
  • gh-pages/src/content/docs/docs/parser/dependency.md
  • sample-projects/c/FINDINGS.md
  • sample-projects/cpp/FINDINGS.md
  • sample-projects/csharp/FINDINGS.md
  • sample-projects/regression/cpp/spec-friend/expected.txt
  • sample-projects/regression/cpp/spec-friend/src/Thief.hpp
  • sample-projects/regression/cpp/spec-friend/src/Vault.hpp
  • sample-projects/regression/cpp/spec-implementation-part/expected.txt
  • sample-projects/regression/cpp/spec-namespace-qualified-function/expected.txt
  • sample-projects/regression/cpp/spec-out-of-line-lookup/expected.txt
  • sample-projects/regression/cpp/spec-template-out-of-line-member/expected.txt
  • sample-projects/regression/cpp/spec-template-specialization/expected.txt
  • sample-projects/regression/delphi/known-gaps.md
  • sample-projects/regression/delphi/spec-conditional-routine-body/expected.txt
  • sample-projects/regression/delphi/spec-conditional-routine-body/src/Game.Helper.pas
  • sample-projects/regression/delphi/spec-conditional-routine-body/src/Game.Swap.pas
  • sample-projects/regression/rust/spec-impl-part/expected.txt
  • sample-projects/regression/rust/spec-impl-trait-for-foreign-type/expected.txt
  • sample-projects/regression/sql/spec-alter-part/expected.txt
  • sample-projects/regression/sql/spec-comment-on/expected.txt
  • sample-projects/regression/sql/spec-declaration-before-part/expected.txt
  • sample-projects/regression/sql/spec-object-type/expected.txt
  • sample-projects/regression/sql/spec-package-member-first/expected.txt
  • sample-projects/regression/sql/spec-package-private/expected.txt
  • sample-projects/regression/sql/spec-package-spec-body/expected.txt
  • visualization/CHANGELOG.md
  • visualization/app/codeCharta/features/dependencyMap/components/dependencyEdgeLegend/dependencyEdgeLegend.component.spec.ts
  • visualization/app/codeCharta/renderer/dependencyGraph/util/lineStyle.spec.ts
  • visualization/app/codeCharta/renderer/dependencyGraph/util/lineStyle.ts
  • visualization/app/codeCharta/util/ccJson2Schema.json
Files with no reviewable changes: 2
  • analysis/analysers/parsers/DependencyParser/src/test/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/dependencies/DependencyResolverServiceTest.kt
  • analysis/analysers/parsers/DependencyParser/src/main/kotlin/de/maibornwolff/codecharta/analysers/parsers/dependency/processing/dependencies/DependencyResolverService.kt

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Walkthrough

The dependency parser adds friend and part_of edge usages. Cycle detection now distinguishes declarations by file and logical path and accounts for implementation parts. Dependency-map styles, documentation, and regression expectations are updated. A Delphi conditional routine-body parsing gap is recorded with a regression fixture.

Changes: Dependency edge behavior

Layer / File(s) Summary
Add friend and part_of edge usages
analysis/treeSitterExcavationSite/..., analysis/analysers/parsers/DependencyParser/..., sample-projects/regression/cpp/..., sample-projects/regression/rust/..., sample-projects/regression/sql/...
C++ friend declarations are extracted as FRIEND and mapped to the friend usage. Edges from implementation parts to their declarations receive part_of. Regression expectations, usage descriptions, and visualization styles include the new kinds.
Detect cycles between declaration copies
analysis/analysers/parsers/DependencyParser/..., sample-projects/c/FINDINGS.md, sample-projects/cpp/FINDINGS.md, sample-projects/csharp/FINDINGS.md
Cycle analysis uses file-qualified declaration keys and maps implementation parts to matching declarations. File-level and logical projections use the resulting declaration-cycle data. Tests cover same-named declarations, cross-file cycles, and return paths.

Delphi conditional routine body fixture

Layer / File(s) Summary
Record the conditional routine-body gap
analysis/analysers/parsers/DependencyParser/docs/name-resolution/delphi.md, sample-projects/regression/delphi/...
Documentation and a sample fixture record the case where conditional begin and asm branches share a later end;. The expected result marks the syntax unsupported and documents its effect on later routines.

Priority: Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Possibly related PRs

  • MaibornWolff/codecharta#4617: It adds file-specific declaration copies used by this change to key cycle analysis by file and logical path.
Merge Risk: Minimal · up to 07333

No actionable issue was established in the reviewed changes; the PR is mergeable after normal checks.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description is the unfilled repository template. The title placeholder "{Meaningful title}" remains, and "Closes: #" has no issue number. The Description section still contains the template prompt… Replace the template placeholder title with a meaningful title. Add the linked issue number to "Closes: #". In the Description section, state the problem: dependency cycles between same-named declarations in different files were falsely rep…
Docstring Coverage Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title "Fix/dependency cycles by file" refers to a real aspect of the changeset. The main change makes cycle detection use file plus logical path, so same-named declarations in different files no l…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Fix/dependency cycles by file" refers to a real aspect of the changeset. The main change makes cycle detection use file plus logical path, so same-named declarations in different files no longer form false cycles. The title is brief and specific, but it omits the other parts of the change, such as the new friend and part_of edge kinds. It also uses a branch-style "Fix/" prefix rather than a plain sentence. That makes it partially related rather than fully descriptive.

Full details: Description check

Explanation

The description is the unfilled repository template. The title placeholder "{Meaningful title}" remains, and "Closes: #" has no issue number. The Description section still contains the template prompt "Descriptive pull request text" and no text explaining the problem or the implementation. Every Definition of Done box is unchecked, and the Screenshots section is empty. The PR objectives confirm that the description has no summary or implementation details. Although the changeset is substantial, the description is largely incomplete.

Resolution

Replace the template placeholder title with a meaningful title. Add the linked issue number to "Closes: #". In the Description section, state the problem: dependency cycles between same-named declarations in different files were falsely reported, and cycles through split types were missed. Explain the approach: declarations are keyed by file and logical path, implementation parts map to their declarations, and new friend and part_of usage kinds are added. State the manual and automated testing performed. Check off the Definition of Done items that apply, including the CHANGELOG update. Add screenshots of the new visualization edge styles, or state that none apply.

Full details: Docstring Coverage

Explanation

Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 13 functions across 23 files. (32 skipped: 32 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

christian-huehn-mw and others added 7 commits October 28, 2026 09:43
… as part_of

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013vfKZQ4nJJyhVg7K5q6GcX
Declarations sharing a logical path in different files no longer close
fake cycles, and an implementation part counts as the declaration it
implements, so cycles through a split type are found and can be followed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013vfKZQ4nJJyhVg7K5q6GcX
…s as a known gap

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013vfKZQ4nJJyhVg7K5q6GcX
… friend kinds

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013vfKZQ4nJJyhVg7K5q6GcX
@ChristianHuehn
ChristianHuehn force-pushed the fix/dependency-cycles-by-file branch from 8cd7dab to 073336c Compare October 28, 2026 09:23
@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@christian-huehn-mw
christian-huehn-mw merged commit 4835fa8 into main Oct 28, 2026
17 checks passed
@christian-huehn-mw
christian-huehn-mw deleted the fix/dependency-cycles-by-file branch October 28, 2026 09:42
This was referenced Oct 28, 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