#349: Implement non final argument pattern#1283
Conversation
📝 WalkthroughWalkthroughChangesNon-final argument pattern
SPDX header normalization
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8)aibolit/metrics/halsteadvolume/pom.xmlTraceback (most recent call last): aibolit/metrics/npath/pom.xmlTraceback (most recent call last): 🔧 PMD (7.26.0)aibolit/metrics/halsteadvolume/pom.xmlopenjdk version "17.0.19" 2026-04-21 LTS 24| 20| 24| aibolit/metrics/npath/pom.xmlopenjdk version "17.0.19" 2026-04-21 LTS 24| 20| 24| Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@yegor256 awaiting approval |
|
@yegor256 awaiting approval |
|
@ogluvu-ship-it build is broken |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
test/patterns/non_final_argument/test_non_final_argument.py (1)
16-24: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd regression coverage for de-duplication and final-only declarations.
The current fixtures each contain only one offending parameter. Add cases proving that multiple non-final parameters produce one line per declaration, and that methods/constructors whose parameters are all
finalare ignored.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/patterns/non_final_argument/test_non_final_argument.py` around lines 16 - 24, Extend the NonFinalArgument tests with fixtures containing multiple non-final parameters and assert one reported line per declaration, then add constructor and method fixtures where every parameter is final and assert no results. Update the relevant test methods near test_find_non_final_argument_in_ctor and test_find_non_final_argument_in_method while preserving the existing single-violation coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@PATTERNS.md`:
- Line 646: Standardize the pattern name to “Non-final argument” in both
PATTERNS.md:646-646 and aibolit/config.py:204-204, updating the documentation
title and the registry display name consistently.
---
Nitpick comments:
In `@test/patterns/non_final_argument/test_non_final_argument.py`:
- Around line 16-24: Extend the NonFinalArgument tests with fixtures containing
multiple non-final parameters and assert one reported line per declaration, then
add constructor and method fixtures where every parameter is final and assert no
results. Update the relevant test methods near
test_find_non_final_argument_in_ctor and test_find_non_final_argument_in_method
while preserving the existing single-violation coverage.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 4a18d919-8860-468e-8b05-4693a0848979
⛔ Files ignored due to path filters (1)
test/stats/results_test.csvis excluded by!**/*.csv
📒 Files selected for processing (8)
PATTERNS.mdaibolit/config.pyaibolit/metrics/halsteadvolume/pom.xmlaibolit/metrics/npath/npath.xmlaibolit/metrics/npath/pom.xmlaibolit/patterns/non_final_argument/non_final_argument.pyscripts/ruleset.xmltest/patterns/non_final_argument/test_non_final_argument.py
|
|
||
| *** | ||
|
|
||
| *Title*: Non final argument |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use Non-final argument consistently in the registry and documentation.
PATTERNS.md#L646-L646: change the title toNon-final argument.aibolit/config.py#L204-L204: change the display name toNon-final argument.
🧰 Tools
🪛 LanguageTool
[grammar] ~646-~646: Use a hyphen to join words.
Context: ...tList { // here } ``` *** Title: Non final argument Code: P35 *Descri...
(QB_NEW_EN_HYPHEN)
📍 Affects 2 files
PATTERNS.md#L646-L646(this comment)aibolit/config.py#L204-L204
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@PATTERNS.md` at line 646, Standardize the pattern name to “Non-final
argument” in both PATTERNS.md:646-646 and aibolit/config.py:204-204, updating
the documentation title and the registry display name consistently.
Source: Linters/SAST tools
|
@yegor256 awaiting merge |
Summary by CodeRabbit
New Features
final.Bug Fixes
finalparameters occur in the same method or constructor.Documentation