Skip to content

Commit 584cbbd

Browse files
committed
update kotlin versions
1 parent d98d632 commit 584cbbd

File tree

23 files changed

+81
-59
lines changed

23 files changed

+81
-59
lines changed

code-assert-gui/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<dependency>
1616
<groupId>org.springframework.boot</groupId>
1717
<artifactId>spring-boot-dependencies</artifactId>
18-
<version>1.5.6.RELEASE</version>
18+
<version>1.5.9.RELEASE</version>
1919
<type>pom</type>
2020
<scope>import</scope>
2121
</dependency>

code-assert/pom.xml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
<slf4j.version>1.7.25</slf4j.version>
1717
<checkstyle.version>6.19</checkstyle.version>
1818
<findbugs.version>3.0.1</findbugs.version>
19+
<findsecbugs.version>1.7.1</findsecbugs.version>
1920
<pmd.version>5.4.1</pmd.version>
20-
<detekt.version>1.0.0.RC4</detekt.version>
21-
<ktlint.version>0.9.2</ktlint.version>
21+
<kotlin.version>1.2.20</kotlin.version>
22+
<detekt.version>1.0.0.RC6-2</detekt.version>
23+
<ktlint.version>0.15.0</ktlint.version>
2224
</properties>
2325

2426
<build>
@@ -65,7 +67,7 @@
6567
<plugin>
6668
<artifactId>kotlin-maven-plugin</artifactId>
6769
<groupId>org.jetbrains.kotlin</groupId>
68-
<version>1.1.50</version>
70+
<version>${kotlin.version}</version>
6971
<executions>
7072
<execution>
7173
<id>test-compile</id>
@@ -93,11 +95,17 @@
9395
<groupId>com.google.code.findbugs</groupId>
9496
<artifactId>findbugs</artifactId>
9597
<version>${findbugs.version}</version>
98+
<exclusions>
99+
<exclusion>
100+
<groupId>org.ow2.asm</groupId>
101+
<artifactId>asm-debug-all</artifactId>
102+
</exclusion>
103+
</exclusions>
96104
</dependency>
97105
<dependency>
98106
<groupId>com.h3xstream.findsecbugs</groupId>
99107
<artifactId>findsecbugs-plugin</artifactId>
100-
<version>1.7.1</version>
108+
<version>${findsecbugs.version}</version>
101109
</dependency>
102110
<dependency>
103111
<groupId>net.sourceforge.pmd</groupId>
@@ -116,6 +124,13 @@
116124
</exclusions>
117125
</dependency>
118126

127+
<dependency>
128+
<groupId>org.jetbrains.kotlin</groupId>
129+
<artifactId>kotlin-stdlib</artifactId>
130+
<version>${kotlin.version}</version>
131+
<scope>provided</scope>
132+
</dependency>
133+
119134
<dependency>
120135
<groupId>io.gitlab.arturbosch.detekt</groupId>
121136
<artifactId>detekt-core</artifactId>

code-assert/src/main/java/guru/nidi/codeassert/checkstyle/CheckstyleAnalyzer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public int compare(AuditEvent b1, AuditEvent b2) {
4646
};
4747

