Description
While working on #19983 , we noticed that plain // ok comments are currently not reporting violations even though there is an UnnecessaryOkComment regexp check configured.
Current configuration:
<module name="TreeWalker">
...
<module name="Regexp">
<property name="id" value="UnnecessaryOkComment"/>
<property name="format"
value="(?i)\/\/\s*ok$"/>
<property name="illegalPattern" value="true"/>
<message key="illegal.regexp"
value="'// ok' comments should have an explanation, or they are unnecessary."/>
</module>
</module>
However, Regexp is a Checker-level module and not a TreeWalker module.
Because of this, the check does not appear to be applied, which is why existing plain // ok comments in input files (for example some ParenPad inputs) are currently not producing violations.
Expected Behavior
Plain comments like:
should report violations according to the configured regexp.
Proposed Fix
Move the Regexp module from under TreeWalker to the Checker level configuration so it is properly applied repository-wide.
Description
While working on #19983 , we noticed that plain
// okcomments are currently not reporting violations even though there is anUnnecessaryOkCommentregexp check configured.Current configuration:
However,
Regexpis a Checker-level module and not a TreeWalker module.Because of this, the check does not appear to be applied, which is why existing plain
// okcomments in input files (for example someParenPadinputs) are currently not producing violations.Expected Behavior
Plain comments like:
// okshould report violations according to the configured regexp.
Proposed Fix
Move the
Regexpmodule from underTreeWalkerto theCheckerlevel configuration so it is properly applied repository-wide.