Improve issue with start/end lines when they switch#57
Conversation
There was a problem hiding this comment.
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.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 0 |
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
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
TherunForExtensionmethod 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) fromrunForExtensioninto a private method namedparseReport.
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
No description provided.