diff --git a/pom.xml b/pom.xml index 110a80bb8..c023fa9d0 100644 --- a/pom.xml +++ b/pom.xml @@ -164,7 +164,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0 + 3.1.2 org.apache.maven.plugins @@ -176,7 +176,7 @@ com.diffplug.spotless spotless-maven-plugin - 2.36.0 + 2.38.0 @@ -212,7 +212,7 @@ org.apache.maven.plugins maven-source-plugin - 3.2.1 + 3.3.0 attach-sources diff --git a/sorald-api/pom.xml b/sorald-api/pom.xml index f72bf1eb7..9c1c7b1e0 100644 --- a/sorald-api/pom.xml +++ b/sorald-api/pom.xml @@ -100,7 +100,7 @@ org.apache.maven.plugins maven-assembly-plugin - 3.5.0 + 3.6.0 @@ -144,7 +144,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0 + 3.1.2 org.apache.maven.plugins @@ -181,7 +181,7 @@ com.diffplug.spotless spotless-maven-plugin - 2.36.0 + 2.38.0 @@ -217,7 +217,7 @@ org.apache.maven.plugins maven-source-plugin - 3.2.1 + 3.3.0 attach-sources diff --git a/sorald-api/src/main/java/sorald/api/ProcessorRepository.java b/sorald-api/src/main/java/sorald/api/ProcessorRepository.java index a95a6ca2a..c0a6ae56a 100644 --- a/sorald-api/src/main/java/sorald/api/ProcessorRepository.java +++ b/sorald-api/src/main/java/sorald/api/ProcessorRepository.java @@ -1,11 +1,9 @@ package sorald.api; -import sorald.processor.SoraldAbstractProcessor; - import java.util.List; - import javax.annotation.Nonnull; import javax.annotation.Nullable; +import sorald.processor.SoraldAbstractProcessor; /** * This interfaces describes a repository of processors. Each processor is a class that implements diff --git a/sorald-api/src/main/java/sorald/api/RuleRepository.java b/sorald-api/src/main/java/sorald/api/RuleRepository.java index 850bd96df..3a6ee03a1 100644 --- a/sorald-api/src/main/java/sorald/api/RuleRepository.java +++ b/sorald-api/src/main/java/sorald/api/RuleRepository.java @@ -1,11 +1,9 @@ package sorald.api; -import sorald.rule.IRuleType; -import sorald.rule.Rule; - import java.util.Collection; - import javax.annotation.Nonnull; +import sorald.rule.IRuleType; +import sorald.rule.Rule; /** * This class defines the interface for a repository of rules. It is used by Sorald to find all diff --git a/sorald-api/src/main/java/sorald/event/models/CrashEvent.java b/sorald-api/src/main/java/sorald/event/models/CrashEvent.java index 1a0e039b5..3857f19c6 100644 --- a/sorald-api/src/main/java/sorald/event/models/CrashEvent.java +++ b/sorald-api/src/main/java/sorald/event/models/CrashEvent.java @@ -1,10 +1,9 @@ package sorald.event.models; -import sorald.event.EventType; -import sorald.event.SoraldEvent; - import java.io.PrintWriter; import java.io.StringWriter; +import sorald.event.EventType; +import sorald.event.SoraldEvent; /** Event recording a crash. */ public class CrashEvent implements SoraldEvent { diff --git a/sorald-api/src/main/java/sorald/event/models/RepairEvent.java b/sorald-api/src/main/java/sorald/event/models/RepairEvent.java index 05e742576..8dc902aa8 100644 --- a/sorald-api/src/main/java/sorald/event/models/RepairEvent.java +++ b/sorald-api/src/main/java/sorald/event/models/RepairEvent.java @@ -3,7 +3,6 @@ import sorald.event.EventType; import sorald.event.SoraldEvent; import sorald.rule.RuleViolation; - import spoon.reflect.declaration.CtElement; /** diff --git a/sorald-api/src/main/java/sorald/processor/SoraldAbstractProcessor.java b/sorald-api/src/main/java/sorald/processor/SoraldAbstractProcessor.java index ec8fe796b..02ea65bb2 100644 --- a/sorald-api/src/main/java/sorald/processor/SoraldAbstractProcessor.java +++ b/sorald-api/src/main/java/sorald/processor/SoraldAbstractProcessor.java @@ -1,5 +1,11 @@ package sorald.processor; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import sorald.annotations.IncompleteProcessor; import sorald.annotations.ProcessorAnnotation; import sorald.event.EventHelper; @@ -7,17 +13,9 @@ import sorald.event.models.CrashEvent; import sorald.event.models.RepairEvent; import sorald.rule.RuleViolation; - import spoon.processing.AbstractProcessor; import spoon.reflect.declaration.CtElement; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; - /** superclass for all processors */ public abstract class SoraldAbstractProcessor extends AbstractProcessor { private int maxFixes = Integer.MAX_VALUE; diff --git a/sorald-api/src/main/java/sorald/rule/RuleViolation.java b/sorald-api/src/main/java/sorald/rule/RuleViolation.java index 8b1c6fdf8..b83362d2b 100644 --- a/sorald-api/src/main/java/sorald/rule/RuleViolation.java +++ b/sorald-api/src/main/java/sorald/rule/RuleViolation.java @@ -1,11 +1,10 @@ package sorald.rule; -import sorald.Constants; - import java.nio.file.Path; import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.Stream; +import sorald.Constants; /** Representation of a violation of some Sonar rule */ public abstract class RuleViolation implements Comparable { diff --git a/sorald-api/src/main/java/sorald/rule/StaticAnalyzer.java b/sorald-api/src/main/java/sorald/rule/StaticAnalyzer.java index 7beaf0241..3a92c441f 100644 --- a/sorald-api/src/main/java/sorald/rule/StaticAnalyzer.java +++ b/sorald-api/src/main/java/sorald/rule/StaticAnalyzer.java @@ -1,10 +1,9 @@ package sorald.rule; -import sorald.cli.CLIConfigForStaticAnalyzer; - import java.io.File; import java.util.Collection; import java.util.List; +import sorald.cli.CLIConfigForStaticAnalyzer; /** A static analyzer for Java source code */ public interface StaticAnalyzer { diff --git a/sorald/pom.xml b/sorald/pom.xml index 24681cec0..ac103a8be 100644 --- a/sorald/pom.xml +++ b/sorald/pom.xml @@ -129,7 +129,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.8.1 + 3.9.0 org.apache.maven.plugins @@ -180,7 +180,7 @@ org.apache.maven.plugins maven-assembly-plugin - 3.5.0 + 3.6.0 @@ -280,7 +280,7 @@ com.diffplug.spotless spotless-maven-plugin - 2.36.0 + 2.38.0 @@ -348,7 +348,7 @@ org.apache.maven.plugins maven-source-plugin - 3.2.1 + 3.3.0 attach-sources diff --git a/sorald/src/main/java/sorald/CodeGenerator.java b/sorald/src/main/java/sorald/CodeGenerator.java index eb4f2f5f2..832b80ace 100644 --- a/sorald/src/main/java/sorald/CodeGenerator.java +++ b/sorald/src/main/java/sorald/CodeGenerator.java @@ -1,11 +1,9 @@ package sorald; -import sorald.sonar.ProcessorsClassGenerator; - -import spoon.Launcher; - import java.nio.file.Path; import java.nio.file.Paths; +import sorald.sonar.ProcessorsClassGenerator; +import spoon.Launcher; /** Wrapper class for all (present and future) code generation in Sorald. */ public class CodeGenerator { diff --git a/sorald/src/main/java/sorald/FileUtils.java b/sorald/src/main/java/sorald/FileUtils.java index 613677740..6d1628bda 100644 --- a/sorald/src/main/java/sorald/FileUtils.java +++ b/sorald/src/main/java/sorald/FileUtils.java @@ -1,8 +1,5 @@ package sorald; -import org.json.JSONArray; -import org.json.JSONObject; - import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -13,6 +10,8 @@ import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.json.JSONArray; +import org.json.JSONObject; public class FileUtils { private FileUtils() {} diff --git a/sorald/src/main/java/sorald/Processors.java b/sorald/src/main/java/sorald/Processors.java index 903903b1b..ca27cc83a 100644 --- a/sorald/src/main/java/sorald/Processors.java +++ b/sorald/src/main/java/sorald/Processors.java @@ -1,14 +1,13 @@ package sorald; -import sorald.api.ProcessorRepository; -import sorald.processor.SoraldAbstractProcessor; - import java.util.Collection; import java.util.Comparator; import java.util.List; import java.util.Objects; import java.util.ServiceLoader; import java.util.stream.Collectors; +import sorald.api.ProcessorRepository; +import sorald.processor.SoraldAbstractProcessor; public class Processors { private Processors() {} diff --git a/sorald/src/main/java/sorald/Repair.java b/sorald/src/main/java/sorald/Repair.java index aba416bd7..6b1650328 100644 --- a/sorald/src/main/java/sorald/Repair.java +++ b/sorald/src/main/java/sorald/Repair.java @@ -1,5 +1,23 @@ package sorald; +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.IdentityHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.function.Function; +import java.util.function.Supplier; +import java.util.stream.Collectors; +import java.util.stream.Stream; import sorald.event.EventHelper; import sorald.event.EventType; import sorald.event.SoraldEventHandler; @@ -11,7 +29,6 @@ import sorald.segment.Node; import sorald.segment.SoraldTreeBuilderAlgorithm; import sorald.sonar.BestFitScanner; - import spoon.Launcher; import spoon.MavenLauncher; import spoon.compiler.Environment; @@ -31,25 +48,6 @@ import spoon.support.QueueProcessingManager; import spoon.support.sniper.SniperJavaPrettyPrinter; -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.IdentityHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.function.Function; -import java.util.function.Supplier; -import java.util.stream.Collectors; -import java.util.stream.Stream; - /** Class for repairing projects. */ public class Repair { private final SoraldConfig config; diff --git a/sorald/src/main/java/sorald/SelectiveForceImport.java b/sorald/src/main/java/sorald/SelectiveForceImport.java index 727c6d826..f9965d6b6 100644 --- a/sorald/src/main/java/sorald/SelectiveForceImport.java +++ b/sorald/src/main/java/sorald/SelectiveForceImport.java @@ -1,14 +1,13 @@ package sorald; -import spoon.reflect.path.CtRole; -import spoon.reflect.reference.CtTypeReference; -import spoon.reflect.visitor.ForceImportProcessor; -import spoon.reflect.visitor.LexicalScope; - import java.util.Collection; import java.util.Collections; import java.util.IdentityHashMap; import java.util.Set; +import spoon.reflect.path.CtRole; +import spoon.reflect.reference.CtTypeReference; +import spoon.reflect.visitor.ForceImportProcessor; +import spoon.reflect.visitor.LexicalScope; /** * Processor that force-imports type references only if they are not present in the excluded diff --git a/sorald/src/main/java/sorald/SoraldConfig.java b/sorald/src/main/java/sorald/SoraldConfig.java index 32b1ebc8d..e3de2b503 100644 --- a/sorald/src/main/java/sorald/SoraldConfig.java +++ b/sorald/src/main/java/sorald/SoraldConfig.java @@ -1,13 +1,12 @@ package sorald; -import sorald.cli.CLIConfigForStaticAnalyzer; -import sorald.rule.Rule; - import java.io.File; import java.nio.file.Paths; import java.util.List; import java.util.Map; import java.util.Optional; +import sorald.cli.CLIConfigForStaticAnalyzer; +import sorald.rule.Rule; /* All config settings of Sorald should be gathered here */ public class SoraldConfig implements CLIConfigForStaticAnalyzer { diff --git a/sorald/src/main/java/sorald/cli/BaseCommand.java b/sorald/src/main/java/sorald/cli/BaseCommand.java index ab261725e..bdb779683 100644 --- a/sorald/src/main/java/sorald/cli/BaseCommand.java +++ b/sorald/src/main/java/sorald/cli/BaseCommand.java @@ -1,5 +1,11 @@ package sorald.cli; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.Callable; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugins.annotations.Parameter; import org.codehaus.plexus.component.annotations.Component; @@ -7,18 +13,9 @@ import org.codehaus.plexus.component.configurator.ComponentConfigurator; import org.codehaus.plexus.component.configurator.converters.basic.AbstractBasicConverter; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; - import picocli.CommandLine; - import sorald.Constants; -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.Callable; - /** Base command containing the options in common for all Sorald subcommands. */ @CommandLine.Command() abstract class BaseCommand extends AbstractMojo implements Callable { diff --git a/sorald/src/main/java/sorald/cli/Cli.java b/sorald/src/main/java/sorald/cli/Cli.java index 3f61a92f9..3431a531a 100644 --- a/sorald/src/main/java/sorald/cli/Cli.java +++ b/sorald/src/main/java/sorald/cli/Cli.java @@ -1,8 +1,7 @@ package sorald.cli; -import picocli.CommandLine; - import java.util.concurrent.Callable; +import picocli.CommandLine; /** Class containing the CLI for Sorald. */ public class Cli { diff --git a/sorald/src/main/java/sorald/cli/MineCommand.java b/sorald/src/main/java/sorald/cli/MineCommand.java index 68c9d3874..5dcff101e 100644 --- a/sorald/src/main/java/sorald/cli/MineCommand.java +++ b/sorald/src/main/java/sorald/cli/MineCommand.java @@ -1,13 +1,16 @@ package sorald.cli; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.util.*; +import java.util.stream.Collectors; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.json.JSONObject; - import picocli.CommandLine; - import sorald.Constants; import sorald.FileUtils; import sorald.SoraldConfig; @@ -22,12 +25,6 @@ import sorald.sonar.SonarRuleType; import sorald.util.MavenUtils; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.util.*; -import java.util.stream.Collectors; - /** CLI Command for Sorald's mining functionality. */ @Mojo(name = Constants.MINE_COMMAND_NAME) @CommandLine.Command( diff --git a/sorald/src/main/java/sorald/cli/RealFileConverter.java b/sorald/src/main/java/sorald/cli/RealFileConverter.java index 8373ce4d7..4b2c40403 100644 --- a/sorald/src/main/java/sorald/cli/RealFileConverter.java +++ b/sorald/src/main/java/sorald/cli/RealFileConverter.java @@ -1,9 +1,8 @@ package sorald.cli; -import picocli.CommandLine; - import java.io.File; import java.nio.file.Paths; +import picocli.CommandLine; /** Converter that converts a String to a real file that's validated to exist in the file system. */ public class RealFileConverter implements CommandLine.ITypeConverter { diff --git a/sorald/src/main/java/sorald/cli/RepairCommand.java b/sorald/src/main/java/sorald/cli/RepairCommand.java index 3452c430a..aef0c2e42 100644 --- a/sorald/src/main/java/sorald/cli/RepairCommand.java +++ b/sorald/src/main/java/sorald/cli/RepairCommand.java @@ -1,13 +1,16 @@ package sorald.cli; +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.util.*; +import java.util.stream.Collectors; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.codehaus.plexus.component.configurator.converters.basic.AbstractBasicConverter; - import picocli.CommandLine; - import sorald.*; import sorald.event.EventHelper; import sorald.event.EventType; @@ -25,12 +28,6 @@ import sorald.sonar.SonarRule; import sorald.util.MavenUtils; -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.util.*; -import java.util.stream.Collectors; - /** The CLI command for the primary repair application. */ @Mojo(name = Constants.REPAIR_COMMAND_NAME) @CommandLine.Command( diff --git a/sorald/src/main/java/sorald/cli/SoraldVersionProvider.java b/sorald/src/main/java/sorald/cli/SoraldVersionProvider.java index 78404ea9c..63d924b90 100644 --- a/sorald/src/main/java/sorald/cli/SoraldVersionProvider.java +++ b/sorald/src/main/java/sorald/cli/SoraldVersionProvider.java @@ -1,13 +1,12 @@ package sorald.cli; -import picocli.CommandLine; - import java.io.IOException; import java.net.URL; import java.util.Enumeration; import java.util.jar.Attributes; import java.util.jar.JarException; import java.util.jar.Manifest; +import picocli.CommandLine; /** Class for providing the CLI with the current version. */ public class SoraldVersionProvider implements CommandLine.IVersionProvider { diff --git a/sorald/src/main/java/sorald/cli/SpecifiedViolation.java b/sorald/src/main/java/sorald/cli/SpecifiedViolation.java index f2cdd930c..f4db2a373 100644 --- a/sorald/src/main/java/sorald/cli/SpecifiedViolation.java +++ b/sorald/src/main/java/sorald/cli/SpecifiedViolation.java @@ -1,8 +1,7 @@ package sorald.cli; -import sorald.rule.RuleViolation; - import java.nio.file.Path; +import sorald.rule.RuleViolation; /** Rule violation specified from the CLI. */ class SpecifiedViolation extends RuleViolation { diff --git a/sorald/src/main/java/sorald/event/collectors/CompilationUnitCollector.java b/sorald/src/main/java/sorald/event/collectors/CompilationUnitCollector.java index a7c9cf9b9..8fbb1dd0a 100644 --- a/sorald/src/main/java/sorald/event/collectors/CompilationUnitCollector.java +++ b/sorald/src/main/java/sorald/event/collectors/CompilationUnitCollector.java @@ -2,20 +2,18 @@ import static sorald.support.IdentityHashSet.newIdentityHashSet; +import java.nio.file.Path; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; import sorald.event.EventType; import sorald.event.SoraldEvent; import sorald.event.SoraldEventHandler; import sorald.event.models.RepairEvent; - import spoon.reflect.declaration.CtCompilationUnit; import spoon.reflect.declaration.CtElement; import spoon.reflect.declaration.CtType; -import java.nio.file.Path; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - /** Event handler that collects compilation units that receive repairs. */ public class CompilationUnitCollector implements SoraldEventHandler { private final Map pathToCu = new HashMap<>(); diff --git a/sorald/src/main/java/sorald/event/collectors/MinerStatisticsCollector.java b/sorald/src/main/java/sorald/event/collectors/MinerStatisticsCollector.java index 916c0cb3b..f3df34a87 100644 --- a/sorald/src/main/java/sorald/event/collectors/MinerStatisticsCollector.java +++ b/sorald/src/main/java/sorald/event/collectors/MinerStatisticsCollector.java @@ -1,14 +1,13 @@ package sorald.event.collectors; +import java.util.*; +import java.util.stream.Collectors; import sorald.event.SoraldEvent; import sorald.event.SoraldEventHandler; import sorald.event.models.WarningLocation; import sorald.event.models.miner.MinedRule; import sorald.event.models.miner.MinedViolationEvent; -import java.util.*; -import java.util.stream.Collectors; - /** Event handler for recording the miner mode statistics. */ public class MinerStatisticsCollector implements SoraldEventHandler { private static final String RULE_ID_SEPARATOR = ":"; diff --git a/sorald/src/main/java/sorald/event/collectors/RepairStatisticsCollector.java b/sorald/src/main/java/sorald/event/collectors/RepairStatisticsCollector.java index babe81283..44a4baac5 100644 --- a/sorald/src/main/java/sorald/event/collectors/RepairStatisticsCollector.java +++ b/sorald/src/main/java/sorald/event/collectors/RepairStatisticsCollector.java @@ -1,15 +1,14 @@ package sorald.event.collectors; -import sorald.event.SoraldEvent; -import sorald.event.SoraldEventHandler; -import sorald.event.models.RepairEvent; -import sorald.event.models.miner.MinedViolationEvent; - import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import sorald.event.SoraldEvent; +import sorald.event.SoraldEventHandler; +import sorald.event.models.RepairEvent; +import sorald.event.models.miner.MinedViolationEvent; /** * Event handler for Sorald that collects runtime statistics during execution of the repair command. diff --git a/sorald/src/main/java/sorald/event/models/WarningLocation.java b/sorald/src/main/java/sorald/event/models/WarningLocation.java index b13ddb2d5..a943c6759 100644 --- a/sorald/src/main/java/sorald/event/models/WarningLocation.java +++ b/sorald/src/main/java/sorald/event/models/WarningLocation.java @@ -1,8 +1,7 @@ package sorald.event.models; -import sorald.rule.RuleViolation; - import java.nio.file.Path; +import sorald.rule.RuleViolation; public class WarningLocation { private final String filePath; diff --git a/sorald/src/main/java/sorald/event/models/miner/MinedRule.java b/sorald/src/main/java/sorald/event/models/miner/MinedRule.java index 920ee0653..90e04ca2d 100644 --- a/sorald/src/main/java/sorald/event/models/miner/MinedRule.java +++ b/sorald/src/main/java/sorald/event/models/miner/MinedRule.java @@ -1,8 +1,7 @@ package sorald.event.models.miner; -import sorald.event.models.WarningLocation; - import java.util.List; +import sorald.event.models.WarningLocation; public class MinedRule { private final String ruleKey; diff --git a/sorald/src/main/java/sorald/event/models/miner/MinedViolationEvent.java b/sorald/src/main/java/sorald/event/models/miner/MinedViolationEvent.java index 3e6420bdd..8f5ea61cd 100644 --- a/sorald/src/main/java/sorald/event/models/miner/MinedViolationEvent.java +++ b/sorald/src/main/java/sorald/event/models/miner/MinedViolationEvent.java @@ -1,13 +1,12 @@ package sorald.event.models.miner; +import java.nio.file.Path; import sorald.event.EventType; import sorald.event.SoraldEvent; import sorald.event.models.WarningLocation; import sorald.rule.RuleViolation; import sorald.sonar.SonarRule; -import java.nio.file.Path; - /** Event representing a mined rule information */ public class MinedViolationEvent implements SoraldEvent { private final String ruleKey; diff --git a/sorald/src/main/java/sorald/event/models/repair/RuleRepairStatistics.java b/sorald/src/main/java/sorald/event/models/repair/RuleRepairStatistics.java index 9ccb9678b..8c96a5dbb 100644 --- a/sorald/src/main/java/sorald/event/models/repair/RuleRepairStatistics.java +++ b/sorald/src/main/java/sorald/event/models/repair/RuleRepairStatistics.java @@ -1,11 +1,5 @@ package sorald.event.models.repair; -import sorald.event.collectors.RepairStatisticsCollector; -import sorald.event.models.RepairEvent; -import sorald.event.models.WarningLocation; -import sorald.event.models.miner.MinedViolationEvent; -import sorald.sonar.SonarRule; - import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; @@ -14,6 +8,11 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; +import sorald.event.collectors.RepairStatisticsCollector; +import sorald.event.models.RepairEvent; +import sorald.event.models.WarningLocation; +import sorald.event.models.miner.MinedViolationEvent; +import sorald.sonar.SonarRule; /** Repair statistics for a single rule. */ public class RuleRepairStatistics { diff --git a/sorald/src/main/java/sorald/miner/MineSonarWarnings.java b/sorald/src/main/java/sorald/miner/MineSonarWarnings.java index e11e93909..5a7755bf1 100644 --- a/sorald/src/main/java/sorald/miner/MineSonarWarnings.java +++ b/sorald/src/main/java/sorald/miner/MineSonarWarnings.java @@ -1,7 +1,10 @@ package sorald.miner; +import java.io.*; +import java.nio.file.Paths; +import java.util.*; +import java.util.function.Consumer; import org.eclipse.jgit.api.Git; - import sorald.FileUtils; import sorald.cli.CLIConfigForStaticAnalyzer; import sorald.event.EventHelper; @@ -13,11 +16,6 @@ import sorald.sonar.ProjectScanner; import sorald.sonar.SonarRule; -import java.io.*; -import java.nio.file.Paths; -import java.util.*; -import java.util.function.Consumer; - public class MineSonarWarnings { final List eventHandlers; private final CLIConfigForStaticAnalyzer cliOptions; diff --git a/sorald/src/main/java/sorald/miner/StatsOutputAnalyzer.java b/sorald/src/main/java/sorald/miner/StatsOutputAnalyzer.java index 41dc77296..460597ac7 100644 --- a/sorald/src/main/java/sorald/miner/StatsOutputAnalyzer.java +++ b/sorald/src/main/java/sorald/miner/StatsOutputAnalyzer.java @@ -1,13 +1,12 @@ package sorald.miner; -import sorald.Constants; - import java.io.File; import java.io.IOException; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Scanner; +import sorald.Constants; public class StatsOutputAnalyzer { public static void main(String[] args) throws IOException { diff --git a/sorald/src/main/java/sorald/processor/ArrayHashCodeAndToStringProcessor.java b/sorald/src/main/java/sorald/processor/ArrayHashCodeAndToStringProcessor.java index d875630f8..666e43f7c 100644 --- a/sorald/src/main/java/sorald/processor/ArrayHashCodeAndToStringProcessor.java +++ b/sorald/src/main/java/sorald/processor/ArrayHashCodeAndToStringProcessor.java @@ -1,8 +1,8 @@ package sorald.processor; +import java.util.Arrays; import sorald.Constants; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtExpression; import spoon.reflect.code.CtInvocation; import spoon.reflect.code.CtTypeAccess; @@ -10,8 +10,6 @@ import spoon.reflect.declaration.CtMethod; import spoon.reflect.reference.CtExecutableReference; -import java.util.Arrays; - @ProcessorAnnotation( key = "S2116", description = "\"hashCode\" and \"toString\" should not be called on array instances") diff --git a/sorald/src/main/java/sorald/processor/BigDecimalDoubleConstructorProcessor.java b/sorald/src/main/java/sorald/processor/BigDecimalDoubleConstructorProcessor.java index 198105a73..f03784170 100644 --- a/sorald/src/main/java/sorald/processor/BigDecimalDoubleConstructorProcessor.java +++ b/sorald/src/main/java/sorald/processor/BigDecimalDoubleConstructorProcessor.java @@ -1,14 +1,12 @@ package sorald.processor; +import java.math.BigDecimal; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.*; import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.CtType; import spoon.reflect.reference.CtExecutableReference; -import java.math.BigDecimal; - @ProcessorAnnotation(key = "S2111", description = "\"BigDecimal(double)\" should not be used") public class BigDecimalDoubleConstructorProcessor extends SoraldAbstractProcessor { diff --git a/sorald/src/main/java/sorald/processor/CastArithmeticOperandProcessor.java b/sorald/src/main/java/sorald/processor/CastArithmeticOperandProcessor.java index 31d0fdab9..6f8c4b051 100644 --- a/sorald/src/main/java/sorald/processor/CastArithmeticOperandProcessor.java +++ b/sorald/src/main/java/sorald/processor/CastArithmeticOperandProcessor.java @@ -1,22 +1,19 @@ package sorald.processor; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.apache.commons.lang3.tuple.Pair; - import sorald.Constants; import sorald.annotations.ProcessorAnnotation; import sorald.rule.RuleViolation; - import spoon.reflect.code.*; import spoon.reflect.factory.TypeFactory; import spoon.reflect.reference.CtTypeReference; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; - @ProcessorAnnotation(key = "S2184", description = "Math operands should be cast before assignment") public class CastArithmeticOperandProcessor extends SoraldAbstractProcessor { diff --git a/sorald/src/main/java/sorald/processor/CollectionIsEmptyProcessor.java b/sorald/src/main/java/sorald/processor/CollectionIsEmptyProcessor.java index 8a265db45..e63207c35 100644 --- a/sorald/src/main/java/sorald/processor/CollectionIsEmptyProcessor.java +++ b/sorald/src/main/java/sorald/processor/CollectionIsEmptyProcessor.java @@ -2,14 +2,12 @@ import static sorald.util.Transformations.not; +import java.util.Collection; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.*; import spoon.reflect.declaration.CtMethod; import spoon.reflect.factory.Factory; -import java.util.Collection; - @ProcessorAnnotation( key = "S1155", description = "Collection.isEmpty() should be used to test for emptiness") diff --git a/sorald/src/main/java/sorald/processor/CollectionsEmptyConstantsProcessor.java b/sorald/src/main/java/sorald/processor/CollectionsEmptyConstantsProcessor.java index 91583e4eb..e291aca69 100644 --- a/sorald/src/main/java/sorald/processor/CollectionsEmptyConstantsProcessor.java +++ b/sorald/src/main/java/sorald/processor/CollectionsEmptyConstantsProcessor.java @@ -2,13 +2,11 @@ import static org.apache.commons.lang3.StringUtils.capitalize; +import java.util.Collections; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.*; import spoon.reflect.declaration.CtMethod; -import java.util.Collections; - @ProcessorAnnotation( key = "S1596", description = diff --git a/sorald/src/main/java/sorald/processor/CompareStringsBoxedTypesWithEqualsProcessor.java b/sorald/src/main/java/sorald/processor/CompareStringsBoxedTypesWithEqualsProcessor.java index a3a7d13ae..1a5583fe0 100644 --- a/sorald/src/main/java/sorald/processor/CompareStringsBoxedTypesWithEqualsProcessor.java +++ b/sorald/src/main/java/sorald/processor/CompareStringsBoxedTypesWithEqualsProcessor.java @@ -3,7 +3,6 @@ import static sorald.util.Transformations.not; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.BinaryOperatorKind; import spoon.reflect.code.CtBinaryOperator; import spoon.reflect.code.CtExpression; diff --git a/sorald/src/main/java/sorald/processor/CompareToReturnValueProcessor.java b/sorald/src/main/java/sorald/processor/CompareToReturnValueProcessor.java index ce8369024..17e59b533 100644 --- a/sorald/src/main/java/sorald/processor/CompareToReturnValueProcessor.java +++ b/sorald/src/main/java/sorald/processor/CompareToReturnValueProcessor.java @@ -1,7 +1,6 @@ package sorald.processor; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtLiteral; import spoon.reflect.code.CtReturn; diff --git a/sorald/src/main/java/sorald/processor/DeadStoreProcessor.java b/sorald/src/main/java/sorald/processor/DeadStoreProcessor.java index e98ebfaaf..55586d3e5 100644 --- a/sorald/src/main/java/sorald/processor/DeadStoreProcessor.java +++ b/sorald/src/main/java/sorald/processor/DeadStoreProcessor.java @@ -1,7 +1,11 @@ package sorald.processor; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtAssignment; import spoon.reflect.code.CtInvocation; import spoon.reflect.code.CtLocalVariable; @@ -21,12 +25,6 @@ import spoon.reflect.reference.CtVariableReference; import spoon.reflect.visitor.Filter; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; - @ProcessorAnnotation(key = "S1854", description = "Unused assignments should be removed") public class DeadStoreProcessor extends SoraldAbstractProcessor { diff --git a/sorald/src/main/java/sorald/processor/EqualsArgumentTypeProcessor.java b/sorald/src/main/java/sorald/processor/EqualsArgumentTypeProcessor.java index db6f82cd7..44a2a091d 100644 --- a/sorald/src/main/java/sorald/processor/EqualsArgumentTypeProcessor.java +++ b/sorald/src/main/java/sorald/processor/EqualsArgumentTypeProcessor.java @@ -1,7 +1,6 @@ package sorald.processor; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtExpression; import spoon.reflect.code.CtIf; import spoon.reflect.code.CtReturn; diff --git a/sorald/src/main/java/sorald/processor/EqualsOnAtomicClassProcessor.java b/sorald/src/main/java/sorald/processor/EqualsOnAtomicClassProcessor.java index 3243fc1d9..28bbe16e9 100644 --- a/sorald/src/main/java/sorald/processor/EqualsOnAtomicClassProcessor.java +++ b/sorald/src/main/java/sorald/processor/EqualsOnAtomicClassProcessor.java @@ -1,7 +1,9 @@ package sorald.processor; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.BinaryOperatorKind; import spoon.reflect.code.CtBinaryOperator; import spoon.reflect.code.CtExpression; @@ -10,10 +12,6 @@ import spoon.reflect.declaration.CtType; import spoon.reflect.reference.CtExecutableReference; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; - @ProcessorAnnotation( key = "S2204", description = "\".equals()\" should not be used to test the values of \"Atomic\" classes") diff --git a/sorald/src/main/java/sorald/processor/GetClassLoaderProcessor.java b/sorald/src/main/java/sorald/processor/GetClassLoaderProcessor.java index c67358257..0d9cb82bb 100644 --- a/sorald/src/main/java/sorald/processor/GetClassLoaderProcessor.java +++ b/sorald/src/main/java/sorald/processor/GetClassLoaderProcessor.java @@ -1,15 +1,13 @@ package sorald.processor; +import java.util.HashMap; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtInvocation; import spoon.reflect.code.CtTypeAccess; import spoon.reflect.declaration.CtClass; import spoon.reflect.declaration.CtMethod; import spoon.reflect.factory.Factory; -import java.util.HashMap; - @ProcessorAnnotation(key = "S3032", description = "JEE applications should not \"getClassLoader\"") public class GetClassLoaderProcessor extends SoraldAbstractProcessor> { private HashMap hashCodesOfTypesUsingJEE = new HashMap(); diff --git a/sorald/src/main/java/sorald/processor/InterruptedExceptionProcessor.java b/sorald/src/main/java/sorald/processor/InterruptedExceptionProcessor.java index daf616583..960d04ebe 100644 --- a/sorald/src/main/java/sorald/processor/InterruptedExceptionProcessor.java +++ b/sorald/src/main/java/sorald/processor/InterruptedExceptionProcessor.java @@ -1,7 +1,7 @@ package sorald.processor; +import java.util.Set; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtBlock; import spoon.reflect.code.CtCatch; import spoon.reflect.code.CtCatchVariable; @@ -17,8 +17,6 @@ import spoon.reflect.factory.Factory; import spoon.reflect.reference.CtTypeReference; -import java.util.Set; - @ProcessorAnnotation(key = "S2142", description = "\"InterruptedException\" should not be ignored") public class InterruptedExceptionProcessor extends SoraldAbstractProcessor { diff --git a/sorald/src/main/java/sorald/processor/IteratorNextExceptionProcessor.java b/sorald/src/main/java/sorald/processor/IteratorNextExceptionProcessor.java index 8f526027e..8e56e2512 100644 --- a/sorald/src/main/java/sorald/processor/IteratorNextExceptionProcessor.java +++ b/sorald/src/main/java/sorald/processor/IteratorNextExceptionProcessor.java @@ -1,7 +1,7 @@ package sorald.processor; +import java.util.NoSuchElementException; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtBlock; import spoon.reflect.code.CtCodeSnippetExpression; import spoon.reflect.code.CtExpression; @@ -10,8 +10,6 @@ import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.CtType; -import java.util.NoSuchElementException; - @ProcessorAnnotation( key = "S2272", description = "\"Iterator.next()\" methods should throw \"NoSuchElementException\"") diff --git a/sorald/src/main/java/sorald/processor/MathOnFloatProcessor.java b/sorald/src/main/java/sorald/processor/MathOnFloatProcessor.java index 5dded349a..72b643f78 100644 --- a/sorald/src/main/java/sorald/processor/MathOnFloatProcessor.java +++ b/sorald/src/main/java/sorald/processor/MathOnFloatProcessor.java @@ -1,14 +1,12 @@ package sorald.processor; +import java.util.List; import sorald.annotations.IncompleteProcessor; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtBinaryOperator; import spoon.reflect.declaration.CtTypedElement; import spoon.reflect.visitor.filter.TypeFilter; -import java.util.List; - @IncompleteProcessor( description = "does not cast the operands to double when the expected type of the result is float.") diff --git a/sorald/src/main/java/sorald/processor/PublicStaticFieldShouldBeFinalProcessor.java b/sorald/src/main/java/sorald/processor/PublicStaticFieldShouldBeFinalProcessor.java index 317352540..154d9b29c 100644 --- a/sorald/src/main/java/sorald/processor/PublicStaticFieldShouldBeFinalProcessor.java +++ b/sorald/src/main/java/sorald/processor/PublicStaticFieldShouldBeFinalProcessor.java @@ -2,7 +2,6 @@ import sorald.annotations.IncompleteProcessor; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.declaration.CtField; import spoon.reflect.declaration.ModifierKind; diff --git a/sorald/src/main/java/sorald/processor/SelfAssignementProcessor.java b/sorald/src/main/java/sorald/processor/SelfAssignementProcessor.java index 9659e160b..6441e3943 100644 --- a/sorald/src/main/java/sorald/processor/SelfAssignementProcessor.java +++ b/sorald/src/main/java/sorald/processor/SelfAssignementProcessor.java @@ -1,7 +1,6 @@ package sorald.processor; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtArrayAccess; import spoon.reflect.code.CtAssignment; import spoon.reflect.code.CtExpression; diff --git a/sorald/src/main/java/sorald/processor/SerialVersionUidProcessor.java b/sorald/src/main/java/sorald/processor/SerialVersionUidProcessor.java index 6d3cd0363..c6fe9e514 100644 --- a/sorald/src/main/java/sorald/processor/SerialVersionUidProcessor.java +++ b/sorald/src/main/java/sorald/processor/SerialVersionUidProcessor.java @@ -1,8 +1,8 @@ package sorald.processor; +import java.util.Set; import sorald.annotations.IncompleteProcessor; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtExpression; import spoon.reflect.declaration.CtClass; import spoon.reflect.declaration.CtElement; @@ -10,8 +10,6 @@ import spoon.reflect.declaration.ModifierKind; import spoon.reflect.reference.CtTypeReference; -import java.util.Set; - @IncompleteProcessor( description = "This processor does not address the case where the class already has a serialVersionUID with a non long type.") diff --git a/sorald/src/main/java/sorald/processor/SerializableFieldInSerializableClassProcessor.java b/sorald/src/main/java/sorald/processor/SerializableFieldInSerializableClassProcessor.java index 54352cd73..6f67551b9 100644 --- a/sorald/src/main/java/sorald/processor/SerializableFieldInSerializableClassProcessor.java +++ b/sorald/src/main/java/sorald/processor/SerializableFieldInSerializableClassProcessor.java @@ -1,7 +1,6 @@ package sorald.processor; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.declaration.CtField; import spoon.reflect.declaration.ModifierKind; diff --git a/sorald/src/main/java/sorald/processor/StringLiteralInsideEqualsProcessor.java b/sorald/src/main/java/sorald/processor/StringLiteralInsideEqualsProcessor.java index 1dc4f7f83..2aacbac05 100644 --- a/sorald/src/main/java/sorald/processor/StringLiteralInsideEqualsProcessor.java +++ b/sorald/src/main/java/sorald/processor/StringLiteralInsideEqualsProcessor.java @@ -1,7 +1,6 @@ package sorald.processor; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.BinaryOperatorKind; import spoon.reflect.code.CtBinaryOperator; import spoon.reflect.code.CtExpression; diff --git a/sorald/src/main/java/sorald/processor/SynchronizationOnGetClassProcessor.java b/sorald/src/main/java/sorald/processor/SynchronizationOnGetClassProcessor.java index 0a9a1b7f2..b4c2ad90f 100644 --- a/sorald/src/main/java/sorald/processor/SynchronizationOnGetClassProcessor.java +++ b/sorald/src/main/java/sorald/processor/SynchronizationOnGetClassProcessor.java @@ -1,7 +1,6 @@ package sorald.processor; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtExpression; import spoon.reflect.code.CtFieldAccess; import spoon.reflect.code.CtInvocation; diff --git a/sorald/src/main/java/sorald/processor/SynchronizationOnStringOrBoxedProcessor.java b/sorald/src/main/java/sorald/processor/SynchronizationOnStringOrBoxedProcessor.java index 53f82c2a1..53bf72e6b 100644 --- a/sorald/src/main/java/sorald/processor/SynchronizationOnStringOrBoxedProcessor.java +++ b/sorald/src/main/java/sorald/processor/SynchronizationOnStringOrBoxedProcessor.java @@ -1,7 +1,8 @@ package sorald.processor; +import java.util.HashMap; +import java.util.Map; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtExpression; import spoon.reflect.code.CtFieldRead; import spoon.reflect.code.CtInvocation; @@ -17,9 +18,6 @@ import spoon.reflect.reference.CtVariableReference; import spoon.reflect.visitor.filter.TypeFilter; -import java.util.HashMap; -import java.util.Map; - @ProcessorAnnotation( key = "S1860", description = "Synchronization should not be based on Strings or boxed primitives") diff --git a/sorald/src/main/java/sorald/processor/ThreadLocalWithInitial.java b/sorald/src/main/java/sorald/processor/ThreadLocalWithInitial.java index 4a15204f0..8eb63b985 100644 --- a/sorald/src/main/java/sorald/processor/ThreadLocalWithInitial.java +++ b/sorald/src/main/java/sorald/processor/ThreadLocalWithInitial.java @@ -1,7 +1,8 @@ package sorald.processor; +import java.util.List; +import java.util.function.Supplier; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtExpression; import spoon.reflect.code.CtInvocation; import spoon.reflect.code.CtLambda; @@ -13,9 +14,6 @@ import spoon.reflect.reference.CtExecutableReference; import spoon.reflect.reference.CtTypeReference; -import java.util.List; -import java.util.function.Supplier; - @ProcessorAnnotation(key = "S4065", description = "\"ThreadLocal.withInitial\" should be preferred") public class ThreadLocalWithInitial extends SoraldAbstractProcessor> { diff --git a/sorald/src/main/java/sorald/processor/ThreadRunProcessor.java b/sorald/src/main/java/sorald/processor/ThreadRunProcessor.java index 6e30fe9e8..e0205dcff 100644 --- a/sorald/src/main/java/sorald/processor/ThreadRunProcessor.java +++ b/sorald/src/main/java/sorald/processor/ThreadRunProcessor.java @@ -1,7 +1,6 @@ package sorald.processor; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtInvocation; import spoon.reflect.declaration.CtClass; import spoon.reflect.declaration.CtMethod; diff --git a/sorald/src/main/java/sorald/processor/ToStringReturningNullProcessor.java b/sorald/src/main/java/sorald/processor/ToStringReturningNullProcessor.java index 51c8ab094..2b81b1123 100644 --- a/sorald/src/main/java/sorald/processor/ToStringReturningNullProcessor.java +++ b/sorald/src/main/java/sorald/processor/ToStringReturningNullProcessor.java @@ -3,7 +3,6 @@ import sorald.Constants; import sorald.annotations.IncompleteProcessor; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtReturn; import spoon.reflect.declaration.CtMethod; diff --git a/sorald/src/main/java/sorald/processor/UnclosedResourcesProcessor.java b/sorald/src/main/java/sorald/processor/UnclosedResourcesProcessor.java index dfe0373c1..308010b44 100644 --- a/sorald/src/main/java/sorald/processor/UnclosedResourcesProcessor.java +++ b/sorald/src/main/java/sorald/processor/UnclosedResourcesProcessor.java @@ -1,7 +1,9 @@ package sorald.processor; +import java.util.List; +import java.util.Objects; +import java.util.stream.Stream; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtAssignment; import spoon.reflect.code.CtBlock; import spoon.reflect.code.CtCatch; @@ -16,10 +18,6 @@ import spoon.reflect.reference.CtLocalVariableReference; import spoon.reflect.reference.CtVariableReference; -import java.util.List; -import java.util.Objects; -import java.util.stream.Stream; - @ProcessorAnnotation(key = "S2095", description = "Resources should be closed") public class UnclosedResourcesProcessor extends SoraldAbstractProcessor> { diff --git a/sorald/src/main/java/sorald/processor/UnusedLocalVariableProcessor.java b/sorald/src/main/java/sorald/processor/UnusedLocalVariableProcessor.java index e1e4253f9..b9fe1737e 100644 --- a/sorald/src/main/java/sorald/processor/UnusedLocalVariableProcessor.java +++ b/sorald/src/main/java/sorald/processor/UnusedLocalVariableProcessor.java @@ -1,7 +1,6 @@ package sorald.processor; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtExpression; import spoon.reflect.code.CtFor; import spoon.reflect.code.CtForEach; diff --git a/sorald/src/main/java/sorald/processor/UnusedPrivateFieldProcessor.java b/sorald/src/main/java/sorald/processor/UnusedPrivateFieldProcessor.java index 9ba913fa9..6c55525aa 100644 --- a/sorald/src/main/java/sorald/processor/UnusedPrivateFieldProcessor.java +++ b/sorald/src/main/java/sorald/processor/UnusedPrivateFieldProcessor.java @@ -1,16 +1,14 @@ package sorald.processor; +import java.util.List; +import java.util.stream.Collectors; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtFieldWrite; import spoon.reflect.code.CtStatement; import spoon.reflect.declaration.CtClass; import spoon.reflect.declaration.CtField; import spoon.reflect.visitor.filter.TypeFilter; -import java.util.List; -import java.util.stream.Collectors; - @ProcessorAnnotation(key = "S1068", description = "Unused \"private\" fields should be removed") public class UnusedPrivateFieldProcessor extends SoraldAbstractProcessor> { @Override diff --git a/sorald/src/main/java/sorald/processor/UnusedThrowableProcessor.java b/sorald/src/main/java/sorald/processor/UnusedThrowableProcessor.java index b915c7cb5..68ff2b681 100644 --- a/sorald/src/main/java/sorald/processor/UnusedThrowableProcessor.java +++ b/sorald/src/main/java/sorald/processor/UnusedThrowableProcessor.java @@ -1,7 +1,6 @@ package sorald.processor; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.code.CtComment; import spoon.reflect.code.CtConstructorCall; diff --git a/sorald/src/main/java/sorald/processor/UtilityClassWithPublicConstructorProcessor.java b/sorald/src/main/java/sorald/processor/UtilityClassWithPublicConstructorProcessor.java index 3fdea463d..2b6d34a33 100644 --- a/sorald/src/main/java/sorald/processor/UtilityClassWithPublicConstructorProcessor.java +++ b/sorald/src/main/java/sorald/processor/UtilityClassWithPublicConstructorProcessor.java @@ -1,16 +1,14 @@ package sorald.processor; +import java.util.List; +import java.util.Set; import sorald.annotations.IncompleteProcessor; import sorald.annotations.ProcessorAnnotation; - import spoon.reflect.declaration.CtClass; import spoon.reflect.declaration.CtConstructor; import spoon.reflect.declaration.CtElement; import spoon.reflect.declaration.ModifierKind; -import java.util.List; -import java.util.Set; - @IncompleteProcessor(description = "Only handles implicit public constructor") @ProcessorAnnotation( key = "S1118", diff --git a/sorald/src/main/java/sorald/processor/XxeProcessingProcessor.java b/sorald/src/main/java/sorald/processor/XxeProcessingProcessor.java index cb7ddecf4..95fa7a6c5 100644 --- a/sorald/src/main/java/sorald/processor/XxeProcessingProcessor.java +++ b/sorald/src/main/java/sorald/processor/XxeProcessingProcessor.java @@ -1,15 +1,5 @@ package sorald.processor; -import sorald.annotations.IncompleteProcessor; -import sorald.annotations.ProcessorAnnotation; - -import spoon.reflect.code.*; -import spoon.reflect.declaration.CtMethod; -import spoon.reflect.declaration.CtType; -import spoon.reflect.declaration.ModifierKind; -import spoon.reflect.reference.CtFieldReference; -import spoon.reflect.reference.CtTypeReference; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -18,9 +8,16 @@ import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; - import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilderFactory; +import sorald.annotations.IncompleteProcessor; +import sorald.annotations.ProcessorAnnotation; +import spoon.reflect.code.*; +import spoon.reflect.declaration.CtMethod; +import spoon.reflect.declaration.CtType; +import spoon.reflect.declaration.ModifierKind; +import spoon.reflect.reference.CtFieldReference; +import spoon.reflect.reference.CtTypeReference; @IncompleteProcessor( description = diff --git a/sorald/src/main/java/sorald/rule/RuleProvider.java b/sorald/src/main/java/sorald/rule/RuleProvider.java index 4ee05689c..a87671c39 100644 --- a/sorald/src/main/java/sorald/rule/RuleProvider.java +++ b/sorald/src/main/java/sorald/rule/RuleProvider.java @@ -1,13 +1,12 @@ package sorald.rule; -import sorald.api.RuleRepository; - import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.ServiceLoader; import java.util.ServiceLoader.Provider; import java.util.stream.Collectors; +import sorald.api.RuleRepository; /** Entrypoint for finding available rules. */ public class RuleProvider { diff --git a/sorald/src/main/java/sorald/segment/SoraldTreeBuilderAlgorithm.java b/sorald/src/main/java/sorald/segment/SoraldTreeBuilderAlgorithm.java index 87fa56afc..27f965997 100644 --- a/sorald/src/main/java/sorald/segment/SoraldTreeBuilderAlgorithm.java +++ b/sorald/src/main/java/sorald/segment/SoraldTreeBuilderAlgorithm.java @@ -1,8 +1,7 @@ package sorald.segment; -import sorald.Constants; - import java.io.File; +import sorald.Constants; public class SoraldTreeBuilderAlgorithm { private SoraldTreeBuilderAlgorithm() {} diff --git a/sorald/src/main/java/sorald/sonar/BestFitScanner.java b/sorald/src/main/java/sorald/sonar/BestFitScanner.java index ad188202b..e6eddabf4 100644 --- a/sorald/src/main/java/sorald/sonar/BestFitScanner.java +++ b/sorald/src/main/java/sorald/sonar/BestFitScanner.java @@ -1,16 +1,5 @@ package sorald.sonar; -import sorald.FileUtils; -import sorald.processor.SoraldAbstractProcessor; -import sorald.rule.RuleViolation; - -import spoon.reflect.declaration.CtCompilationUnit; -import spoon.reflect.declaration.CtElement; -import spoon.reflect.declaration.CtType; -import spoon.reflect.declaration.CtVariable; -import spoon.reflect.factory.Factory; -import spoon.reflect.visitor.CtScanner; - import java.io.File; import java.nio.file.Path; import java.util.ArrayList; @@ -25,6 +14,15 @@ import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; +import sorald.FileUtils; +import sorald.processor.SoraldAbstractProcessor; +import sorald.rule.RuleViolation; +import spoon.reflect.declaration.CtCompilationUnit; +import spoon.reflect.declaration.CtElement; +import spoon.reflect.declaration.CtType; +import spoon.reflect.declaration.CtVariable; +import spoon.reflect.factory.Factory; +import spoon.reflect.visitor.CtScanner; /** Scanner for matching rule violations against Spoon elements. */ public class BestFitScanner extends CtScanner { diff --git a/sorald/src/main/java/sorald/sonar/JavaInputFile.java b/sorald/src/main/java/sorald/sonar/JavaInputFile.java index b581ca98a..c2986a358 100644 --- a/sorald/src/main/java/sorald/sonar/JavaInputFile.java +++ b/sorald/src/main/java/sorald/sonar/JavaInputFile.java @@ -1,8 +1,5 @@ package sorald.sonar; -import org.sonarsource.sonarlint.core.analysis.api.ClientInputFile; -import org.sonarsource.sonarlint.core.commons.Language; - import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -11,6 +8,8 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; +import org.sonarsource.sonarlint.core.analysis.api.ClientInputFile; +import org.sonarsource.sonarlint.core.commons.Language; public class JavaInputFile implements ClientInputFile { private final Path path; diff --git a/sorald/src/main/java/sorald/sonar/ProcessorsClassGenerator.java b/sorald/src/main/java/sorald/sonar/ProcessorsClassGenerator.java index 08afd9193..20c628320 100644 --- a/sorald/src/main/java/sorald/sonar/ProcessorsClassGenerator.java +++ b/sorald/src/main/java/sorald/sonar/ProcessorsClassGenerator.java @@ -1,8 +1,10 @@ package sorald.sonar; +import java.util.SortedMap; +import java.util.TreeMap; +import java.util.stream.Collectors; import sorald.annotations.IncompleteProcessor; import sorald.annotations.ProcessorAnnotation; - import spoon.processing.AbstractAnnotationProcessor; import spoon.reflect.code.CtExpression; import spoon.reflect.declaration.CtClass; @@ -10,10 +12,6 @@ import spoon.reflect.declaration.CtField; import spoon.reflect.declaration.CtType; -import java.util.SortedMap; -import java.util.TreeMap; -import java.util.stream.Collectors; - @SuppressWarnings({"unchecked", "rawtypes"}) public class ProcessorsClassGenerator extends AbstractAnnotationProcessor> { diff --git a/sorald/src/main/java/sorald/sonar/ProjectScanner.java b/sorald/src/main/java/sorald/sonar/ProjectScanner.java index a688d5a2b..124f639ab 100644 --- a/sorald/src/main/java/sorald/sonar/ProjectScanner.java +++ b/sorald/src/main/java/sorald/sonar/ProjectScanner.java @@ -1,12 +1,5 @@ package sorald.sonar; -import sorald.Constants; -import sorald.FileUtils; -import sorald.cli.CLIConfigForStaticAnalyzer; -import sorald.rule.Rule; -import sorald.rule.RuleViolation; -import sorald.rule.StaticAnalyzer; - import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -14,6 +7,12 @@ import java.util.List; import java.util.ServiceLoader; import java.util.Set; +import sorald.Constants; +import sorald.FileUtils; +import sorald.cli.CLIConfigForStaticAnalyzer; +import sorald.rule.Rule; +import sorald.rule.RuleViolation; +import sorald.rule.StaticAnalyzer; /** Helper class that uses Sonar to scan projects for rule violations. */ public class ProjectScanner { diff --git a/sorald/src/main/java/sorald/sonar/ScannedViolation.java b/sorald/src/main/java/sorald/sonar/ScannedViolation.java index 249906473..ff065acd9 100644 --- a/sorald/src/main/java/sorald/sonar/ScannedViolation.java +++ b/sorald/src/main/java/sorald/sonar/ScannedViolation.java @@ -1,13 +1,11 @@ package sorald.sonar; +import java.nio.file.Path; +import java.util.Objects; import org.sonarsource.sonarlint.core.client.api.common.analysis.Issue; import org.sonarsource.sonarlint.core.commons.TextRange; - import sorald.rule.RuleViolation; -import java.nio.file.Path; -import java.util.Objects; - /** Facade around {@link org.sonarsource.sonarlint.core.client.api.common.analysis.Issue} */ class ScannedViolation extends RuleViolation { private final Issue issue; diff --git a/sorald/src/main/java/sorald/sonar/SonarLintEngine.java b/sorald/src/main/java/sorald/sonar/SonarLintEngine.java index d7db363dd..a4149e5fd 100644 --- a/sorald/src/main/java/sorald/sonar/SonarLintEngine.java +++ b/sorald/src/main/java/sorald/sonar/SonarLintEngine.java @@ -4,6 +4,23 @@ import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toSet; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.function.Predicate; +import java.util.stream.Collectors; +import javax.annotation.Nullable; import org.sonar.api.Plugin; import org.sonarsource.sonarlint.core.AbstractSonarLintEngine; import org.sonarsource.sonarlint.core.analysis.AnalysisEngine; @@ -31,29 +48,9 @@ import org.sonarsource.sonarlint.core.plugin.commons.loading.PluginInstancesLoader; import org.sonarsource.sonarlint.core.plugin.commons.loading.PluginRequirementsCheckResult; import org.sonarsource.sonarlint.core.rule.extractor.SonarLintRuleDefinition; - import sorald.FileUtils; import sorald.util.ConfigLoader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.concurrent.ExecutionException; -import java.util.function.Predicate; -import java.util.stream.Collectors; - -import javax.annotation.Nullable; - public final class SonarLintEngine extends AbstractSonarLintEngine { // The order of these initialisations is important as each field is dependent upon the previous diff --git a/sorald/src/main/java/sorald/sonar/SonarProcessorRepository.java b/sorald/src/main/java/sorald/sonar/SonarProcessorRepository.java index ec235b1b8..7ce5c7ab7 100644 --- a/sorald/src/main/java/sorald/sonar/SonarProcessorRepository.java +++ b/sorald/src/main/java/sorald/sonar/SonarProcessorRepository.java @@ -1,13 +1,11 @@ package sorald.sonar; import com.google.auto.service.AutoService; - -import sorald.api.ProcessorRepository; -import sorald.processor.*; - import java.util.ArrayList; import java.util.List; import java.util.Map; +import sorald.api.ProcessorRepository; +import sorald.processor.*; @AutoService(ProcessorRepository.class) public class SonarProcessorRepository implements ProcessorRepository { diff --git a/sorald/src/main/java/sorald/sonar/SonarRule.java b/sorald/src/main/java/sorald/sonar/SonarRule.java index 249397203..6c7806944 100644 --- a/sorald/src/main/java/sorald/sonar/SonarRule.java +++ b/sorald/src/main/java/sorald/sonar/SonarRule.java @@ -1,12 +1,10 @@ package sorald.sonar; +import java.util.Objects; import org.sonarsource.sonarlint.core.rule.extractor.SonarLintRuleDefinition; - import sorald.rule.IRuleType; import sorald.rule.Rule; -import java.util.Objects; - public class SonarRule implements Rule { private final String key; private final String name; diff --git a/sorald/src/main/java/sorald/sonar/SonarRuleRepository.java b/sorald/src/main/java/sorald/sonar/SonarRuleRepository.java index df2612c7b..f03721168 100644 --- a/sorald/src/main/java/sorald/sonar/SonarRuleRepository.java +++ b/sorald/src/main/java/sorald/sonar/SonarRuleRepository.java @@ -1,17 +1,14 @@ package sorald.sonar; import com.google.auto.service.AutoService; - +import java.util.Collection; +import java.util.Set; +import java.util.stream.Collectors; import org.sonarsource.sonarlint.core.rule.extractor.SonarLintRuleDefinition; - import sorald.api.RuleRepository; import sorald.rule.IRuleType; import sorald.rule.Rule; -import java.util.Collection; -import java.util.Set; -import java.util.stream.Collectors; - /** * Class that knows about all Sonar rules. Should ONLY be used by {@link sorald.rule.RuleProvider}. */ diff --git a/sorald/src/main/java/sorald/sonar/SonarStaticAnalyzer.java b/sorald/src/main/java/sorald/sonar/SonarStaticAnalyzer.java index 66256a0e5..03b991e28 100644 --- a/sorald/src/main/java/sorald/sonar/SonarStaticAnalyzer.java +++ b/sorald/src/main/java/sorald/sonar/SonarStaticAnalyzer.java @@ -1,24 +1,20 @@ package sorald.sonar; import com.google.auto.service.AutoService; - +import java.io.File; +import java.util.*; +import java.util.stream.Collectors; +import javax.annotation.Nonnull; import org.sonarsource.sonarlint.core.client.api.common.analysis.Issue; import org.sonarsource.sonarlint.core.client.api.common.analysis.IssueListener; import org.sonarsource.sonarlint.core.client.api.standalone.StandaloneAnalysisConfiguration; import org.sonarsource.sonarlint.core.commons.RuleKey; - import sorald.SoraldConfig; import sorald.cli.CLIConfigForStaticAnalyzer; import sorald.rule.Rule; import sorald.rule.RuleViolation; import sorald.rule.StaticAnalyzer; -import java.io.File; -import java.util.*; -import java.util.stream.Collectors; - -import javax.annotation.Nonnull; - @AutoService(StaticAnalyzer.class) public class SonarStaticAnalyzer implements StaticAnalyzer { diff --git a/sorald/src/main/java/sorald/util/MavenUtils.java b/sorald/src/main/java/sorald/util/MavenUtils.java index b35832c1b..d8e24c5eb 100644 --- a/sorald/src/main/java/sorald/util/MavenUtils.java +++ b/sorald/src/main/java/sorald/util/MavenUtils.java @@ -1,9 +1,8 @@ package sorald.util; -import spoon.MavenLauncher; - import java.nio.file.Path; import java.util.List; +import spoon.MavenLauncher; /** Utility methods for working with Maven projects */ public class MavenUtils { diff --git a/sorald/src/test/java/sorald/Assertions.java b/sorald/src/test/java/sorald/Assertions.java index 403483776..8d2bf8de4 100644 --- a/sorald/src/test/java/sorald/Assertions.java +++ b/sorald/src/test/java/sorald/Assertions.java @@ -7,19 +7,16 @@ import static org.hamcrest.Matchers.notNullValue; import static org.junit.jupiter.api.Assertions.assertTrue; -import org.apache.commons.lang3.tuple.Pair; - -import sorald.rule.Rule; -import sorald.sonar.ProjectScanner; - import java.io.File; import java.util.List; import java.util.stream.Collectors; - import javax.tools.Diagnostic; import javax.tools.DiagnosticCollector; import javax.tools.JavaFileObject; import javax.tools.ToolProvider; +import org.apache.commons.lang3.tuple.Pair; +import sorald.rule.Rule; +import sorald.sonar.ProjectScanner; /** High-level assertions. */ public class Assertions { diff --git a/sorald/src/test/java/sorald/ClasspathModeTest.java b/sorald/src/test/java/sorald/ClasspathModeTest.java index 5fb694b8d..773b1ab39 100644 --- a/sorald/src/test/java/sorald/ClasspathModeTest.java +++ b/sorald/src/test/java/sorald/ClasspathModeTest.java @@ -3,18 +3,16 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; import org.json.JSONArray; import org.json.JSONObject; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; - import sorald.event.StatsMetadataKeys; import sorald.processor.CastArithmeticOperandProcessor; -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; - /** Tests for running Sorald in classpath mode. */ class ClasspathModeTest { diff --git a/sorald/src/test/java/sorald/CodeGeneratorTest.java b/sorald/src/test/java/sorald/CodeGeneratorTest.java index 72519a6e1..385468fa1 100644 --- a/sorald/src/test/java/sorald/CodeGeneratorTest.java +++ b/sorald/src/test/java/sorald/CodeGeneratorTest.java @@ -3,18 +3,16 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; +import java.io.File; +import java.nio.file.Path; +import java.nio.file.Paths; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; - import spoon.Launcher; import spoon.reflect.CtModel; import spoon.reflect.declaration.CtType; import spoon.reflect.visitor.PrettyPrinter; -import java.io.File; -import java.nio.file.Path; -import java.nio.file.Paths; - public class CodeGeneratorTest { /** Test that there is no difference between the generated code and the committed code. */ diff --git a/sorald/src/test/java/sorald/FileUtilsTest.java b/sorald/src/test/java/sorald/FileUtilsTest.java index 477c2e6c5..6eb3dd96d 100644 --- a/sorald/src/test/java/sorald/FileUtilsTest.java +++ b/sorald/src/test/java/sorald/FileUtilsTest.java @@ -8,15 +8,14 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; - import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import java.util.function.Predicate; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; public class FileUtilsTest { diff --git a/sorald/src/test/java/sorald/GatherStatsTest.java b/sorald/src/test/java/sorald/GatherStatsTest.java index 299ccd4e0..f81b8399a 100644 --- a/sorald/src/test/java/sorald/GatherStatsTest.java +++ b/sorald/src/test/java/sorald/GatherStatsTest.java @@ -5,12 +5,16 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Set; import org.json.JSONArray; import org.json.JSONObject; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; - import sorald.event.StatsMetadataKeys; import sorald.processor.ProcessorTestHelper; import sorald.processor.XxeProcessingProcessor; @@ -19,12 +23,6 @@ import sorald.sonar.ProjectScanner; import sorald.sonar.SonarRule; -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Set; - public class GatherStatsTest { @ParameterizedTest diff --git a/sorald/src/test/java/sorald/MavenHelper.java b/sorald/src/test/java/sorald/MavenHelper.java index e33b7a069..af19fd1f5 100644 --- a/sorald/src/test/java/sorald/MavenHelper.java +++ b/sorald/src/test/java/sorald/MavenHelper.java @@ -2,8 +2,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; -import sorald.processor.ProcessorTestHelper; - import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -12,6 +10,7 @@ import java.util.List; import java.util.stream.Collectors; import java.util.stream.StreamSupport; +import sorald.processor.ProcessorTestHelper; /** A class for helping with Maven in testing. */ public class MavenHelper { diff --git a/sorald/src/test/java/sorald/MavenLauncherTest.java b/sorald/src/test/java/sorald/MavenLauncherTest.java index 15dd25563..9389f0e3c 100644 --- a/sorald/src/test/java/sorald/MavenLauncherTest.java +++ b/sorald/src/test/java/sorald/MavenLauncherTest.java @@ -2,25 +2,22 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; - import static sorald.Assertions.assertHasRuleViolation; import static sorald.Assertions.assertNoRuleViolations; +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; import org.json.JSONArray; import org.json.JSONObject; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; - import sorald.event.StatsMetadataKeys; import sorald.processor.CastArithmeticOperandProcessor; import sorald.processor.DeadStoreProcessor; import sorald.rule.Rule; import sorald.sonar.SonarRule; -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; - public class MavenLauncherTest { @Test diff --git a/sorald/src/test/java/sorald/RepairTest.java b/sorald/src/test/java/sorald/RepairTest.java index 48e76dfa7..e93e4b485 100644 --- a/sorald/src/test/java/sorald/RepairTest.java +++ b/sorald/src/test/java/sorald/RepairTest.java @@ -3,20 +3,18 @@ import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.MatcherAssert.assertThat; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; - -import sorald.rule.Rule; -import sorald.rule.RuleViolation; -import sorald.sonar.ProjectScanner; -import sorald.sonar.SonarRule; - import java.io.File; import java.io.IOException; import java.util.List; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; +import sorald.rule.Rule; +import sorald.rule.RuleViolation; +import sorald.sonar.ProjectScanner; +import sorald.sonar.SonarRule; public class RepairTest { diff --git a/sorald/src/test/java/sorald/SegmentStrategyTest.java b/sorald/src/test/java/sorald/SegmentStrategyTest.java index 405250e89..8508da670 100644 --- a/sorald/src/test/java/sorald/SegmentStrategyTest.java +++ b/sorald/src/test/java/sorald/SegmentStrategyTest.java @@ -4,12 +4,19 @@ import static org.hamcrest.Matchers.greaterThan; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; - import static sorald.Assertions.assertHasRuleViolation; import static sorald.Assertions.assertNoRuleViolations; +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; import org.junit.jupiter.api.Test; - import sorald.processor.ArrayHashCodeAndToStringProcessor; import sorald.processor.ProcessorTestHelper; import sorald.processor.SoraldAbstractProcessor; @@ -18,20 +25,9 @@ import sorald.segment.Node; import sorald.sonar.ProjectScanner; import sorald.sonar.SonarRule; - import spoon.reflect.CtModel; import spoon.reflect.declaration.CtType; -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; - public class SegmentStrategyTest { @Test public void arrayToStringProcessor_success_Test() throws Exception { diff --git a/sorald/src/test/java/sorald/SystemExitHandler.java b/sorald/src/test/java/sorald/SystemExitHandler.java index 2b23f1194..2d8560172 100644 --- a/sorald/src/test/java/sorald/SystemExitHandler.java +++ b/sorald/src/test/java/sorald/SystemExitHandler.java @@ -1,11 +1,10 @@ package sorald; +import java.security.Permission; import org.junit.platform.engine.TestExecutionResult; import org.junit.platform.launcher.TestExecutionListener; import org.junit.platform.launcher.TestIdentifier; -import java.security.Permission; - /** * Handler for calls to {@link System#exit(int)}. It intercepts any calls and throws a {@link * NonZeroExit} whenever a non-zero exit is encountered. diff --git a/sorald/src/test/java/sorald/TargetedRepairTest.java b/sorald/src/test/java/sorald/TargetedRepairTest.java index ec899f1a6..42f5b4566 100644 --- a/sorald/src/test/java/sorald/TargetedRepairTest.java +++ b/sorald/src/test/java/sorald/TargetedRepairTest.java @@ -7,19 +7,8 @@ import static org.hamcrest.Matchers.greaterThan; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; - import static sorald.Assertions.assertNoRuleViolations; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; - -import sorald.processor.BigDecimalDoubleConstructorProcessor; -import sorald.processor.ProcessorTestHelper; -import sorald.rule.Rule; -import sorald.rule.RuleViolation; -import sorald.sonar.ProjectScanner; -import sorald.sonar.SonarRule; - import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; @@ -28,6 +17,14 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; +import sorald.processor.BigDecimalDoubleConstructorProcessor; +import sorald.processor.ProcessorTestHelper; +import sorald.rule.Rule; +import sorald.rule.RuleViolation; +import sorald.sonar.ProjectScanner; +import sorald.sonar.SonarRule; /** Tests for the targeted repair functionality of Sorald. */ public class TargetedRepairTest { diff --git a/sorald/src/test/java/sorald/cli/CliTest.java b/sorald/src/test/java/sorald/cli/CliTest.java index cbb6c68e0..98af454cf 100644 --- a/sorald/src/test/java/sorald/cli/CliTest.java +++ b/sorald/src/test/java/sorald/cli/CliTest.java @@ -4,10 +4,9 @@ import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; -import org.junit.jupiter.api.Test; - import java.io.ByteArrayOutputStream; import java.io.PrintStream; +import org.junit.jupiter.api.Test; /** General tests of the CLI functionality. */ public class CliTest { diff --git a/sorald/src/test/java/sorald/cli/SoraldVersionProviderTest.java b/sorald/src/test/java/sorald/cli/SoraldVersionProviderTest.java index 115b45833..06054d9b5 100644 --- a/sorald/src/test/java/sorald/cli/SoraldVersionProviderTest.java +++ b/sorald/src/test/java/sorald/cli/SoraldVersionProviderTest.java @@ -4,11 +4,10 @@ import static org.hamcrest.Matchers.equalTo; import static org.junit.jupiter.api.Assertions.assertThrows; -import org.junit.jupiter.api.Test; - import java.nio.file.Path; import java.nio.file.Paths; import java.util.jar.JarException; +import org.junit.jupiter.api.Test; class SoraldVersionProviderTest { private static final Path BOGUS_MANIFESTS = Paths.get("META-INF").resolve("bogus-manifests"); diff --git a/sorald/src/test/java/sorald/event/collectors/CompilationUnitCollectorTest.java b/sorald/src/test/java/sorald/event/collectors/CompilationUnitCollectorTest.java index 3182ec2cd..6aec661e4 100644 --- a/sorald/src/test/java/sorald/event/collectors/CompilationUnitCollectorTest.java +++ b/sorald/src/test/java/sorald/event/collectors/CompilationUnitCollectorTest.java @@ -2,19 +2,15 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; - import static sorald.support.IdentityHashSet.newIdentityHashSet; +import java.util.Collection; import org.junit.jupiter.api.Test; - import sorald.SoraldConfig; import sorald.processor.ProcessorTestHelper; - import spoon.Launcher; import spoon.reflect.declaration.CtType; -import java.util.Collection; - class CompilationUnitCollectorTest { /** diff --git a/sorald/src/test/java/sorald/it/MineMojoIT.java b/sorald/src/test/java/sorald/it/MineMojoIT.java index 0bfdc289c..dcccbe630 100644 --- a/sorald/src/test/java/sorald/it/MineMojoIT.java +++ b/sorald/src/test/java/sorald/it/MineMojoIT.java @@ -1,7 +1,6 @@ package sorald.it; import static com.soebes.itf.extension.assertj.MavenITAssertions.assertThat; - import static org.hamcrest.io.FileMatchers.anExistingFile; import com.soebes.itf.jupiter.extension.MavenGoal; @@ -9,15 +8,13 @@ import com.soebes.itf.jupiter.extension.MavenOption; import com.soebes.itf.jupiter.extension.MavenTest; import com.soebes.itf.jupiter.maven.MavenExecutionResult; - -import org.junit.jupiter.api.DisplayName; - import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; +import org.junit.jupiter.api.DisplayName; @MavenJupiterExtension public class MineMojoIT { diff --git a/sorald/src/test/java/sorald/it/RepairMojoIT.java b/sorald/src/test/java/sorald/it/RepairMojoIT.java index 26a699748..e6c69aadd 100644 --- a/sorald/src/test/java/sorald/it/RepairMojoIT.java +++ b/sorald/src/test/java/sorald/it/RepairMojoIT.java @@ -1,7 +1,6 @@ package sorald.it; import static com.soebes.itf.extension.assertj.MavenITAssertions.assertThat; - import static org.hamcrest.io.FileMatchers.anExistingFile; import com.soebes.itf.jupiter.extension.MavenGoal; @@ -9,11 +8,9 @@ import com.soebes.itf.jupiter.extension.MavenOption; import com.soebes.itf.jupiter.extension.MavenTest; import com.soebes.itf.jupiter.maven.MavenExecutionResult; - -import org.junit.jupiter.api.DisplayName; - import java.io.File; import java.nio.file.Path; +import org.junit.jupiter.api.DisplayName; @MavenJupiterExtension public class RepairMojoIT { diff --git a/sorald/src/test/java/sorald/miner/WarningMinerTest.java b/sorald/src/test/java/sorald/miner/WarningMinerTest.java index 78b2768a9..34899f9cd 100644 --- a/sorald/src/test/java/sorald/miner/WarningMinerTest.java +++ b/sorald/src/test/java/sorald/miner/WarningMinerTest.java @@ -6,13 +6,25 @@ import static org.hamcrest.Matchers.greaterThan; import static org.junit.jupiter.api.Assertions.*; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.PrintStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.json.JSONArray; import org.json.JSONObject; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import org.sonar.api.rules.RuleType; - import sorald.*; import sorald.cli.SoraldVersionProvider; import sorald.event.StatsMetadataKeys; @@ -22,20 +34,6 @@ import sorald.rule.RuleProvider; import sorald.sonar.SonarRuleType; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.PrintStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Arrays; -import java.util.List; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; - public class WarningMinerTest { private static final Path REPOS_TXT = diff --git a/sorald/src/test/java/sorald/processor/BestFitScannerTest.java b/sorald/src/test/java/sorald/processor/BestFitScannerTest.java index cd56f36de..750cbd5fb 100644 --- a/sorald/src/test/java/sorald/processor/BestFitScannerTest.java +++ b/sorald/src/test/java/sorald/processor/BestFitScannerTest.java @@ -5,15 +5,18 @@ import static org.hamcrest.Matchers.is; import static org.junit.jupiter.api.Assertions.assertThrows; +import java.io.File; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; import org.junit.jupiter.api.Test; - import sorald.Constants; import sorald.TestHelper; import sorald.rule.RuleViolation; import sorald.sonar.BestFitScanner; import sorald.sonar.ProjectScanner; import sorald.sonar.SonarRule; - import spoon.FluentLauncher; import spoon.Launcher; import spoon.reflect.CtModel; @@ -21,12 +24,6 @@ import spoon.reflect.declaration.CtClass; import spoon.reflect.declaration.CtType; -import java.io.File; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - public class BestFitScannerTest { @Test diff --git a/sorald/src/test/java/sorald/processor/MaxFixesPerRuleTest.java b/sorald/src/test/java/sorald/processor/MaxFixesPerRuleTest.java index c2b6a8ac8..ae699557a 100644 --- a/sorald/src/test/java/sorald/processor/MaxFixesPerRuleTest.java +++ b/sorald/src/test/java/sorald/processor/MaxFixesPerRuleTest.java @@ -3,8 +3,8 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; +import java.nio.file.Path; import org.junit.jupiter.api.Test; - import sorald.Assertions; import sorald.Constants; import sorald.Main; @@ -12,8 +12,6 @@ import sorald.rule.Rule; import sorald.sonar.SonarRule; -import java.nio.file.Path; - public class MaxFixesPerRuleTest { @Test public void arrayToStringProcessorTest() throws Exception { diff --git a/sorald/src/test/java/sorald/processor/NoSonarTest.java b/sorald/src/test/java/sorald/processor/NoSonarTest.java index 82952150e..94b1c39c2 100644 --- a/sorald/src/test/java/sorald/processor/NoSonarTest.java +++ b/sorald/src/test/java/sorald/processor/NoSonarTest.java @@ -2,20 +2,17 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; - import static sorald.Assertions.assertHasRuleViolation; +import java.nio.file.Files; +import java.nio.file.Path; import org.junit.jupiter.api.Test; - import sorald.Constants; import sorald.Main; import sorald.TestHelper; import sorald.rule.Rule; import sorald.sonar.SonarRule; -import java.nio.file.Files; -import java.nio.file.Path; - public class NoSonarTest { @Test public void noSonarTesting() throws Exception { diff --git a/sorald/src/test/java/sorald/processor/ProcessorDescriptionTest.java b/sorald/src/test/java/sorald/processor/ProcessorDescriptionTest.java index e09c3e16a..de073e366 100644 --- a/sorald/src/test/java/sorald/processor/ProcessorDescriptionTest.java +++ b/sorald/src/test/java/sorald/processor/ProcessorDescriptionTest.java @@ -2,18 +2,16 @@ import static org.junit.jupiter.api.Assertions.assertTrue; +import java.io.File; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.stream.Stream; import org.apache.commons.io.FilenameUtils; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; - import sorald.Processors; -import java.io.File; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.stream.Stream; - public class ProcessorDescriptionTest { private static final Path PROCESSOR_PACKAGE = Paths.get("src/main/java/sorald/processor"); diff --git a/sorald/src/test/java/sorald/processor/ProcessorTest.java b/sorald/src/test/java/sorald/processor/ProcessorTest.java index 06592aad0..263395f6c 100644 --- a/sorald/src/test/java/sorald/processor/ProcessorTest.java +++ b/sorald/src/test/java/sorald/processor/ProcessorTest.java @@ -4,10 +4,18 @@ import static org.hamcrest.Matchers.*; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assumptions.assumeFalse; - import static sorald.Assertions.assertCompiles; import static sorald.Assertions.assertNoRuleViolations; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Comparator; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.json.JSONArray; import org.json.JSONObject; import org.junit.jupiter.api.Test; @@ -18,7 +26,6 @@ import org.junit.jupiter.params.provider.ArgumentsProvider; import org.junit.jupiter.params.provider.ArgumentsSource; import org.junit.jupiter.params.provider.MethodSource; - import sorald.Constants; import sorald.FileUtils; import sorald.TestHelper; @@ -26,22 +33,11 @@ import sorald.rule.Rule; import sorald.sonar.ProjectScanner; import sorald.sonar.SonarRule; - import spoon.Launcher; import spoon.reflect.CtModel; import spoon.reflect.declaration.CtImport; import spoon.reflect.declaration.CtType; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Comparator; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - public class ProcessorTest { private static final Set FILES_THAT_DONT_COMPILE_AFTER_REPAIR = diff --git a/sorald/src/test/java/sorald/processor/ProcessorTestFilesCompileTest.java b/sorald/src/test/java/sorald/processor/ProcessorTestFilesCompileTest.java index 3c7520733..0719644e8 100644 --- a/sorald/src/test/java/sorald/processor/ProcessorTestFilesCompileTest.java +++ b/sorald/src/test/java/sorald/processor/ProcessorTestFilesCompileTest.java @@ -2,16 +2,15 @@ import static sorald.Assertions.assertCompiles; +import java.io.File; +import java.io.IOException; +import java.util.stream.Stream; import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import java.io.File; -import java.io.IOException; -import java.util.stream.Stream; - /** Meta tests for verifying that the processor test files compile as expected. */ class ProcessorTestFilesCompileTest { diff --git a/sorald/src/test/java/sorald/processor/ProcessorTestHelper.java b/sorald/src/test/java/sorald/processor/ProcessorTestHelper.java index 5dd3ef159..d91c1ee96 100644 --- a/sorald/src/test/java/sorald/processor/ProcessorTestHelper.java +++ b/sorald/src/test/java/sorald/processor/ProcessorTestHelper.java @@ -1,13 +1,5 @@ package sorald.processor; -import sorald.Assertions; -import sorald.Constants; -import sorald.Main; -import sorald.PrettyPrintingStrategy; -import sorald.TestHelper; -import sorald.rule.Rule; -import sorald.sonar.SonarRule; - import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -22,6 +14,13 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Stream; +import sorald.Assertions; +import sorald.Constants; +import sorald.Main; +import sorald.PrettyPrintingStrategy; +import sorald.TestHelper; +import sorald.rule.Rule; +import sorald.sonar.SonarRule; /** Helper functions for {@link ProcessorTest}. */ public class ProcessorTestHelper { diff --git a/sorald/src/test/java/sorald/processor/SoraldAbstractProcessorTest.java b/sorald/src/test/java/sorald/processor/SoraldAbstractProcessorTest.java index 1a26ec5eb..8234ac0a6 100644 --- a/sorald/src/test/java/sorald/processor/SoraldAbstractProcessorTest.java +++ b/sorald/src/test/java/sorald/processor/SoraldAbstractProcessorTest.java @@ -4,16 +4,13 @@ import static org.hamcrest.Matchers.equalTo; import static org.junit.jupiter.api.Assertions.assertFalse; +import java.util.List; import org.junit.jupiter.api.Test; - import sorald.event.collectors.RepairStatisticsCollector; - import spoon.Launcher; import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.CtType; -import java.util.List; - /** Tests for the concrete methods of {@link sorald.processor.SoraldAbstractProcessor}. */ public class SoraldAbstractProcessorTest { private static final RuntimeException EXCEPTION = new RuntimeException("I'm a crash :)"); diff --git a/sorald/src/test/java/sorald/segment/FirstFitSegmentationAlgorithmTest.java b/sorald/src/test/java/sorald/segment/FirstFitSegmentationAlgorithmTest.java index ec2997fcf..711a39fd4 100644 --- a/sorald/src/test/java/sorald/segment/FirstFitSegmentationAlgorithmTest.java +++ b/sorald/src/test/java/sorald/segment/FirstFitSegmentationAlgorithmTest.java @@ -2,18 +2,16 @@ import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder; -import org.hamcrest.MatcherAssert; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import sorald.TestHelper; - import java.io.File; import java.nio.file.Path; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; +import org.hamcrest.MatcherAssert; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import sorald.TestHelper; public class FirstFitSegmentationAlgorithmTest { diff --git a/sorald/src/test/java/sorald/segment/SoraldTreeBuilderAlgorithmTest.java b/sorald/src/test/java/sorald/segment/SoraldTreeBuilderAlgorithmTest.java index 6a26a6156..e5d5dc4c1 100644 --- a/sorald/src/test/java/sorald/segment/SoraldTreeBuilderAlgorithmTest.java +++ b/sorald/src/test/java/sorald/segment/SoraldTreeBuilderAlgorithmTest.java @@ -2,17 +2,15 @@ import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder; -import org.hamcrest.MatcherAssert; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import sorald.TestHelper; - import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.util.List; import java.util.stream.Collectors; +import org.hamcrest.MatcherAssert; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import sorald.TestHelper; public class SoraldTreeBuilderAlgorithmTest { diff --git a/sorald/src/test/java/sorald/sonar/RuleViolationTest.java b/sorald/src/test/java/sorald/sonar/RuleViolationTest.java index 738b585e4..099697c18 100644 --- a/sorald/src/test/java/sorald/sonar/RuleViolationTest.java +++ b/sorald/src/test/java/sorald/sonar/RuleViolationTest.java @@ -2,14 +2,12 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; +import java.io.File; import org.junit.jupiter.api.Test; - import sorald.TestHelper; import sorald.processor.XxeProcessingProcessor; import sorald.rule.RuleViolation; -import java.io.File; - public class RuleViolationTest { @Test public void equals_onNonRuleViolationType_returnsFalse() { diff --git a/sorald/src/test/java/sorald/sonar/SonarLintEngineTest.java b/sorald/src/test/java/sorald/sonar/SonarLintEngineTest.java index 5588ce743..0080dae37 100644 --- a/sorald/src/test/java/sorald/sonar/SonarLintEngineTest.java +++ b/sorald/src/test/java/sorald/sonar/SonarLintEngineTest.java @@ -6,10 +6,6 @@ import static org.hamcrest.io.FileMatchers.anExistingFile; import static org.junit.jupiter.api.Assertions.assertFalse; -import org.junit.jupiter.api.Test; -import org.sonarsource.sonarlint.core.analysis.AnalysisEngine; -import org.sonarsource.sonarlint.core.rule.extractor.SonarLintRuleDefinition; - import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.HashSet; @@ -18,6 +14,9 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.junit.jupiter.api.Test; +import org.sonarsource.sonarlint.core.analysis.AnalysisEngine; +import org.sonarsource.sonarlint.core.rule.extractor.SonarLintRuleDefinition; class SonarLintEngineTest { diff --git a/sorald/src/test/java/sorald/sonar/SonarRulesTest.java b/sorald/src/test/java/sorald/sonar/SonarRulesTest.java index 4a97d3c73..5d28db848 100644 --- a/sorald/src/test/java/sorald/sonar/SonarRulesTest.java +++ b/sorald/src/test/java/sorald/sonar/SonarRulesTest.java @@ -6,14 +6,6 @@ import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsNull.notNullValue; -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; - -import sorald.Processors; -import sorald.rule.IRuleType; -import sorald.rule.Rule; -import sorald.rule.RuleProvider; - import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -22,6 +14,12 @@ import java.util.Collection; import java.util.List; import java.util.stream.Collectors; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import sorald.Processors; +import sorald.rule.IRuleType; +import sorald.rule.Rule; +import sorald.rule.RuleProvider; class SonarRulesTest { @Nested