Issue #18494: Add GoogleNonConstantFieldNameCheck for Google Java Style compliance#18657
Issue #18494: Add GoogleNonConstantFieldNameCheck for Google Java Style compliance#18657vivek-0509 wants to merge 1 commit intocheckstyle:masterfrom
Conversation
|
GitHub, generate report |
|
Github, generate site |
|
Report generation failed on phase "make_report", |
2508be9 to
0621ade
Compare
|
GitHub, generate report |
|
Hey @romani, I have reviewed the diff report all are genuine violations. |
0621ade to
649199d
Compare
|
Diff report is very huge hard to get actual diff. |
|
GitHub, generate report |
|
Hi @romani , I have generated a comparison diff report. I have overridden the messages to be identical. Here is the report https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/649199d_2026065114/reports/diff/index.html. Please let me know if I have understood your request correctly or if any changes are needed. |
|
diff is still wild. |
|
GitHub, generate report |
|
@romani I updated the configurations to use the same id for both checks, but they still appear as Red/Green pairs. It seems the report tool uses the full Check class name for the rule name, so MemberName and GoogleMemberName are treated as different rules despite the shared ID. Am I missing something? |
|
@romani When an explicit id is set in the config, the ID is appended to the class name in the format ClassName#id ( the fix can be that, If source contains # (indicating an explicit module ID was set), compare only the portion after # instead of the full string. This would allow proper matching of violations from different checks that share the same ID, and the diff report would show only true behavioral differences. |
|
tools is right, we tried to hack it, but tool is right in it behavior to show diff. |
|
so, we can look at diff and see why we have more violations that it used to be. https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/649199d_2026150917/reports/diff/elasticsearch/index.html#A1 google state that type immutability if critical point in decision. Checkstyle is not type aware, we can not make decision if it is immutable or not. So better to not give violation. |
|
Understood, will change the scope to skip all static fields and update the issue accordingly. |
649199d to
f342244
Compare
|
GitHub, generate report |
|
@romani updated the scope for the check to skip static member names |
| * for word boundaries.</li> | ||
| * <li>Underscores may be used to separate adjacent numbers (e.g., version | ||
| * numbers like {@code guava33_4_5}), but NOT between letters and digits.</li> | ||
| * </ul> |
There was a problem hiding this comment.
we need to mention that static fields are skipped, as Chckstyle not able to make sure that used type is immutable.
| * @since 13.1.0 | ||
| */ | ||
| @StatelessCheck | ||
| public class GoogleMemberNameCheck extends AbstractCheck { |
There was a problem hiding this comment.
Checks that member names conform to the
Google Java Style Guide for non-constant field naming.
hmm, why we named it GoogleMemberNameCheck ?
as it should be GoogleNonConstantFieldNameCheck.
and it will make it clear why we have limitation on static.
f342244 to
4024f27
Compare
|
@romani all the changes done pr is ready for review |
|
GitHub, generate report |
|
GitHub, generate website |
4024f27 to
ba427e9
Compare
|
GitHub, generate website |
|
@romani Current message: Updated message: For cases like
Does this violation message looks good to you?? |
ba427e9 to
0314c7f
Compare
|
@Zopsss Do you want me to keep the full violation message for this check's Example1 also? I have not updated it since I have covered both the violation messages in the examples. |
|
@romani Can you please review this PR when you have time |
@vivek-0509 sorry for the delay, yes please do that. |
…e Java Style compliance
0314c7f to
0bb782c
Compare
|
GitHub, generate website |
|
@Zopsss Done, please review |
|
GitHub, generate report |
|
CI Failure is unrelated |
|
@Zopsss ping |
Adds GoogleNonConstantFieldNameCheck to enforce non-constant field naming per Google Java Style Guide §5.2.5.
Part of #17842
Detailed Issue at #18494
Rules Enforced
f)mValue,sCount)guava33_4_5)Scope
Diff Regression config: https://gist.githubusercontent.com/vivek-0509/36cbe7f3789730951f15e7b6d551c6f3/raw/7ac2050528756f02e9952ae546a9c1e8cfed29c0/base_config.xml
Diff Regression patch config: https://gist.githubusercontent.com/vivek-0509/a979757b15933ce44f9b0f676a038195/raw/77433e7a8e91c9d621be184f4efcb829cb12d868/patch_config.xml
Contirbution repo PR: checkstyle/contribution#1021