What problem are you trying to solve?
Avoid noise. Currently WrapExpensiveLogStatementsInConditionals tends to offer excessive changes in some cases. I know it's hard to come up with good rules on what constitutes a heavy operation worth wrapping in an if and what doesn't.
But I still think the logic could be tuned a bit better with some heuristics.
E.g. this is an excessive change:
- project.getLogger().info("Creating build directory: {}", buildDir.getAbsolutePath());
+ if (project.getLogger().isInfoEnabled()) {
+ project.getLogger().info("Creating build directory: {}", buildDir.getAbsolutePath());
+ }
And there's plenty of similar ones.
Describe the solution you'd like
Maybe skip wrapping if all method calls in the expression are getters?
(which I know they could be expensive operations, but in most of the cases they are not)
What problem are you trying to solve?
Avoid noise. Currently
WrapExpensiveLogStatementsInConditionalstends to offer excessive changes in some cases. I know it's hard to come up with good rules on what constitutes a heavy operation worth wrapping in anifand what doesn't.But I still think the logic could be tuned a bit better with some heuristics.
E.g. this is an excessive change:
And there's plenty of similar ones.
Describe the solution you'd like
Maybe skip wrapping if all method calls in the expression are getters?
(which I know they could be expensive operations, but in most of the cases they are not)