[#15] Fixed false positives on variables prefixed with underscore.#16
[#15] Fixed false positives on variables prefixed with underscore.#16AlexSkrypnyk merged 1 commit intomainfrom
Conversation
📝 WalkthroughWalkthroughAdds a helper to detect leading-underscore variable names and updates local-variable and parameter sniff processing to skip variables that start with an underscore; tests and fixtures updated to cover underscore-prefixed parameters and locals. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes
Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (7)
🧰 Additional context used📓 Path-based instructions (3)**/*.php📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*📄 CodeRabbit inference engine (CLAUDE.md)
Files:
src/DrevOps/Sniffs/**/*Sniff.php📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (11)📚 Learning: 2025-12-16T22:47:02.675ZApplied to files:
📚 Learning: 2025-12-16T22:47:02.675ZApplied to files:
📚 Learning: 2025-12-16T22:47:02.675ZApplied to files:
📚 Learning: 2025-12-16T22:47:02.675ZApplied to files:
📚 Learning: 2025-12-16T22:47:02.675ZApplied to files:
📚 Learning: 2025-12-16T22:47:02.675ZApplied to files:
📚 Learning: 2025-12-16T22:47:02.675ZApplied to files:
📚 Learning: 2025-12-16T22:47:02.675ZApplied to files:
📚 Learning: 2025-12-16T22:47:02.675ZApplied to files:
📚 Learning: 2025-12-16T22:47:02.675ZApplied to files:
📚 Learning: 2025-12-16T22:47:02.675ZApplied to files:
🧬 Code graph analysis (3)src/DrevOps/Sniffs/NamingConventions/LocalVariableNamingSniff.php (1)
tests/Unit/AbstractVariableNamingSniffTest.php (1)
src/DrevOps/Sniffs/NamingConventions/ParameterNamingSniff.php (1)
🪛 PHPMD (2.15.0)tests/Fixtures/Valid.php11-11: The variable $_static_value is not named in camelCase. (undefined) (CamelCaseVariableName) 12-12: The variable $_internalVar is not named in camelCase. (undefined) (CamelCaseVariableName) 20-20: The variable $_prefixed_param is not named in camelCase. (undefined) (CamelCaseVariableName) 30-30: The variable $_internal_cache is not named in camelCase. (undefined) (CamelCaseVariableName) 30-30: Avoid unused local variables such as '$_internal_cache'. (undefined) (UnusedLocalVariable) 31-31: The variable $_tempValue is not named in camelCase. (undefined) (CamelCaseVariableName) 31-31: Avoid unused local variables such as '$_tempValue'. (undefined) (UnusedLocalVariable) 38-40: The parameter $_prefixed_param is not named in camelCase. (undefined) (CamelCaseParameterName) 39-39: The variable $_prefixed_param is not named in camelCase. (undefined) (CamelCaseVariableName) tests/Unit/AbstractVariableNamingSniffTest.php697-697: Missing class import via use statement (line '697', column '23'). (undefined) (MissingImport) 🔇 Additional comments (10)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 6
Lines 415 420 +5
=========================================
+ Hits 415 420 +5 ☔ View full report in Codecov by Sentry. |
Variables like `$_static_value` are now completely skipped from naming convention checks as they are commonly used for internal/special variables.
bebe37e to
bb762db
Compare
Variables like
$_static_valueare now completely skipped from naming convention checks as they are commonly used for internal/special variables.Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.