IJPF-CR-21702 [java-inspection] IDEA-337700 Improvements for logging inspections

- fix text

GitOrigin-RevId: 18aaedbc0531f144ee819d22047d33a925ee9357
This commit is contained in:
Mikhail Pyltsin
2024-07-02 17:55:16 +02:00
committed by intellij-monorepo-bot
parent b4aa55737a
commit b88d49eb4c
3 changed files with 23 additions and 23 deletions

View File

@@ -174,8 +174,8 @@ jvm.inspection.log.statement.not.guarded.debug.level.and.lower.option=debug leve
jvm.inspection.log.statement.not.guarded.trace.level.option=trace level
jvm.inspection.log.statement.not.guarded.unguarded.constant.option=Process unguarded logging calls with constant messages
jvm.inspection.log.statement.not.guarded.unguarded.constant.option.comment=Process all unguarded log calls, not only those with non-constant arguments
jvm.inspection.log.statement.not.guarded.log.fix.family.name=Surround with log condition
jvm.inspection.log.statement.not.guarded.log.problem.descriptor=Logging call not guarded by log condition #loc
jvm.inspection.log.statement.not.guarded.log.fix.family.name=Surround with a logging condition
jvm.inspection.log.statement.not.guarded.log.problem.descriptor=Logging call not guarded by a logging condition #loc
jvm.inspection.log.guarded.display.name=Logging calls guarded by log condition
jvm.inspection.log.guarded.warn.if.fix.possible=Warn only if a fix is available

View File

@@ -12,7 +12,7 @@ class JavaLoggingStatementNotGuardedByLogConditionInspectionTest : LoggingStatem
class X {
private static final Logger LOG = LoggerFactory.getLogger(X.class);
void n(String arg) {
<warning descr="Logging call not guarded by log condition">LOG.debug("test" + arg)</warning>;
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test" + arg)</warning>;
}
}
""".trimIndent())
@@ -38,7 +38,7 @@ class JavaLoggingStatementNotGuardedByLogConditionInspectionTest : LoggingStatem
class X {
static final Logger LOG = LogManager.getLogger();
void n(String arg) {
<warning descr="Logging call not guarded by log condition">LOG.debug("test" + arg)</warning>;
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test" + arg)</warning>;
}
}
""".trimIndent())
@@ -81,7 +81,7 @@ class JavaLoggingStatementNotGuardedByLogConditionInspectionTest : LoggingStatem
}
if(LOG.isInfoEnabled()) {
<warning descr="Logging call not guarded by log condition">LOG.debug("test" + arg)</warning>; //todo!
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test" + arg)</warning>; //todo!
}
if(true && LOG.isDebugEnabled()) {
@@ -96,7 +96,7 @@ class JavaLoggingStatementNotGuardedByLogConditionInspectionTest : LoggingStatem
if(true) {
if(true) {
<warning descr="Logging call not guarded by log condition">LOG.debug("test" + arg)</warning>;
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test" + arg)</warning>;
}
}
}
@@ -143,10 +143,10 @@ class JavaLoggingStatementNotGuardedByLogConditionInspectionTest : LoggingStatem
class X {
private static final Logger LOG = LoggerFactory.getLogger(X.class);
void n1(String arg) {
<warning descr="Logging call not guarded by log condition">LOG.debug("test")</warning>;
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test")</warning>;
}
void n2(String arg) {
<warning descr="Logging call not guarded by log condition">LOG.debug("test")</warning>;
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test")</warning>;
}
}
""".trimIndent())
@@ -159,28 +159,28 @@ class JavaLoggingStatementNotGuardedByLogConditionInspectionTest : LoggingStatem
class X {
private static final Logger LOG = LoggerFactory.getLogger(X.class);
void n2(String arg) {
<warning descr="Logging call not guarded by log condition">LOG.debug("test1" + arg)</warning>;
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test1" + arg)</warning>;
LOG.debug("test2" + arg);
}
void n3(String arg) {
<warning descr="Logging call not guarded by log condition">LOG.debug("test1" + arg)</warning>;
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test1" + arg)</warning>;
LOG.debug("test2" + arg);
LOG.debug("test2" + arg);
}
void constantCall(String arg) {
LOG.debug("test1");
<warning descr="Logging call not guarded by log condition">LOG.debug("test2" + arg)</warning>;
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test2" + arg)</warning>;
}
void beforeNotLog(String arg) {
constantCall(arg);
<warning descr="Logging call not guarded by log condition">LOG.debug("test2" + arg)</warning>;
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test2" + arg)</warning>;
}
void differentLevels(String arg) {
<warning descr="Logging call not guarded by log condition">LOG.debug("test1" + arg)</warning>;
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test1" + arg)</warning>;
LOG.warn("test2" + arg);
}
}

View File

@@ -14,7 +14,7 @@ class KotlinLoggingStatementNotGuardedByLogConditionInspectionTest : LoggingStat
private val LOG = LoggerFactory.getLogger()
fun n(arg: String) {
<warning descr="Logging call not guarded by log condition">LOG.debug("test {}", arg)</warning>
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test {}", arg)</warning>
}
}
""".trimIndent())
@@ -27,7 +27,7 @@ class KotlinLoggingStatementNotGuardedByLogConditionInspectionTest : LoggingStat
internal class X {
fun n(arg: String) {
<warning descr="Logging call not guarded by log condition">LOG.debug("test {}", arg)</warning>
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test {}", arg)</warning>
}
companion object {
@@ -66,7 +66,7 @@ class KotlinLoggingStatementNotGuardedByLogConditionInspectionTest : LoggingStat
}
if (LOG.isInfoEnabled) {
<warning descr="Logging call not guarded by log condition">LOG.debug("test" + arg)</warning> //todo!
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test" + arg)</warning> //todo!
}
if (true && LOG.isDebugEnabled) {
@@ -112,11 +112,11 @@ class KotlinLoggingStatementNotGuardedByLogConditionInspectionTest : LoggingStat
internal class X {
fun n1() {
<warning descr="Logging call not guarded by log condition">LOG.debug("test")</warning>
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test")</warning>
}
fun n2() {
<warning descr="Logging call not guarded by log condition">LOG.debug("test")</warning>
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test")</warning>
}
companion object {
@@ -133,28 +133,28 @@ class KotlinLoggingStatementNotGuardedByLogConditionInspectionTest : LoggingStat
internal class X {
fun n2(arg: String) {
<warning descr="Logging call not guarded by log condition">LOG.debug("test1" + arg)</warning>
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test1" + arg)</warning>
LOG.debug("test2" + arg)
}
fun n3(arg: String) {
<warning descr="Logging call not guarded by log condition">LOG.debug("test1" + arg)</warning>
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test1" + arg)</warning>
LOG.debug("test2" + arg)
LOG.debug("test2" + arg)
}
fun constantCall(arg: String) {
LOG.debug("test1")
<warning descr="Logging call not guarded by log condition">LOG.debug("test2" + arg)</warning>
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test2" + arg)</warning>
}
fun beforeNotLog(arg: String) {
constantCall(arg)
<warning descr="Logging call not guarded by log condition">LOG.debug("test2" + arg)</warning>
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test2" + arg)</warning>
}
fun differentLevels(arg: String) {
<warning descr="Logging call not guarded by log condition">LOG.debug("test1" + arg)</warning>
<warning descr="Logging call not guarded by a logging condition">LOG.debug("test1" + arg)</warning>
LOG.warn("test2" + arg)
}