Upgrade checkstyle; remove supressed indentation markers for new-style switches

This commit is contained in:
2024-05-17 16:38:28 -05:00
parent be69836b5b
commit 65fe6a002c
25 changed files with 58 additions and 84 deletions

View File

@ -150,7 +150,7 @@
<dependency> <dependency>
<groupId>com.puppycrawl.tools</groupId> <groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId> <artifactId>checkstyle</artifactId>
<version>9.0</version> <version>10.16.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
<executions> <executions>

View File

@ -127,7 +127,6 @@ public enum AutomationStatus implements PossibleValueEnum<Integer>
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:indentation")
public String getInsertOrUpdate() public String getInsertOrUpdate()
{ {
return switch(this) return switch(this)

View File

@ -50,10 +50,7 @@ public interface RecordCustomizerUtilityInterface
/******************************************************************************* /*******************************************************************************
** Container for an old value and a new value. ** Container for an old value and a new value.
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:MethodName") record Change(Serializable oldValue, Serializable newValue) {}
record Change(Serializable oldValue, Serializable newValue)
{
}
/******************************************************************************* /*******************************************************************************

View File

@ -256,7 +256,6 @@ public enum DateTimeGroupBy
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:indentation")
public Instant roundDown(Instant instant, ZoneId zoneId) public Instant roundDown(Instant instant, ZoneId zoneId)
{ {
ZonedDateTime zoned = instant.atZone(zoneId); ZonedDateTime zoned = instant.atZone(zoneId);

View File

@ -500,7 +500,6 @@ public class PermissionsHelper
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:indentation")
static PermissionSubType getEffectivePermissionSubType(QPermissionRules rules, PermissionSubType originalPermissionSubType) static PermissionSubType getEffectivePermissionSubType(QPermissionRules rules, PermissionSubType originalPermissionSubType)
{ {
if(rules == null || rules.getLevel() == null) if(rules == null || rules.getLevel() == null)

View File

@ -77,7 +77,6 @@ public class ExecuteCodeAction
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:indentation")
public void run(ExecuteCodeInput input, ExecuteCodeOutput output) throws QException, QCodeException public void run(ExecuteCodeInput input, ExecuteCodeOutput output) throws QException, QCodeException
{ {
QCodeReference codeReference = input.getCodeReference(); QCodeReference codeReference = input.getCodeReference();

View File

@ -390,7 +390,6 @@ public class ValidateRecordSecurityLockHelper
** MultiRecordSecurityLock, with only the appropriate lock-scopes being included ** MultiRecordSecurityLock, with only the appropriate lock-scopes being included
** (e.g., read-locks for selects, write-locks for insert/update/delete). ** (e.g., read-locks for selects, write-locks for insert/update/delete).
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:Indentation")
static MultiRecordSecurityLock getRecordSecurityLocks(QTableMetaData table, Action action) static MultiRecordSecurityLock getRecordSecurityLocks(QTableMetaData table, Action action)
{ {
List<RecordSecurityLock> allLocksOnTable = CollectionUtils.nonNullList(table.getRecordSecurityLocks()); List<RecordSecurityLock> allLocksOnTable = CollectionUtils.nonNullList(table.getRecordSecurityLocks());

View File

@ -118,6 +118,7 @@ public class QPossibleValueTranslator
} }
/******************************************************************************* /*******************************************************************************
** Constructor ** Constructor
** **
@ -421,7 +422,6 @@ public class QPossibleValueTranslator
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:Indentation")
private String doFormatPossibleValue(String formatString, List<String> valueFields, Object id, String label) private String doFormatPossibleValue(String formatString, List<String> valueFields, Object id, String label)
{ {
List<Object> values = new ArrayList<>(); List<Object> values = new ArrayList<>();

View File

@ -49,7 +49,6 @@ public interface DisplayFormat
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:Indentation")
static String getExcelFormat(String javaDisplayFormat) static String getExcelFormat(String javaDisplayFormat)
{ {
if(javaDisplayFormat == null) if(javaDisplayFormat == null)

View File

@ -44,7 +44,6 @@ public enum JoinType
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:indentation")
public JoinType flip() public JoinType flip()
{ {
return switch(this) return switch(this)

View File

@ -39,8 +39,11 @@ import com.kingsrook.qqq.backend.core.model.metadata.processes.QStepMetaData;
*******************************************************************************/ *******************************************************************************/
public class QStepMetaDataDeserializer extends JsonDeserializer<QStepMetaData> public class QStepMetaDataDeserializer extends JsonDeserializer<QStepMetaData>
{ {
/***************************************************************************
**
***************************************************************************/
@Override @Override
@SuppressWarnings("checkstyle:Indentation")
public QStepMetaData deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JacksonException public QStepMetaData deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JacksonException
{ {
TreeNode treeNode = jsonParser.readValueAsTree(); TreeNode treeNode = jsonParser.readValueAsTree();

View File

@ -769,7 +769,6 @@ public class MemoryRecordStore
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:indentation")
private static Serializable computeAggregate(List<QRecord> records, Aggregate aggregate, QTableMetaData table) private static Serializable computeAggregate(List<QRecord> records, Aggregate aggregate, QTableMetaData table)
{ {
String fieldName = aggregate.getFieldName(); String fieldName = aggregate.getFieldName();

View File

@ -38,7 +38,6 @@ public class MockCountAction implements CountInterface
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:MagicNumber")
public CountOutput execute(CountInput countInput) throws QException public CountOutput execute(CountInput countInput) throws QException
{ {
try try

View File

@ -95,10 +95,8 @@ public class MockQueryAction implements QueryInterface
** Get a mock value to use, based on its type. ** Get a mock value to use, based on its type.
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:MagicNumber")
public static Serializable getMockValue(QTableMetaData table, String field) public static Serializable getMockValue(QTableMetaData table, String field)
{ {
// @formatter:off // IJ can't do new-style switch correctly yet...
return switch(table.getField(field).getType()) return switch(table.getField(field).getType())
{ {
case STRING -> UUID.randomUUID().toString(); case STRING -> UUID.randomUUID().toString();
@ -112,7 +110,6 @@ public class MockQueryAction implements QueryInterface
case PASSWORD -> "abc***234"; case PASSWORD -> "abc***234";
default -> throw new IllegalStateException("Unexpected value: " + table.getField(field).getType()); default -> throw new IllegalStateException("Unexpected value: " + table.getField(field).getType());
}; };
// @formatter:on
} }
} }

View File

@ -134,7 +134,6 @@ public class BackendQueryFilterUtils
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:indentation")
public static boolean doesCriteriaMatch(QFilterCriteria criterion, String fieldName, Serializable value) public static boolean doesCriteriaMatch(QFilterCriteria criterion, String fieldName, Serializable value)
{ {
ListIterator<Serializable> valueListIterator = criterion.getValues().listIterator(); ListIterator<Serializable> valueListIterator = criterion.getValues().listIterator();

View File

@ -58,7 +58,6 @@ public class StreamedETLExecuteStep extends BaseStreamedETLStep implements Backe
** **
*******************************************************************************/ *******************************************************************************/
@Override @Override
@SuppressWarnings("checkstyle:indentation")
public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
{ {
Optional<QBackendTransaction> transaction = Optional.empty(); Optional<QBackendTransaction> transaction = Optional.empty();

View File

@ -793,7 +793,6 @@ public class ValueUtils
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:indentation")
public static Serializable getValueAsFieldType(QFieldType type, Object value) public static Serializable getValueAsFieldType(QFieldType type, Object value)
{ {
return switch(type) return switch(type)

View File

@ -195,7 +195,6 @@ public abstract class AbstractBaseFilesystemAction<FILE>
/******************************************************************************* /*******************************************************************************
** Generic implementation of the execute method from the QueryInterface ** Generic implementation of the execute method from the QueryInterface
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:Indentation")
public QueryOutput executeQuery(QueryInput queryInput) throws QException public QueryOutput executeQuery(QueryInput queryInput) throws QException
{ {
preAction(queryInput.getBackend()); preAction(queryInput.getBackend());

View File

@ -58,7 +58,6 @@ public class FilesystemTableMetaDataBuilder
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:Indentation")
public QTableMetaData buildStandardCardinalityOneTable() public QTableMetaData buildStandardCardinalityOneTable()
{ {
AbstractFilesystemTableBackendDetails tableBackendDetails = switch(backend.getBackendType()) AbstractFilesystemTableBackendDetails tableBackendDetails = switch(backend.getBackendType())

View File

@ -101,6 +101,7 @@ public class FilesystemImporterStep implements BackendStep
private Function<QRecord, Serializable> securitySupplier = null; private Function<QRecord, Serializable> securitySupplier = null;
/******************************************************************************* /*******************************************************************************
** Execute the step - using the request as input, and the result as output. ** Execute the step - using the request as input, and the result as output.
*******************************************************************************/ *******************************************************************************/
@ -373,7 +374,6 @@ public class FilesystemImporterStep implements BackendStep
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:Indentation")
List<QRecord> parseFileIntoRecords(RunBackendStepInput runBackendStepInput, String content) throws QException List<QRecord> parseFileIntoRecords(RunBackendStepInput runBackendStepInput, String content) throws QException
{ {
///////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -528,7 +528,6 @@ public class AbstractMongoDBAction
/******************************************************************************* /*******************************************************************************
** w/o considering security, just map a QQueryFilter to a Bson searchQuery. ** w/o considering security, just map a QQueryFilter to a Bson searchQuery.
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:Indentation")
private Bson makeSearchQueryDocumentWithoutSecurity(QTableMetaData table, QQueryFilter filter) private Bson makeSearchQueryDocumentWithoutSecurity(QTableMetaData table, QQueryFilter filter)
{ {
if(filter == null || !filter.hasAnyCriteria()) if(filter == null || !filter.hasAnyCriteria())

View File

@ -70,7 +70,6 @@ public class MongoDBAggregateAction extends AbstractMongoDBAction implements Agg
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:indentation")
public AggregateOutput execute(AggregateInput aggregateInput) throws QException public AggregateOutput execute(AggregateInput aggregateInput) throws QException
{ {
MongoClientContainer mongoClientContainer = null; MongoClientContainer mongoClientContainer = null;

View File

@ -1027,7 +1027,6 @@ public class GenerateOpenApiSpecAction extends AbstractQActionFunction<GenerateO
responses.putAll(buildStandardErrorResponses(apiInstanceMetaData)); responses.putAll(buildStandardErrorResponses(apiInstanceMetaData));
methodForProcess.withResponses(responses); methodForProcess.withResponses(responses);
@SuppressWarnings("checkstyle:indentation")
Path path = switch(apiProcessMetaData.getMethod()) Path path = switch(apiProcessMetaData.getMethod())
{ {
case GET -> new Path().withGet(methodForProcess); case GET -> new Path().withGet(methodForProcess);
@ -1555,7 +1554,6 @@ public class GenerateOpenApiSpecAction extends AbstractQActionFunction<GenerateO
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:indentation")
private Response buildMultiStatusResponse(String tableLabel, String primaryKeyApiName, QFieldMetaData primaryKeyField, String method) private Response buildMultiStatusResponse(String tableLabel, String primaryKeyApiName, QFieldMetaData primaryKeyField, String method)
{ {
List<Object> example = switch(method.toLowerCase()) List<Object> example = switch(method.toLowerCase())
@ -1713,7 +1711,6 @@ public class GenerateOpenApiSpecAction extends AbstractQActionFunction<GenerateO
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:indentation")
private static String getFieldType(QFieldType type) private static String getFieldType(QFieldType type)
{ {
return switch(type) return switch(type)
@ -1740,7 +1737,6 @@ public class GenerateOpenApiSpecAction extends AbstractQActionFunction<GenerateO
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:indentation")
private String getFieldFormat(QFieldType type) private String getFieldFormat(QFieldType type)
{ {
return switch(type) return switch(type)

View File

@ -298,7 +298,6 @@ public class QJavalinApiHandler
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@SuppressWarnings("checkstyle:indentation")
private void runProcess(Context context, QProcessMetaData processMetaData, ApiProcessMetaData apiProcessMetaData, ApiInstanceMetaData apiInstanceMetaData) private void runProcess(Context context, QProcessMetaData processMetaData, ApiProcessMetaData apiProcessMetaData, ApiInstanceMetaData apiInstanceMetaData)
{ {
String version = context.pathParam("version"); String version = context.pathParam("version");

View File

@ -233,7 +233,6 @@ public class ApiProcessSummaryListOutput implements ApiProcessOutputInterface
*******************************************************************************/ *******************************************************************************/
private static String getResultMapMessagePrefix(ProcessSummaryLineInterface processSummaryLine) private static String getResultMapMessagePrefix(ProcessSummaryLineInterface processSummaryLine)
{ {
@SuppressWarnings("checkstyle:indentation")
String messagePrefix = switch(processSummaryLine.getStatus()) String messagePrefix = switch(processSummaryLine.getStatus())
{ {
case OK, INFO, ERROR -> ""; case OK, INFO, ERROR -> "";
@ -251,7 +250,6 @@ public class ApiProcessSummaryListOutput implements ApiProcessOutputInterface
{ {
HashMap<String, Serializable> map = new HashMap<>(); HashMap<String, Serializable> map = new HashMap<>();
@SuppressWarnings("checkstyle:indentation")
HttpStatus.Code code = switch(processSummaryLine.getStatus()) HttpStatus.Code code = switch(processSummaryLine.getStatus())
{ {
case OK, WARNING, INFO -> HttpStatus.Code.OK; case OK, WARNING, INFO -> HttpStatus.Code.OK;