From f6cdf94094e6c4a4db5e53f3127a04eb3a3a61b1 Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Fri, 4 Oct 2024 12:53:06 +0200 Subject: [PATCH] Build: Forbid implicit case fall-through without a comment and enable couple more recommendable error-prone checks (#11251) * Forbid implicit case fall-through without a comment In ordinary switch statement, case branches implicitly fall-through to the next one. This is Java's C legacy. Forbid this unless intent is indicated in the code with a comment like `// fall through`. * Enable couple more recommendable error-prone checks --- baseline.gradle | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/baseline.gradle b/baseline.gradle index d29100aa3f..07889d4e34 100644 --- a/baseline.gradle +++ b/baseline.gradle @@ -83,6 +83,8 @@ subprojects { '-Xep:BadComparable:ERROR', '-Xep:BadInstanceof:ERROR', '-Xep:CatchFail:ERROR', + '-Xep:ClassCanBeStatic:ERROR', + '-Xep:ClassNewInstance:ERROR', '-Xep:CollectionUndefinedEquality:ERROR', // specific to Palantir - Uses name `log` but we use name `LOG` '-Xep:ConsistentLoggerName:OFF', @@ -95,8 +97,10 @@ subprojects { '-Xep:EqualsUnsafeCast:ERROR', '-Xep:EqualsUsingHashCode:ERROR', '-Xep:ExtendsObject:ERROR', + '-Xep:FallThrough:ERROR', // specific to Palantir '-Xep:FinalClass:OFF', + '-Xep:Finalize:ERROR', '-Xep:FormatStringAnnotation:ERROR', '-Xep:GetClassOnEnum:ERROR', '-Xep:HidingField:ERROR', @@ -146,10 +150,14 @@ subprojects { '-Xep:StringSplitter:ERROR', '-Xep:TypeParameterShadowing:OFF', '-Xep:TypeParameterUnusedInFormals:OFF', + '-Xep:UnicodeEscape:ERROR', // Palantir's UnnecessarilyQualified may throw during analysis '-Xep:UnnecessarilyQualified:OFF', + '-Xep:UnnecessaryLongToIntConversion:ERROR', + '-Xep:UnnecessaryMethodReference:ERROR', '-Xep:UnusedMethod:ERROR', '-Xep:UnusedVariable:ERROR', + '-Xep:UseEnumSwitch:ERROR', ) } }