Skip to content

Commit e2cbf27

Browse files
committed
Made style changes
According to Clang's fugly ass suggestions.
1 parent 3230715 commit e2cbf27

5 files changed

Lines changed: 18 additions & 68 deletions

File tree

pom.xml

Lines changed: 6 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@
5555
<artifactId>commons-collections4</artifactId>
5656
<version>4.5.0</version>
5757
</dependency>
58+
<dependency>
59+
<groupId>com.github.spotbugs</groupId>
60+
<artifactId>spotbugs-annotations</artifactId>
61+
<version>4.9.6</version>
62+
<scope>test</scope>
63+
</dependency>
5864
</dependencies>
5965

6066
<build>
@@ -202,62 +208,4 @@
202208
</plugin>
203209
</plugins>
204210
</build>
205-
206-
<profiles>
207-
<profile>
208-
<id>jolla-dev</id>
209-
<build>
210-
<plugins>
211-
<!-- Surefire -->
212-
<plugin>
213-
<artifactId>maven-surefire-plugin</artifactId>
214-
<configuration>
215-
<includes>
216-
<include>com/thealgorithms/datastructures/trees/**/*Test.java</include>
217-
</includes>
218-
</configuration>
219-
</plugin>
220-
221-
<!-- Pitest -->
222-
<plugin>
223-
<groupId>org.pitest</groupId>
224-
<artifactId>pitest-maven</artifactId>
225-
<configuration>
226-
<targetClasses>com.thealgorithms.datastructures.trees.LCA</targetClasses>
227-
<targetTests>com.thealgorithms.datastructures.trees.LCATest</targetTests>
228-
</configuration>
229-
<executions>
230-
<execution>
231-
<id>pitest</id>
232-
<phase>verify</phase> <!-- Runs only during verify -->
233-
<goals>
234-
<goal>mutationCoverage</goal>
235-
</goals>
236-
</execution>
237-
</executions>
238-
</plugin>
239-
240-
<!-- JaCoCo -->
241-
<plugin>
242-
<groupId>org.jacoco</groupId>
243-
<artifactId>jacoco-maven-plugin</artifactId>
244-
<executions>
245-
<execution>
246-
<goals>
247-
<goal>prepare-agent</goal>
248-
</goals>
249-
</execution>
250-
<execution>
251-
<id>generate-code-coverage-report</id>
252-
<phase>verify</phase> <!-- Runs only during verify -->
253-
<goals>
254-
<goal>report</goal>
255-
</goals>
256-
</execution>
257-
</executions>
258-
</plugin>
259-
</plugins>
260-
</build>
261-
</profile>
262-
</profiles>
263211
</project>

src/main/java/com/thealgorithms/datastructures/trees/LCA.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ private LCA() {
88
}
99

1010
public static void main(String[] args) {
11-
Scanner SCANNER = new Scanner(System.in);
11+
Scanner scanner = new Scanner(System.in);
1212

1313
// The adjacency list representation of a tree:
1414
ArrayList<ArrayList<Integer>> adj = new ArrayList<>();
1515

1616
// v is the number of vertices and e is the number of edges
17-
int v = SCANNER.nextInt();
17+
int v = scanner.nextInt();
1818
int e = v - 1;
1919

2020
for (int i = 0; i < v; i++) {
@@ -25,8 +25,8 @@ public static void main(String[] args) {
2525
int to;
2626
int from;
2727
for (int i = 0; i < e; i++) {
28-
to = SCANNER.nextInt();
29-
from = SCANNER.nextInt();
28+
to = scanner.nextInt();
29+
from = scanner.nextInt();
3030

3131
adj.get(to).add(from);
3232
adj.get(from).add(to);
@@ -42,8 +42,8 @@ public static void main(String[] args) {
4242
dfs(adj, 0, -1, parent, depth);
4343

4444
// Inputting the two vertices whose LCA is to be calculated
45-
int v1 = SCANNER.nextInt();
46-
int v2 = SCANNER.nextInt();
45+
int v1 = scanner.nextInt();
46+
int v2 = scanner.nextInt();
4747

4848
// Outputting the LCA
4949
System.out.println(getLCA(v1, v2, depth, parent));

src/test/java/com/thealgorithms/ciphers/MyPlayfairCipherTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
public class MyPlayfairCipherTest {
99
private PlayfairCipher playfair;
10-
private final String keyword = "KEYWORD";
10+
private static final String KEYWORD = "KEYWORD";
1111

1212
@BeforeEach
1313
public void setup() {
14-
playfair = new PlayfairCipher(keyword);
14+
playfair = new PlayfairCipher(KEYWORD);
1515
}
1616

1717
@Test
1818
void shouldEncryptAndDecryptDuringSameRowDigraph() {
19-
String plaintext = keyword.substring(0, 2);
19+
String plaintext = KEYWORD.substring(0, 2);
2020

2121
String encrypted = playfair.encrypt(plaintext);
2222
String decrypted = playfair.decrypt(encrypted);

src/test/java/com/thealgorithms/datastructures/trees/LCATest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class LCATest {
2424
* 9 8
2525
* <pre>
2626
*/
27-
private final static String TREE = "10\n0\n1\n0\n2\n1\n5\n5\n6\n2\n4\n2\n3\n3\n7\n7\n9\n7\n8\n";
27+
private static final String TREE = "10\n0\n1\n0\n2\n1\n5\n5\n6\n2\n4\n2\n3\n3\n7\n7\n9\n7\n8\n";
2828

2929
/* ========================
3030
Tests

src/test/java/com/thealgorithms/maths/RomanNumeralUtilConstructorTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
import java.lang.reflect.Constructor;
66
import org.junit.jupiter.api.Test;
7+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
78

89
// Covers the private constructor for code coverage tools
910
public class RomanNumeralUtilConstructorTest {
11+
@SuppressFBWarnings("RFI_SET_ACCESSIBLE")
1012
@Test
1113
void shouldInvokePrivateConstructor() throws Exception {
1214
Constructor<RomanNumeralUtil> constructor = RomanNumeralUtil.class.getDeclaredConstructor();

0 commit comments

Comments
 (0)