4848
private static class LoggingAuditListener implements AuditListener {
49-
private final List<AuditEvent> events = new ArrayList<>();
49+
final List<AuditEvent> events = new ArrayList<>();
5050

5151
@Override
5252
public void auditStarted(AuditEvent event) {

code-assert/src/main/java/guru/nidi/codeassert/checkstyle/StyleChecks.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.*;
1919

2020
import static com.puppycrawl.tools.checkstyle.api.TokenTypes.*;
21+
import static java.util.Arrays.asList;
2122

2223
public class StyleChecks {
2324
private static final String MAX_LINE_LEN = "maxLineLen";
@@ -58,7 +59,7 @@ protected Google() {
5859
"parameterName", "^[a-z][a-z0-9][a-zA-Z0-9]*$",
5960
"catchParameterName", "^[a-z][a-z0-9][a-zA-Z0-9]*$",
6061
"localVariableName", "^[a-z][a-z0-9][a-zA-Z0-9]*$",
61-
"emptyLine-tokens", Arrays.asList(PACKAGE_DEF, IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
62+
"emptyLine-tokens", asList(PACKAGE_DEF, IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
6263
STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF));
6364
}
6465

code-assert/src/main/java/guru/nidi/codeassert/config/CollectorConfig.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717

1818
import guru.nidi.codeassert.util.ListUtils;
1919

20-
import java.util.Arrays;
2120
import java.util.List;
2221

22+
import static java.util.Arrays.asList;
23+
2324
public final class CollectorConfig<A extends Action> {
2425
public final String reason;
2526
public final boolean ignoreUnused;
@@ -37,7 +38,7 @@ public CollectorConfig<A> ignoringUnused() {
3738

3839
@SafeVarargs
3940
public static <A extends Action> CollectorConfig<A> because(String reason, A... actions) {
40-
return new CollectorConfig<>(reason, false, Arrays.asList(actions));
41+
return new CollectorConfig<>(reason, false, asList(actions));
4142
}
4243

4344
@SafeVarargs

code-assert/src/main/java/guru/nidi/codeassert/config/In.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
*/
1616
package guru.nidi.codeassert.config;
1717

18-
import java.util.*;
18+
import java.util.ArrayList;
19+
import java.util.List;
1920

21+
import static java.util.Arrays.asList;
2022
import static java.util.Collections.singletonList;
2123

2224
public final class In {
@@ -126,7 +128,7 @@ private List<Location> baseLocs() {
126128
}
127129

128130
public Ignore ignore(String... names) {
129-
return new Ignore(locs, Arrays.asList(names));
131+
return new Ignore(locs, asList(names));
130132
}
131133

132134
public Ignore ignoreAll() {

code-assert/src/main/java/guru/nidi/codeassert/detekt/DetektAnalyzer.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626

2727
import static guru.nidi.codeassert.config.Language.KOTLIN;
2828
import static io.gitlab.arturbosch.detekt.api.Severity.*;
29-
import static java.lang.Boolean.FALSE;
3029
import static java.util.Arrays.asList;
30+
import static java.util.Collections.emptyList;
3131

3232
public class DetektAnalyzer implements Analyzer<List<TypedDetektFinding>> {
3333
private final AnalyzerConfig config;
@@ -36,7 +36,7 @@ public class DetektAnalyzer implements Analyzer<List<TypedDetektFinding>> {
3636
private final List<RuleSetProvider> ruleSetProviders;
3737

3838
public DetektAnalyzer(AnalyzerConfig config, DetektCollector collector) {
39-
this(config, collector, null, Collections.emptyList());
39+
this(config, collector, null, emptyList());
4040
}
4141

4242
private DetektAnalyzer(AnalyzerConfig config, DetektCollector collector, Config detektConfig,
@@ -57,11 +57,10 @@ public DetektAnalyzer withRuleSets(RuleSetProvider... providers) {
5757

5858
public DetektResult analyze() {
5959
final File baseDir = new File(AnalyzerConfig.Path.commonBase(config.getSourcePaths(KOTLIN)).getPath());
60-
final ProcessingSettings settings = new ProcessingSettings(baseDir.toPath(),
61-
calcDetektConfig(), Collections.emptyList(), false, false, Collections.emptyList());
62-
final Detektor detektor = new Detektor(settings, calcRuleSetProviders(settings), Collections.emptyList());
63-
final Detektion detektion = detektor.run(KtTreeCompiler.Companion.instance(settings));
64-
return createResult(baseDir, detektion);
60+
final ProcessingSettings settings = new ProcessingSettings(
61+
baseDir.toPath(), calcDetektConfig(), emptyList(), false, false, emptyList());
62+
final DetektFacade detekt = DetektFacade.Companion.create(settings, ruleSetProviders(settings), emptyList());
63+
return createResult(baseDir, detekt.run());
6564
}
6665

6766
private Config calcDetektConfig() {
@@ -70,7 +69,7 @@ private Config calcDetektConfig() {
7069
: detektConfig);
7170
}
7271

73-
private List<RuleSetProvider> calcRuleSetProviders(ProcessingSettings settings) {
72+
private List<RuleSetProvider> ruleSetProviders(ProcessingSettings settings) {
7473
final List<RuleSetProvider> res = new RuleSetLocator(settings).load();
7574
res.addAll(ruleSetProviders);
7675
return res;
@@ -107,7 +106,7 @@ public Config subConfig(String s) {
107106

108107
@Override
109108
public <T> T valueOrDefault(String s, T t) {
110-
return "autoCorrect".equals(s) ? (T) FALSE : delegate.valueOrDefault(s, t);
109+
return "autoCorrect".equals(s) ? (T) Boolean.FALSE : delegate.valueOrDefault(s, t);
111110
}
112111
}
113112

code-assert/src/main/java/guru/nidi/codeassert/detekt/DetektMatcher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ protected void describeMismatchSafely(DetektResult item, Description description
3535

3636
private String printError(TypedDetektFinding finding) {
3737
final Location location = finding.entity.getLocation();
38-
final File file = new File(finding.basedir, location.getFile());
38+
final String path = new File(location.getFile()).getAbsolutePath();
3939
return String.format("%-15s %-15s %-30s %s:%d %s", finding.severity, finding.type, finding.name,
40-
file.getAbsolutePath(), location.getSource().getLine(), finding.description);
40+
path, location.getSource().getLine(), finding.description);
4141
}
4242
}

code-assert/src/main/java/guru/nidi/codeassert/jacoco/JacocoAnalyzer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import java.io.*;
2424
import java.util.*;
2525

26+
import static java.util.Collections.singleton;
27+
2628
public class JacocoAnalyzer implements Analyzer<List<ValuedLocation>> {
2729
private final File jacocoCsv;
2830
private final CoverageCollector collector;
@@ -47,7 +49,7 @@ public JacocoResult analyze() {
4749

4850
private Coverages readReport() {
4951
final Coverages coverages = new Coverages();
50-
try (final BufferedReader in = new BufferedReader(new InputStreamReader(
52+
try (BufferedReader in = new BufferedReader(new InputStreamReader(
5153
new FileInputStream(jacocoCsv), "utf-8"))) {
5254
String line;
5355
in.readLine();
@@ -69,7 +71,7 @@ private Coverages readReport() {
6971
private JacocoResult filterResult(Coverages coverages) {
7072
final List<ValuedLocation> filtered = new ArrayList<>();
7173
final UsageCounter counter = new UsageCounter();
72-
filter(filtered, Collections.singleton(coverages.global), counter);
74+
filter(filtered, singleton(coverages.global), counter);
7375
filter(filtered, coverages.perPackage.values(), counter);
7476
filter(filtered, coverages.coverages, counter);
7577
collector.printUnusedWarning(counter);

code-assert/src/main/java/guru/nidi/codeassert/ktlint/KtlintAnalyzer.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import static guru.nidi.codeassert.config.Language.KOTLIN;
3131
import static java.nio.charset.StandardCharsets.UTF_8;
32+
import static java.util.Arrays.asList;
3233

3334
public class KtlintAnalyzer implements Analyzer<List<LocatedLintError>> {
3435
private static final Logger LOG = LoggerFactory.getLogger(KtlintAnalyzer.class);
@@ -48,7 +49,7 @@ private KtlintAnalyzer(AnalyzerConfig config, KtlintCollector collector, List<Ru
4849
}
4950

5051
public KtlintAnalyzer withRuleSets(RuleSet... ruleSets) {
51-
return new KtlintAnalyzer(config, collector, Arrays.asList(ruleSets));
52+
return new KtlintAnalyzer(config, collector, asList(ruleSets));
5253
}
5354

5455
public KtlintResult analyze() {
@@ -104,8 +105,8 @@ private KtlintResult createResult(ErrorListener listener) {
104105
}
105106

106107
private static class ErrorListener implements Function1<LintError, Unit> {
107-
private final List<LocatedLintError> errors = new ArrayList<>();
108-
private File currentFile;
108+
final List<LocatedLintError> errors = new ArrayList<>();
109+
File currentFile;
109110

110111
@Override
111112
public Unit invoke(LintError e) {

0 commit comments

Comments
 (0)