Skip to content

Commit 2e868c8

Browse files
authored
Merge branch 'master' into 806
2 parents df46a54 + 1712147 commit 2e868c8

File tree

116 files changed

+1513
-1227
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+1513
-1227
lines changed

.github/workflows/motives.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- uses: actions/checkout@v5
1919
- run: sudo apt-get update --yes --fix-missing && sudo apt-get install --yes pandoc
2020
- run: .github/motives.sh "${{ github.ref_name }}"
21-
- uses: JamesIves/github-pages-deploy-action@v4.7.6
21+
- uses: JamesIves/github-pages-deploy-action@v4.8.0
2222
with:
2323
branch: gh-pages
2424
folder: gh-pages

.github/workflows/mvn.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
os: [ubuntu-24.04, windows-2022, macos-15]
19-
java: [17, 23]
20-
exclude:
21-
- os: windows-2022
22-
java: 17
23-
- os: macos-15
24-
java: 17
19+
java: [23]
2520
runs-on: ${{ matrix.os }}
2621
steps:
2722
- uses: actions/checkout@v5

.github/workflows/typos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ jobs:
1616
runs-on: ubuntu-24.04
1717
steps:
1818
- uses: actions/checkout@v5
19-
- uses: crate-ci/typos@v1.40.0
19+
- uses: crate-ci/typos@v1.44.0
2020
with:
2121
config: ./.github/typos.toml

