Replace fast-classpath-scanner with classgraph

This commit is contained in:
Paul Campbell 2018-08-26 20:18:35 +01:00 committed by dependabot[bot]
parent 093c3ddd3e
commit f53b638441
2 changed files with 9 additions and 7 deletions

View file

@ -32,7 +32,7 @@
<mockito.version>2.21.0</mockito.version> <mockito.version>2.21.0</mockito.version>
<assertj.version>3.11.0</assertj.version> <assertj.version>3.11.0</assertj.version>
<conditional.version>0.6.0</conditional.version> <conditional.version>0.6.0</conditional.version>
<fast-classpath-scanner.version>3.1.15</fast-classpath-scanner.version> <classgraph.version>4.1.2</classgraph.version>
<maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version> <maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version>
<kemitix.checkstyle.ruleset.version>${project.version}</kemitix.checkstyle.ruleset.version> <kemitix.checkstyle.ruleset.version>${project.version}</kemitix.checkstyle.ruleset.version>
@ -66,9 +66,9 @@
<version>${conditional.version}</version> <version>${conditional.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.github.lukehutch</groupId> <groupId>io.github.classgraph</groupId>
<artifactId>fast-classpath-scanner</artifactId> <artifactId>classgraph</artifactId>
<version>${fast-classpath-scanner.version}</version> <version>${classgraph.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>

View file

@ -21,7 +21,7 @@
package net.kemitix.checkstyle.ruleset.builder; package net.kemitix.checkstyle.ruleset.builder;
import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner; import io.github.classgraph.ClassGraph;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@ -38,9 +38,11 @@ public class DefaultPackageScanner implements PackageScanner {
@Override @Override
public final List<String> apply(final RuleSource ruleSource) { public final List<String> apply(final RuleSource ruleSource) {
final String basePackage = ruleSource.getBasePackage(); final String basePackage = ruleSource.getBasePackage();
return new FastClasspathScanner(basePackage) return new ClassGraph()
.whitelistPackages(basePackage)
.scan() .scan()
.getNamesOfAllStandardClasses() .getAllStandardClasses()
.getNames()
.stream() .stream()
.filter(packageName -> packageName.startsWith(basePackage)) .filter(packageName -> packageName.startsWith(basePackage))
.collect(Collectors.toList()); .collect(Collectors.toList());