Skip to content

Fix line coverage in html#61

Merged
gayaldassanayake merged 1 commit intoballerina-platform:mainfrom
gayaldassanayake:fix-html-line-issue
May 31, 2025
Merged

Fix line coverage in html#61
gayaldassanayake merged 1 commit intoballerina-platform:mainfrom
gayaldassanayake:fix-html-line-issue

Conversation

@gayaldassanayake
Copy link
Copy Markdown
Contributor

@gayaldassanayake gayaldassanayake commented May 14, 2025

Purpose

Fixes #29

Approach

  1. Mark all lines in the HTML for a given issue [start, end]
  2. For rule 3,4,5,6, set the public keyword as the location. That way only the definition line of the class/object/method/function is colored.

It looks as follows now.

image

Check List

@gayaldassanayake gayaldassanayake marked this pull request as draft May 14, 2025 09:20
@gayaldassanayake gayaldassanayake marked this pull request as ready for review May 14, 2025 10:08
Comment thread scan-command/src/main/java/io/ballerina/scan/internal/StaticCodeAnalyzer.java Outdated
@keizer619 keizer619 requested a review from Copilot May 29, 2025 05:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances HTML line highlighting to cover full issue ranges, adjusts issue reporting to pinpoint the visibility token, and bumps version identifiers.

  • Highlight all lines between an issue’s start and end in SingleFileContent.jsx instead of a single line.
  • Report issues at the exact visibility token in StaticCodeAnalyzer.java and update related tests for rules 3–6.
  • Bump project versions to 0.9.1-SNAPSHOT and update HTML report fixtures to reference the new bundle names.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
static-code-analysis-report/src/components/SingleFileContent.jsx Iterate over full line ranges for each issue, with validation
static-code-analysis-report/src/main/java/io/ballerina/scan/internal/StaticCodeAnalyzer.java Report issues at the public token and introduce getQualifier
scan-command/.../Rule003And004Test.java Adjust expected line numbers to only the definition line
scan-command/.../Rule005And006Test.java Adjust expected line numbers to only the definition line
static-code-analysis-report/package.json Version bumped to 0.9.1-SNAPSHOT
scan-command/tool-scan/Dependencies.toml Version bumped to 0.9.1-SNAPSHOT
scan-command/tool-scan/Ballerina.toml Version bumped to 0.9.1-SNAPSHOT
scan-command/tool-scan/BalTool.toml JAR path updated to 0.9.1-SNAPSHOT
scan-command/.../issues-html-report.txt (windows/unix/common) Updated script filename hashes in fixtures
Comments suppressed due to low confidence (1)

static-code-analysis-report/src/components/SingleFileContent.jsx:10

  • The new multi-line highlighting and the invalid-range error branch aren’t covered by existing tests. Consider adding unit tests for both happy-path and error-handling behaviors.
useEffect(() => {

Comment thread static-code-analysis-report/src/components/SingleFileContent.jsx
Comment thread scan-command/src/main/java/io/ballerina/scan/internal/StaticCodeAnalyzer.java Outdated
Comment thread scan-command/src/main/java/io/ballerina/scan/internal/StaticCodeAnalyzer.java Outdated
@sonarqubecloud
Copy link
Copy Markdown

@gayaldassanayake gayaldassanayake merged commit 550a043 into ballerina-platform:main May 31, 2025
4 checks passed
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.

Line numbers should exact same with the Ballerina file line numbers in Error tests in Static code analayzer

3 participants