Add EmptyLineSeparator Checkstyle rule

* Support "blank lines around" via `spring-framework.xml` IDEA config
* Fix all the Checkstyle violations
This commit is contained in:
Artem Bilan
2024-03-27 16:54:25 -04:00
parent f71a2234d8
commit c155d5d418
932 changed files with 1341 additions and 2485 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,7 +57,6 @@ public abstract class AbstractScriptExecutingMessageProcessor<T>
this.scriptVariableGenerator = scriptVariableGenerator;
}
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.beanClassLoader = classLoader;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,6 @@ public class DefaultScriptVariableGenerator implements ScriptVariableGenerator {
private final Map<String, Object> variableMap;
public DefaultScriptVariableGenerator() {
this.variableMap = Collections.<String, Object>emptyMap();
}
@@ -45,7 +44,6 @@ public class DefaultScriptVariableGenerator implements ScriptVariableGenerator {
this.variableMap = variableMap;
}
public Map<String, Object> generateScriptVariables(Message<?> message) {
Map<String, Object> scriptVariables = new HashMap<String, Object>();
// Add Message content

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,7 +43,6 @@ public class RefreshableResourceScriptSource implements ScriptSource {
private volatile String script;
public RefreshableResourceScriptSource(Resource resource, long refreshDelay) {
this.refreshDelay = refreshDelay;
this.source = new ResourceScriptSource(resource);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2019 the original author or authors.
* Copyright 2013-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,4 +44,5 @@ public class ScriptExecutingMessageSource extends AbstractMessageSource<Object>
protected Object doReceive() {
return this.scriptMessageProcessor.processMessage(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,8 +30,8 @@ public class ScriptingException extends MessagingException {
super(description);
}
public ScriptingException(String description, Throwable cause) {
super(description, cause);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 the original author or authors.
* Copyright 2016-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -99,7 +99,6 @@ class DslScriptExecutingMessageProcessor
this.script = this.applicationContext.getResource(this.location);
}
if (!StringUtils.hasText(this.lang)) {
String scriptFilename = this.script.getFilename();
Assert.hasText(scriptFilename,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 the original author or authors.
* Copyright 2016-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -125,7 +125,6 @@ public class ScriptSpec extends MessageProcessorSpec<ScriptSpec> {
return this;
}
@Override
protected MessageProcessor<?> doGet() {
if (this.variableGenerator == null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,11 +57,14 @@ public class PythonScriptExecutor extends AbstractScriptExecutor {
}
public static class PythonVariableParser {
public static String parseReturnVariable(String script) {
String[] lines = script.trim().split("\n");
String lastLine = lines[lines.length - 1];
String[] tokens = lastLine.split("=");
return tokens[0].trim();
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +42,6 @@ public class ScriptExecutingMessageProcessor extends AbstractScriptExecutingMess
private final ScriptSource scriptSource;
/**
* Create a processor for the {@link ScriptSource} using the provided
* {@link ScriptExecutor} using the DefaultScriptVariableGenerator
@@ -83,7 +82,6 @@ public class ScriptExecutingMessageProcessor extends AbstractScriptExecutingMess
this(scriptSource, new DefaultScriptVariableGenerator(variables), scriptExecutor);
}
@Override
protected ScriptSource getScriptSource(Message<?> message) {
return this.scriptSource;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,7 +44,6 @@ public class Jsr223FilterTests {
@Autowired
private MessageChannel inlineScriptInput;
@Test
public void referencedScript() {
QueueChannel replyChannel = new QueueChannel();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,10 +58,12 @@ public class Jsr223RefreshTests {
}
public static class ResourceEditor extends PropertyEditorSupport {
@Override
public void setAsText(String text) throws IllegalArgumentException {
super.setValue(new CycleResource());
}
}
private static class CycleResource extends AbstractResource {
@@ -98,4 +100,5 @@ public class Jsr223RefreshTests {
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,7 +55,6 @@ public class Jsr223RouterTests {
@Autowired
private QueueChannel shortStrings;
@AfterEach
void cleanUp() {
this.longStrings.clear();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,7 +43,6 @@ public class Jsr223SplitterTests {
@Autowired
private MessageChannel inlineScriptInput;
@Test
public void referencedScript() {
QueueChannel replyChannel = new QueueChannel();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,7 +53,6 @@ public class Jsr223TransformerTests {
@Autowired
private PollableChannel int3162OutputChannel;
@Test
public void referencedScript() {
QueueChannel replyChannel = new QueueChannel();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 the original author or authors.
* Copyright 2016-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -191,7 +191,6 @@ public class ScriptsTests {
.isEqualTo(5);
}
@Configuration
@EnableIntegration
public static class ContextConfiguration {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,7 +43,6 @@ public class PythonVariableParserTests {
var = PythonScriptExecutor.PythonVariableParser.parseReturnVariable("\n\n\nx\n\n\n");
}
@Test
public void test2() throws IOException {
ScriptSource source =
@@ -51,4 +50,5 @@ public class PythonVariableParserTests {
String var = PythonScriptExecutor.PythonVariableParser.parseReturnVariable(source.getScriptAsString());
assertThat(var).isEqualTo("bar");
}
}