You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Many Java rules build complex messages that use information about the specific problem, eg to provide a suggested fix or an explanation. For instance UnnecessaryModifier, ApexDoc, LinguisticNaming. These rules use the method AbstractNode#addViolationWithMessage, which ignores Rule#getMessage.
In parallel, we document that it's supported to override the message from the ruleset.
I don't really see how that is a feature. Ideally rule messages should be informative and one should not want to replace them.
Message overriding doesn't work with the previously mentioned rules.
Another problem with the ability to override messages is that they make the rule configuration brittle. If we change the number of template parameters of a default rule message, a user overriding the message may see broken messages with unreplaced template variables.
Describe the solution you'd like Remove the ability to override the rule message in pmd 7.
Describe alternatives you've considered
Make addViolationWithMessage consider message override: this makes no sense. This overload is made to override the message from the rule implementation
Stop using addViolationWithMessage: then we'd lose something that actually helps building more helpful rule messages
Live with this and document which rules support messages and which don't: this is a big maintenance effort
Live with this like now: sounds like a bad idea to me...
Additional context
If anyone is using this feature please defend it
The only decent reason I could see to override violation messages is to translate them. But internationalization would be better done from pmd itself.
The text was updated successfully, but these errors were encountered:
oowekyala
added
the
a:RFC
A drafted proposal on changes to PMD, up for feedback form the team and community
label
May 15, 2021
Is your feature request related to a problem? Please describe.
Many Java rules build complex messages that use information about the specific problem, eg to provide a suggested fix or an explanation. For instance UnnecessaryModifier, ApexDoc, LinguisticNaming. These rules use the method
AbstractNode#addViolationWithMessage
, which ignoresRule#getMessage
.In parallel, we document that it's supported to override the message from the ruleset.
Describe the solution you'd like Remove the ability to override the rule message in pmd 7.
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: