Skip to content

Improve issue with start/end lines when they switch#57

Merged
DMarinhoCodacy merged 1 commit into
masterfrom
normalize-start-end-lines
Jun 2, 2026
Merged

Improve issue with start/end lines when they switch#57
DMarinhoCodacy merged 1 commit into
masterfrom
normalize-start-end-lines

Conversation

@DMarinhoCodacy
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces line normalization for duplication clones in the Jscpd tool, ensuring that the start line is always less than or equal to the end line by using math.min and math.max. This addresses an issue where jscpd occasionally reports a start line larger than the end line. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

Copy link
Copy Markdown

@codacy-production codacy-production Bot 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 successfully implements a normalization step for line numbers reported by jscpd, ensuring that startLine is always less than or equal to endLine. While the logic is straightforward, the PR is missing unit tests to verify this normalization across various scenarios. Additionally, the changes have caused the runForExtension method to exceed the recommended line limit, indicating a need for refactoring. Codacy reports the PR as up to standards overall, but addressing the method length and adding tests is highly recommended for long-term stability.

About this PR

  • The PR description is empty and provides no context or reproduction steps for the bug. Furthermore, no unit tests were added to verify the normalization logic or ensure that future changes do not regress this fix.
1 comment outside of the diff
src/main/scala/com/codacy/duplication/jscpd/Jscpd.scala

line 32 ⚪ LOW RISK
The runForExtension method has exceeded the 50-line limit. It is recommended to refactor this by extracting the JSON processing logic into a dedicated helper method to improve readability and maintainability. Consider extracting the JSON parsing and mapping logic (lines 51-82) from runForExtension into a private method named parseReport.

Test suggestions

  • Normalization when 'start' is greater than 'end' (e.g., start: 10, end: 5)
  • Normalization when 'start' is less than 'end' (e.g., start: 5, end: 10)
  • Normalization when 'start' is equal to 'end' (e.g., start: 5, end: 5)
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Normalization when 'start' is greater than 'end' (e.g., start: 10, end: 5)
2. Normalization when 'start' is less than 'end' (e.g., start: 5, end: 10)
3. Normalization when 'start' is equal to 'end' (e.g., start: 5, end: 5)

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

@DMarinhoCodacy DMarinhoCodacy merged commit 5350ff3 into master Jun 2, 2026
6 checks passed
@DMarinhoCodacy DMarinhoCodacy deleted the normalize-start-end-lines branch June 2, 2026 10:30
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.

2 participants