-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Issue #17841: Add GoogleMethodNameCheck to fix method name false nega… #18312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Issue #17841: Add GoogleMethodNameCheck to fix method name false nega… #18312
Conversation
…false negatives
304a1ac to
2f3db4a
Compare
|
The CI Failures are unrelated |
|
Github, generate report for GoogleMethodName/all-examples-in-one |
|
Failed to download or process the specified configuration(s).
|
|
GitHub, generate report |
2 similar comments
|
GitHub, generate report |
|
GitHub, generate report |
|
Report generation failed on phase "make_report", |
|
GitHub, generate report |
|
Hey @romani, Bug Found (Will Fix)Issue: Test methods with numbering suffix like Cause: The implementation doesn't strip numbering suffix before validating test methods (unlike regular methods). Examples:
Fix: Will add numbering suffix stripping + Design Questions - Need Your Input1. Single lowercase + Uppercase pattern (
|
|
@romani ping |
|
@Zopsss , can you help me to review this PR? |
|
Will fix the CI asap , failures caused due to recent pr merge method access level for getPackageLocation() changed to pubilc |
|
Hi @Zopsss , Before you review the code, I'd like to clarify my understanding of the expected rules for GoogleMethodNameCheck , as Google Style Guide is somewhat ambiguous in places. For regular methods (without For test methods (with One thing I'm unclear about: Google Style says test components should be "lowerCamelCase". Strictly speaking, lowerCamelCase means multiple words joined with capitalization (like transferMoney). Should single-word components like test_foo be valid, or should we require multi-word lowerCamelCase like transferMoney_deductsFromSource? If any of my expectations don't align with what's actually required, please let me know and I'll adjust my implementation before you do a full code review. This should save time . |
Issue: #17841
Description
Introduces a new
GoogleMethodNamecheck that properly validates method names according to the Google Java Style Guide, fixing false-negatives where underscores between letters and digits were not being flagged.Problem
The previous
MethodNamecheck failed to detect invalid names like:gradle_9_5_1()- underscore between letter 'd' and digit '9'jdk_9_0_392()- underscore between letter 'k' and digit '9'Solution
Created a dedicated
GoogleMethodNamecheck that:@Testmethods separately (underscores allowed)guava33_4_5is valid)Validation Rules
Regular Methods:
_4_5)gradle_9invalid)Test Methods (
@Test,@ParameterizedTest,@RepeatedTest):Override Methods:
@Overrideannotation are skipped (no validation)Breaking Changes
None. This check is backward compatible with the previous MethodName regex behavior.
New module config: https://gist.githubusercontent.com/vivek-0509/6733c4a828cc940c59db1c7af371a806/raw/4758b044822977e75ba30138eefa3a9b3c2026f7/google-method-name.xml
Contirbution repo PR: checkstyle/contribution#1000