Skip to content

Commit e1d0510

Browse files
committed
spotbugs
1 parent 03ce6d0 commit e1d0510

File tree

3 files changed

+32
-17
lines changed

3 files changed

+32
-17
lines changed

pom.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,25 @@ SOFTWARE.
308308
</profiles>
309309
<build>
310310
<plugins>
311+
<plugin>
312+
<groupId>com.github.spotbugs</groupId>
313+
<artifactId>spotbugs-maven-plugin</artifactId>
314+
<version>4.8.6.6</version>
315+
<executions>
316+
<execution>
317+
<goals>
318+
<goal>check</goal>
319+
</goals>
320+
</execution>
321+
</executions>
322+
<dependencies>
323+
<dependency>
324+
<groupId>com.github.spotbugs</groupId>
325+
<artifactId>spotbugs</artifactId>
326+
<version>4.8.6</version>
327+
</dependency>
328+
</dependencies>
329+
</plugin>
311330
<plugin>
312331
<artifactId>maven-surefire-plugin</artifactId>
313332
<!-- version from the parent pom -->

src/main/java/org/eolang/lints/XmirKey.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,14 @@ final class XmirKey implements Text {
6060

6161
@Override
6262
public String asString() {
63-
final String key;
6463
final Path parent = this.base.relativize(this.xmir.getParent());
65-
final String name = XmirKey.XMIR_EXT.matcher(
66-
this.xmir.getFileName().toString()
67-
).replaceAll("");
64+
final Path path = this.xmir.getFileName();
65+
String fname = "";
66+
if (path != null) {
67+
fname = path.toString();
68+
}
69+
final String name = XmirKey.XMIR_EXT.matcher(fname).replaceAll("");
70+
final String key;
6871
if (parent.toString().isEmpty()) {
6972
key = name;
7073
} else {

src/main/java/org/eolang/lints/misc/LtTestNotVerb.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,36 +68,29 @@ public final class LtTestNotVerb implements Lint<XML> {
6868
private static final Pattern KEBAB = Pattern.compile("-");
6969

7070
/**
71-
* NLP pipeline.
71+
* Properties of NLP pipeline.
7272
*/
73-
private final StanfordCoreNLP pipeline;
73+
private final Properties properties;
7474

7575
/**
7676
* Ctor.
7777
* @param props Pipeline properties
7878
*/
7979
public LtTestNotVerb(final Properties props) {
80-
this(new StanfordCoreNLP(props));
80+
this.properties = new Properties(props);
8181
}
8282

8383
/**
8484
* Ctor.
8585
*/
8686
public LtTestNotVerb() {
87-
this(defaults());
88-
}
89-
90-
/**
91-
* Primary ctor.
92-
* @param pipe NLP pipeline
93-
*/
94-
public LtTestNotVerb(final StanfordCoreNLP pipe) {
95-
this.pipeline = pipe;
87+
this(LtTestNotVerb.defaults());
9688
}
9789

9890
@Override
9991
public Collection<Defect> defects(final XML xmir) throws IOException {
10092
final Collection<Defect> defects = new LinkedList<>();
93+
final StanfordCoreNLP pipeline = new StanfordCoreNLP(this.properties);
10194
for (final XML object : xmir.nodes("/program[metas/meta[head='tests']]/objects/o[@name]")) {
10295
final String name = object.xpath("@name").get(0);
10396
final CoreDocument doc = new CoreDocument(
@@ -109,7 +102,7 @@ public Collection<Defect> defects(final XML xmir) throws IOException {
109102
.map(s -> s.toLowerCase(Locale.ROOT))
110103
.collect(Collectors.joining(" "))
111104
);
112-
this.pipeline.annotate(doc);
105+
pipeline.annotate(doc);
113106
if (
114107
!"VBZ".equals(
115108
doc.tokens().get(1).get(CoreAnnotations.PartOfSpeechAnnotation.class)

0 commit comments

Comments
 (0)