-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Issue #17507: Support for multipart versioning format using underscores #17708
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
Conversation
2ce7f1a to
79454cc
Compare
|
Github, generate report |
...e/checkstyle/test/chapter5naming/rule53camelcase/InputCamelCaseMultipartVersioningNames.java
Outdated
Show resolved
Hide resolved
79454cc to
6a3e142
Compare
...e/checkstyle/test/chapter5naming/rule53camelcase/InputCamelCaseMultipartVersioningNames.java
Outdated
Show resolved
Hide resolved
src/it/java/com/google/checkstyle/test/chapter5naming/rule53camelcase/CamelCaseDefinedTest.java
Show resolved
Hide resolved
romani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
items:
...e/checkstyle/test/chapter5naming/rule53camelcase/InputCamelCaseMultipartVersioningNames.java
Outdated
Show resolved
Hide resolved
bae2f11 to
a4eaf13
Compare
|
Github, generate report |
romani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dissent !
romani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from guideline:
for example transferMoney_deductsFromSource. There is no One Correct Way to name test methods.
in regression report we have https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/a4eaf13_2025072930/reports/diff/guava/index.html#A125
bunch of similar namings, that are still violation.
we need to have separate issue if we want to addreess them in separately.
src/main/resources/google_checks.xml
Outdated
| <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/> | ||
| <property name="format" value="^[a-z](?:[a-z0-9][a-zA-Z0-9]*|[a-z0-9]*[0-9](?:_[0-9]+)*)$"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why MethodName and MemberName regex is different? Shouldn't it be same? @mohitsatr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MethodName:
value="^[a-z](?:[a-z0-9][a-zA-Z0-9]*|[a-z0-9]*[0-9](?:_[0-9]+)*)$"
MemberName:
value="^(?![a-z]$)(?![a-z][A-Z])[a-z][a-z0-9]*(?:[A-Z][a-zA-Z0-9]*|[0-9](?:_[0-9]+)*)?$"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are shortened and simplifed versions to save line length.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets keep all regexp the same, it will clearly shows that rules of format is same.
|
@romani we cover these names. I tested them locally. I forgot to include the Suppression in the regression config. |
|
Github, generate report |
|
such methods does not have am I right? |
romani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
items:
...e/checkstyle/test/chapter5naming/rule53camelcase/InputCamelCaseMultipartVersioningNames.java
Outdated
Show resolved
Hide resolved
Normal methods & Test methods, both follows lowerCamelCase so both of them follows same naming conventions. The current regex we're using doesn't allow for camel casing characters and digits together, for example |
Underscores are only allowed in test method. we can't put them in normal Method names. Normal methods & Test methods, both use same regex format. so we allow the following formats, we are also making underscores valid for normal functions.
|
From style guide: https://google.github.io/styleguide/javaguide.html#s5.2.3-method-names
from lowerCamelCase rule:
In the style guide it is mentioned that method names should be in lower camel case ( which allows for underscores ) and it is also separately mentioned that JUnit test methods can also use underscores. So it is a bit confusing, if normal methods are allowed to have underscores or not. It is mentioned that |
Let's not think of Multipart version number methods as normal methods. #17708 (comment) |
a4eaf13 to
24f1e12
Compare
|
Style guide has mentioned that normal methods can use lowerCamelCase, which means it can have underscores. @romani please correct me if I'm wrong. |
|
Unfortunately Google style is not exact. So if we can not write Regexp that decently covers allowance of |
romani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
items:
...e/checkstyle/test/chapter5naming/rule53camelcase/InputCamelCaseMultipartVersioningNames.java
Outdated
Show resolved
Hide resolved
|
For methods: allow underscore Only between sentences for tests and for all methods between digits. |
romani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds like Regexp is not possible/reasonable to use in such complicated requirements, right ?
if you agree, lets write issue(s) on new Check(s) creation to cover requirements and finish with this PR. We did big effort, and we proved that regexp is not working any more.
items:
...es/com/google/checkstyle/test/chapter5naming/rule53camelcase/InputUnderscoreUsedInNames.java
Show resolved
Hide resolved
8513ab3 to
ed677a5
Compare
romani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last:
...es/com/google/checkstyle/test/chapter5naming/rule53camelcase/InputUnderscoreUsedInNames.java
Outdated
Show resolved
Hide resolved
...es/com/google/checkstyle/test/chapter5naming/rule53camelcase/InputUnderscoreUsedInNames.java
Show resolved
Hide resolved
|
Github, generate report |
ed677a5 to
fb7ca85
Compare
We need to restore default values. |
fb7ca85 to
c8da9c6
Compare
romani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
item:
...es/com/google/checkstyle/test/chapter5naming/rule53camelcase/InputUnderscoreUsedInNames.java
Outdated
Show resolved
Hide resolved
romani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
item:
...es/com/google/checkstyle/test/chapter5naming/rule53camelcase/InputUnderscoreUsedInNames.java
Outdated
Show resolved
Hide resolved
6fbbfac to
e75fe1e
Compare
romani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last
| void kotlinLang1_9_2() {} // violation, false-positive, 'must match pattern' | ||
|
|
||
| // violation below, '_' not allowed between lowercase character sequences | ||
| void convertToKotlinVersion1_9_24() {} // violation, false-positive, 'must match pattern' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, we need some suppression to avoid false positives.
Suppression config and resulted false negatives should be marked until bsime ticket, please create it,
And we will merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
false-positive for class names will be handled at #17835
e75fe1e to
ec7e6df
Compare
|
Github, generate report |
52df831 to
264f9b7
Compare
was removed. as it was addressed in #17835 |
…sing underscores
|
basic implementation is merged |
part of #17507
Diff Regression config: https://gist.githubusercontent.com/mohitsatr/e1438c3d37ea33baff8301aec7ec41b9/raw/ba56786fff2506ff7b4cbcbcf5864c381fddfea7/master_mvf.xml
Diff Regression patch config: https://gist.githubusercontent.com/mohitsatr/5e2fed73f37698ca3ee316e5f42df083/raw/fa4947d416a2a1f47d05130148b5ad7f74dccd79/patch_mvf.xml