Skip to content

Refactor shared coverage reporter helpers - #19

Closed
AlexanderLanin wants to merge 2 commits into
eclipse-score:mainfrom
etas-contrib:refactor/split-coverage-selection
Closed

AlexanderLanin wants to merge 2 commits into
eclipse-score:mainfrom
etas-contrib:refactor/split-coverage-selection

Conversation

@AlexanderLanin

Copy link
Copy Markdown
Member

Why

Both coverage backends need to select in-scope source files and locate the source text used to render reports. Keeping these shared responsibilities in reporter.py makes their ownership harder to follow and couples the gcov backend to an LLVM-oriented module. This PR gives the shared code explicit modules that both backends can depend on directly.

🦬🪒 Yak shaving

  • Move path normalization, scope selection, and reporting of files without coverage data into coverage_selection.py.
  • Move Bazel runfiles lookup and source staging into coverage_sources.py, and import it directly from the gcov backend.
  • Update Bazel dependencies and existing test imports to reflect these module boundaries.

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: a188433c-5fde-4d55-8304-1c9dec382c0b
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //:license-check (5 packages loaded, 6 targets configured)

Analyzing: target //:license-check (5 packages loaded, 6 targets configured)

Analyzing: target //:license-check (5 packages loaded, 6 targets configured)

Analyzing: target //:license-check (5 packages loaded, 6 targets configured)

Analyzing: target //:license-check (5 packages loaded, 6 targets configured)

Analyzing: target //:license-check (15 packages loaded, 10 targets configured)

Analyzing: target //:license-check (88 packages loaded, 10 targets configured)

Analyzing: target //:license-check (146 packages loaded, 703 targets configured)

Analyzing: target //:license-check (151 packages loaded, 3139 targets configured)

Analyzing: target //:license-check (151 packages loaded, 3139 targets configured)

Analyzing: target //:license-check (151 packages loaded, 3139 targets configured)

Analyzing: target //:license-check (161 packages loaded, 9324 targets configured)

Analyzing: target //:license-check (162 packages loaded, 9332 targets configured)

Analyzing: target //:license-check (170 packages loaded, 9387 targets configured)

Analyzing: target //:license-check (177 packages loaded, 11418 targets configured)

Analyzing: target //:license-check (177 packages loaded, 11418 targets configured)

INFO: Analyzed target //:license-check (179 packages loaded, 11662 targets configured).
[12 / 16] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox ... (2 actions running)
[14 / 16] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar; 0s disk-cache, processwrapper-sandbox
INFO: Found 1 target...
Target //tools:license.check.license_check up-to-date:
  bazel-bin/tools/license.check.license_check
  bazel-bin/tools/license.check.license_check.jar
INFO: Elapsed time: 29.712s, Critical Path: 2.46s
INFO: 16 processes: 12 internal, 3 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 16 total actions
INFO: Running command line: bazel-bin/tools/license.check.license_check tools/formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Documentation preview for this pull request is available at:
pr-19: https://eclipse-score.github.io/coverage_tool/pr-19/

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The refactor preserves existing behavior while establishing clear shared module boundaries and consistent build dependencies.

Review effort: Balanced
Findings: None

What changed in this PR

Refactors shared coverage logic into dedicated modules used by both reporting backends.

Changes:

  • Extracts coverage file selection and source staging helpers.
  • Updates reporter imports and Bazel dependencies.
  • Redirects existing tests to the new modules.
File Description
score_coverage/​coverage_selection.py Adds shared file-selection helpers.
score_coverage/​coverage_sources.py Adds shared source-resolution and staging helpers.
score_coverage/​reporter.py Uses the extracted helpers.
score_coverage/​gcov_reporter.py Imports shared helpers directly.
score_coverage/​BUILD Defines and wires the new libraries.
score_coverage/​tests/​reporter_test.py Updates helper imports.
score_coverage/​tests/​BUILD Adds test dependencies for the new libraries.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@dcalavrezo-qorix dcalavrezo-qorix left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can only approve this refactor if some regression tests are executed on important repos like communication and baselibs

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.

3 participants