I'm using CheckStyle to check curly bracket placement and generally want to enforce left curly brace being at the end of line with indenting following it. I have this working. e.g.
if (something_is_true) {
...
However, in the very specific case of logging statements, which I want to keep compact, I want to allow
if (log.isDebugEnabled()) { log.debug("my logging statement."); }
The name of the logger may change but generally the line will contain "isDebugEnabled". I don't want to use SuppressWarnings or otherwise be adding extra lines around the debug lines - I want them to not interfere with the view and the flow of the code.
Is there a way to suppress warnings via the checkstyle config file for lines which match a given pattern?
Thanks.
question from:
https://stackoverflow.com/questions/65944851/how-can-i-ignore-a-checkstyle-rule-for-a-line-matching-a-pattern-if-log-isdebu 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…