TCE-1383 Improve LowerCasePatternMatching rule - #88
Conversation
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
While the repository's Codacy grade is 'up to standards', this PR introduces logic changes to the LowerCasePatternMatching rule without accompanying test cases or a descriptive PR summary.
A significant logic concern was identified regarding the addition of Pat.Bind: there is a high probability of generating duplicate reports for the same line because the walker likely visits both the binding and the underlying variable. Furthermore, the isCaseFromPartialFunction method has exceeded complexity thresholds, which may hinder future maintainability. These logic and quality gaps should be addressed before merging to ensure the rule remains efficient and accurate.
About this PR
- The PR description is empty, and no new test cases were provided to verify the 'Pat.Bind' logic. This makes it difficult to validate that the new requirements are met without regression.
1 comment outside of the diff
patterns-base/src/main/scala/codacy/patterns/Custom_Scala_LowerCasePatternMatching.scala
line 25🟡 MEDIUM RISK
The methodisCaseFromPartialFunctionhas a cyclomatic complexity of 11, exceeding the limit of 8. Consider extracting the logic that identifies partial application patterns (lines 28-31) into a private helper method or a custom extractor.
Test suggestions
- Missing recommended test scenario: Verify that a lowercase variable in a standard case statement is flagged.
- Missing recommended test scenario: Verify that a lowercase variable in a binding pattern (using '@') is flagged.
- Missing recommended test scenario: Verify that uppercase variables or variables with explicit type annotations are not flagged.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Missing recommended test scenario: Verify that a lowercase variable in a standard case statement is flagged.
2. Missing recommended test scenario: Verify that a lowercase variable in a binding pattern (using '@') is flagged.
3. Missing recommended test scenario: Verify that uppercase variables or variables with explicit type annotations are not flagged.
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
No description provided.