pom.xml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>com.jcabi</groupId>
1010
<artifactId>parent</artifactId>
11-
<version>0.71.1</version>
11+
<version>0.73.1</version>
1212
</parent>
1313
<groupId>org.eolang</groupId>
1414
<artifactId>lints</artifactId>
@@ -86,7 +86,7 @@
8686
<dependency>
8787
<groupId>org.cactoos</groupId>
8888
<artifactId>cactoos</artifactId>
89-
<version>0.57.0</version>
89+
<version>0.59.0</version>
9090
</dependency>
9191
<dependency>
9292
<groupId>net.sf.saxon</groupId>
@@ -127,7 +127,7 @@
127127
<dependency>
128128
<groupId>org.eolang</groupId>
129129
<artifactId>eo-parser</artifactId>
130-
<version>0.59.0</version>
130+
<version>0.60.0</version>
131131
<scope>compile</scope>
132132
<exclusions>
133133
<exclusion>
@@ -324,7 +324,7 @@
324324
<plugin>
325325
<groupId>com.qulice</groupId>
326326
<artifactId>qulice-maven-plugin</artifactId>
327-
<version>0.24.2</version>
327+
<version>0.25.1</version>
328328
<configuration>
329329
<excludes combine.children="append">
330330
<exclude>pmd:/src/it/.*</exclude>
@@ -385,7 +385,7 @@
385385
<plugin>
386386
<groupId>org.eolang</groupId>
387387
<artifactId>hone-maven-plugin</artifactId>
388-
<version>0.20.3</version>
388+
<version>0.23.1</version>
389389
<executions>
390390
<execution>
391391
<goals>
@@ -438,7 +438,7 @@
438438
<plugin>
439439
<groupId>org.pitest</groupId>
440440
<artifactId>pitest-maven</artifactId>
441-
<version>1.22.0</version>
441+
<version>1.23.0</version>
442442
<executions>
443443
<execution>
444444
<goals>
@@ -487,7 +487,7 @@
487487
<plugin>
488488
<groupId>org.apache.maven.plugins</groupId>
489489
<artifactId>maven-surefire-plugin</artifactId>
490-
<version>3.5.4</version>
490+
<version>3.5.5</version>
491491
<configuration>
492492
<excludedGroups>benchmark,reserved</excludedGroups>
493493
<excludes>
@@ -534,7 +534,7 @@
534534
<path>
535535
<groupId>com.google.errorprone</groupId>
536536
<artifactId>error_prone_core</artifactId>
537-
<version>2.40.0</version>
537+
<version>2.48.0</version>
538538
</path>
539539
</annotationProcessorPaths>
540540
</configuration>
@@ -552,7 +552,7 @@
552552
<plugin>
553553
<groupId>com.github.wvengen</groupId>
554554
<artifactId>proguard-maven-plugin</artifactId>
555-
<version>2.6.1</version>
555+
<version>2.7.0</version>
556556
<executions>
557557
<execution>
558558
<phase>verify</phase>
@@ -698,9 +698,9 @@
698698
<plugin>
699699
<groupId>org.codehaus.gmavenplus</groupId>
700700
<artifactId>gmavenplus-plugin</artifactId>
701-
<version>4.2.1</version>
702701
<configuration>
703702
<verbose>true</verbose>
703+
<targetBytecode>11</targetBytecode>
704704
</configuration>
705705
<executions>
706706
<execution>
@@ -734,7 +734,7 @@
734734
<plugin>
735735
<groupId>org.apache.maven.plugins</groupId>
736736
<artifactId>maven-surefire-plugin</artifactId>
737-
<version>3.5.4</version>
737+
<version>3.5.5</version>
738738
<configuration>
739739
<excludedGroups>benchmark</excludedGroups>
740740
<excludes>
@@ -753,7 +753,7 @@
753753
<plugin>
754754
<groupId>com.github.spotbugs</groupId>
755755
<artifactId>spotbugs-maven-plugin</artifactId>
756-
<version>4.9.8.2</version>
756+
<version>4.9.8.3</version>
757757
<configuration>
758758
<excludeFilterFile>${project.basedir}/spotbugs-exclude.xml</excludeFilterFile>
759759
</configuration>
@@ -765,6 +765,13 @@
765765
</dependency>
766766
</dependencies>
767767
</plugin>
768+
<plugin>
769+
<groupId>org.codehaus.gmavenplus</groupId>
770+
<artifactId>gmavenplus-plugin</artifactId>
771+
<configuration>
772+
<targetBytecode>11</targetBytecode>
773+
</configuration>
774+
</plugin>
768775
<plugin>
769776
<artifactId>maven-surefire-plugin</artifactId>
770777
<!-- version from the parent pom -->
@@ -847,7 +854,7 @@
847854
<artifactItem>
848855
<groupId>org.apache.hadoop</groupId>
849856
<artifactId>hadoop-hdfs</artifactId>
850-
<version>3.4.2</version>
857+
<version>3.4.3</version>
851858
<type>jar</type>
852859
<includes>org/apache/hadoop/hdfs/server/namenode/FSNamesystem.class</includes>
853860
<outputDirectory>${project.build.directory}/classes</outputDirectory>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public Default(
187187

188188
@Override
189189
public String toString() {
190-
final StringBuilder text = new StringBuilder(0)
190+
final StringBuilder text = new StringBuilder(64)
191191
.append('[').append(this.oname).append(' ')
192192
.append(this.rle).append(' ')
193193
.append(this.sev).append(']');

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.cactoos.io.ResourceOf;
1616
import org.cactoos.text.IoCheckedText;
1717
import org.cactoos.text.TextOf;
18-
import org.eolang.parser.OnDefault;
1918

2019
/**
2120
* A comment must include only ASCII characters.
@@ -56,7 +55,7 @@ public Collection<Defect> defects(final XML xmir) throws IOException {
5655
new Defect.Default(
5756
"ascii-only",
5857
Severity.WARNING,
59-
new OnDefault(xmir).get(),
58+
new ProgramName(xmir).get(),
6059
Integer.parseInt(line),
6160
String.format(
6261
"Only ASCII characters are allowed in comments, while \"%s\" is used at the line no.%s at the position no.%s",

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

Lines changed: 59 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@
1010
import com.jcabi.xml.XMLDocument;
1111
import com.jcabi.xml.XSL;
1212
import com.jcabi.xml.XSLDocument;
13-
import java.util.ArrayList;
1413
import java.util.Collection;
15-
import java.util.HashSet;
1614
import java.util.List;
1715
import java.util.Map;
1816
import java.util.Objects;
17+
import java.util.Set;
18+
import java.util.concurrent.ConcurrentHashMap;
1919
import java.util.function.Function;
2020
import java.util.stream.Collectors;
2121
import java.util.stream.IntStream;
22+
import java.util.stream.Stream;
2223
import org.cactoos.io.ResourceOf;
2324
import org.cactoos.io.UncheckedInput;
2425
import org.cactoos.list.ListOf;
2526
import org.cactoos.text.TextOf;
2627
import org.cactoos.text.UncheckedText;
27-
import org.eolang.parser.OnDefault;
2828

2929
/**
3030
* All atom FQNs in the entire scope of EO program must be unique.
@@ -69,47 +69,14 @@ public String name() {
6969

7070
@Override
7171
public Collection<Defect> defects(final Map<String, XML> pkg) {
72-
final Collection<Defect> defects = new ArrayList<>(0);
7372
final Map<Xnav, List<String>> index = pkg.values().stream()
7473
.map(this.pre::transform)
7574
.map(xmir -> new Xnav(xmir.inner()))
7675
.collect(Collectors.toMap(Function.identity(), LtAtomIsNotUnique::fqns));
77-
final Collection<String> checked = new HashSet<>(0);
78-
index.forEach(
79-
(xmir, fqns) -> {
80-
fqns.stream()
81-
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
82-
.entrySet()
83-
.stream()
84-
.filter(entry -> entry.getValue() > 1L)
85-
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))
86-
.forEach(
87-
(aname, count) ->
88-
IntStream.range(0, Math.toIntExact(count)).forEach(
89-
pos -> defects.add(this.singleDefect(xmir, aname, pos))
90-
)
91-
);
92-
index.forEach(
93-
(next, names) -> {
94-
if (!Objects.equals(next, xmir)) {
95-
final String pair = LtAtomIsNotUnique.pairHash(xmir, next);
96-
if (!checked.contains(pair)) {
97-
checked.add(pair);
98-
names.stream()
99-
.filter(fqns::contains)
100-
.forEach(
101-
aname -> {
102-
defects.add(this.sharedDefect(next, xmir, aname));
103-
defects.add(this.sharedDefect(xmir, next, aname));
104-
}
105-
);
106-
}
107-
}
108-
}
109-
);
110-
}
111-
);
112-
return defects;
76+
return Stream.concat(
77+
this.duplicateDefects(index),
78+
this.sharedDefects(index)
79+
).collect(Collectors.toList());
11380
}
11481

11582
@Override
@@ -125,11 +92,60 @@ public String motive() {
12592
).asString();
12693
}
12794

95+
/**
96+
* Find duplicate defects within single source.
97+
* @param index Index of FQNs by source
98+
* @return Stream of defects
99+
*/
100+
private Stream<Defect> duplicateDefects(final Map<Xnav, List<String>> index) {
101+
return index.entrySet().stream()
102+
.flatMap(
103+
entry -> entry.getValue().stream()
104+
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
105+
.entrySet()
106+
.stream()
107+
.filter(e -> e.getValue() > 1L)
108+
.flatMap(
109+
e -> IntStream.range(0, Math.toIntExact(e.getValue()))
110+
.mapToObj(pos -> this.singleDefect(entry.getKey(), e.getKey(), pos))
111+
)
112+
);
113+
}
114+
115+
/**
116+
* Find shared defects between sources.
117+
* @param index Index of FQNs by source
118+
* @return Stream of defects
119+
*/
120+
private Stream<Defect> sharedDefects(final Map<Xnav, List<String>> index) {
121+
final Set<String> checked = ConcurrentHashMap.newKeySet();
122+
return index.entrySet().stream()
123+
.flatMap(
124+
entry -> index.entrySet().stream()
125+
.filter(other -> !Objects.equals(other.getKey(), entry.getKey()))
126+
.filter(
127+
other -> checked.add(
128+
LtAtomIsNotUnique.pairHash(entry.getKey(), other.getKey())
129+
)
130+
)
131+
.flatMap(
132+
other -> other.getValue().stream()
133+
.filter(entry.getValue()::contains)
134+
.flatMap(
135+
aname -> Stream.of(
136+
this.sharedDefect(other.getKey(), entry.getKey(), aname),
137+
this.sharedDefect(entry.getKey(), other.getKey(), aname)
138+
)
139+
)
140+
)
141+
);
142+
}
143+
128144
private Defect singleDefect(final Xnav xml, final String fqn, final int pos) {
129145
return new Defect.Default(
130146
this.name(),
131147
Severity.ERROR,
132-
new OnDefault(new XMLDocument(xml.node())).get(),
148+
new ProgramName(new XMLDocument(xml.node())).get(),
133149
Integer.parseInt(
134150
xml.path(
135151
String.format("//o[@name='%s' and o[@name='λ']]", LtAtomIsNotUnique.oname(fqn))
@@ -145,7 +161,7 @@ private Defect sharedDefect(final Xnav xml, final Xnav original, final String fq
145161
return new Defect.Default(
146162
this.name(),
147163
Severity.ERROR,
148-
new OnDefault(new XMLDocument(xml.node())).get(),
164+
new ProgramName(new XMLDocument(xml.node())).get(),
149165
Integer.parseInt(
150166
xml.path(
151167
String.format("//o[@name='%s' and o[@name='λ']]", LtAtomIsNotUnique.oname(fqn))
@@ -156,7 +172,7 @@ private Defect sharedDefect(final Xnav xml, final Xnav original, final String fq
156172
String.format(
157173
"Atom with FQN \"%s\" is duplicated, original was found in \"%s\"",
158174
fqn,
159-
new OnDefault(new XMLDocument(original.node())).get()
175+
new ProgramName(new XMLDocument(original.node())).get()
160176
)
161177
);
162178
}

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.cactoos.io.ResourceOf;
2121
import org.cactoos.text.IoCheckedText;
2222
import org.cactoos.text.TextOf;
23-
import org.eolang.parser.OnDefault;
2423

2524
/**
2625
* Lint by XSL.
@@ -88,9 +87,8 @@ public String name() {
8887

8988
@Override
9089
public Collection<Defect> defects(final XML xmir) {
91-
final XML report = this.sheet.transform(xmir);
9290
final Collection<Defect> defects = new ArrayList<>(0);
93-
for (final XML defect : LtByXsl.findDefects(report)) {
91+
for (final XML defect : LtByXsl.findDefects(this.sheet.transform(xmir))) {
9492
final Xnav xml = new Xnav(defect.inner());
9593
final Optional<String> sever = xml.attribute("severity").text();
9694
if (sever.isEmpty()) {
@@ -103,7 +101,7 @@ public Collection<Defect> defects(final XML xmir) {
103101
new Defect.Default(
104102
this.rule,
105103
Severity.parsed(sever.get()),
106-
new OnDefault(xmir).get(),
104+
new ProgramName(xmir).get(),
107105
this.lineno(xml),
108106
xml.text().get(),
109107
LtByXsl.experimental(xml)

0 commit comments

Comments
 (0)