-
Notifications
You must be signed in to change notification settings - Fork 751
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
IdentifierName rejects m-failsafe-p default inclusion patterns #4832
Comments
I'm glad someone is unreasonably excited about style-violating identifier names. :) As you can probably imagine, we're not super motivated about adding carve-outs for the style guide that don't matter to Google internally. I quite like the idea of a regular expression flag to exempt certain names, though, if that would be useful to external users. I'd be happy to accept a PR. |
Occasionally, type names need to follow conventions that violate the styleguide without being able to rely on inheritance or annotations for exemption. For example, JMX MBean and MXBean definitions will routinely violate the styleguide, and outside the JDK, `maven-failsafe-plugin` 3.5.2's default filter is a set of 3 violating patterns. Suppressing these violations quickly becomes tedious. Rather than Whac-A-Mole'ing tolerated violations, define a new option whose value is a regex such that, if a possibly-violating type name matches that regex, the type name is allowed anyway. References: google#4776 References: google#4832
No doubt; and it can be pretty frustrating to be on the user side of fixed exemptions that don't include one's pet violation, too. Fortunately it was a lot easier to expose a regex option than I had guessed it would be; I have a preliminary suggestion in #4842. |
Occasionally, type names need to follow conventions that violate the styleguide without being able to rely on inheritance or annotations for exemption. For example, JMX MBean and MXBean definitions will routinely violate the styleguide, and outside the JDK, `maven-failsafe-plugin` 3.5.2's default filter is a set of 3 violating patterns. Suppressing these violations quickly becomes tedious. Rather than Whac-A-Mole'ing tolerated violations, define a new option whose value is a regex such that, if a possibly-violating type name matches that regex, the type name is allowed anyway. References: google#4776 References: google#4832
By default, the Maven Failsafe plugin relies on a set of file name patterns to determine which test classes to include. This is the
<includes>
option, and its default values are**/IT*.java
**/*IT.java
**/*ITCase.java
In v2.36.0, the
IdentifierName
check (which I'm unreasonably excited about!) accurately detects those names as being in violation.Unfortunately, for a user wishing to take advantage of Failsafe, working around this is a bit cumbersome; it seems they can...
<includes>
to any compliant non-default value, but that introduces non-standard behaviour for dubious reasons.-XepOpt:IdentifierName:AllowInitialismsInTypeName=true
, but actually, that allows a name likeXMLHTTPRequest
that is specifically called out as in violation, and incidentally, is exactly the sort of situations I see people struggle with the most.Every option is possible but all of them carry friction.
The behaviour I would most like to see is that
IdentifierName
automagically did not flag these cases so the defaults Just Work™. But Error Prone cannot know which arbitrary patterns I might have set in my own<includes>
, so any support for this is bound to be either inflexible or complex. Correspondingly, I would suggest thatIdentifierName
should at most allow Failsafe's default<includes>
valuesA more flexible approach is a new option,
-XepOpt:IdentifierName:MyBikeshed=*IT,*MXBean
, which passes a set of patterns toIdentifierName
to allow.See also #4776.
The text was updated successfully, but these errors were encountered: