Skip to content

Commit f010a47

Browse files
vil02debasishbsws
andauthored
chore: enforce InsertNewlineAtEOF in clang-format (TheAlgorithms#4343)
* style: insert newline at eof * style: use `InsertNewlineAtEOF` in `clang-format` * fix: use `clang-format-16` * chore: update clang-format-lint-action to v0.16.2 --------- Co-authored-by: Debasish Biswas <[email protected]>
1 parent 78ca465 commit f010a47

Some content is hidden

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

42 files changed

+43
-42
lines changed

.clang-format

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ IndentGotoLabels: true
8383
IndentPPDirectives: None
8484
IndentWidth: 4
8585
IndentWrappedFunctionNames: false
86+
InsertNewlineAtEOF: true
8687
JavaScriptQuotes: Leave
8788
JavaScriptWrapImports: true
8889
KeepEmptyLinesAtTheStartOfBlocks: true

.github/workflows/clang-format-lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ jobs:
99

1010
steps:
1111
- uses: actions/checkout@v3
12-
- uses: DoozyX/clang-format-lint-action@v0.13
12+
- uses: DoozyX/clang-format-lint-action@v0.16.2
1313
with:
1414
source: './src'
1515
extensions: 'java'
16-
clangFormatVersion: 12
16+
clangFormatVersion: 16

src/main/java/com/thealgorithms/backtracking/AllPathsFromSourceToTarget.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@ public static List<List<Integer>> allPathsFromSourceToTarget(int vertices, int[]
9898
return nm;
9999
// returns all possible paths from source to destination
100100
}
101-
}
101+
}

src/main/java/com/thealgorithms/backtracking/ArrayCombination.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ public static List<TreeSet<Integer>> combination(int n, int k) {
2626
}
2727
return Combination.combination(arr, length);
2828
}
29-
}
29+
}

src/main/java/com/thealgorithms/bitmanipulation/IndexOfRightMostSetBit.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ public static int indexOfRightMostSetBit(int n) {
2525

2626
return index;
2727
}
28-
}
28+
}

src/main/java/com/thealgorithms/bitmanipulation/IsEven.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ public class IsEven {
99
public static boolean isEven(int number) {
1010
return (number & 1) == 0;
1111
}
12-
}
12+
}

src/main/java/com/thealgorithms/bitmanipulation/NonRepeatingNumberFinder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ public static int findNonRepeatingNumber(int[] arr) {
1414
}
1515
return result;
1616
}
17-
}
17+
}

src/main/java/com/thealgorithms/bitmanipulation/NumbersDifferentSigns.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ public class NumbersDifferentSigns {
1010
public static boolean differentSigns(int num1, int num2) {
1111
return (num1 ^ num2) < 0;
1212
}
13-
}
13+
}

src/main/java/com/thealgorithms/bitmanipulation/ReverseBits.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ public static int reverseBits(int n) {
1717
}
1818
return result;
1919
}
20-
}
20+
}

src/main/java/com/thealgorithms/datastructures/heaps/LeftistHeap.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,4 @@ private void in_order_aux(Node n, ArrayList<Integer> lst) {
111111
lst.add(n.element);
112112
in_order_aux(n.right, lst);
113113
}
114-
}
114+
}

src/main/java/com/thealgorithms/dynamicprogramming/Fibonacci.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,4 @@ public static int fibBinet(int n) {
109109
int nthTerm = (int) ((Math.pow(phi, n) - Math.pow(-phi, -n)) / squareRootOf5);
110110
return nthTerm;
111111
}
112-
}
112+
}

src/main/java/com/thealgorithms/dynamicprogramming/OptimalJobScheduling.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,4 @@ private void showResults() {
126126
public int getCost(int process, int machine) {
127127
return Cost[process][machine];
128128
}
129-
}
129+
}

src/main/java/com/thealgorithms/maths/PowerUsingRecursion.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ public static double power(double base, int exponent) {
1717
// Recurse with a smaller exponent and multiply with base
1818
return base * power(base, exponent - 1);
1919
}
20-
}
20+
}

src/main/java/com/thealgorithms/scheduling/PreemptivePriorityScheduling.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ public static List<String> preemptivePriorityScheduling(List<Process> processes)
5151

5252
return ganttChart;
5353
}
54-
}
54+
}

src/main/java/com/thealgorithms/sorts/DualPivotQuickSort.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,4 @@ public static void main(String[] args) {
103103
/*
104104
* References: https://www.geeksforgeeks.org/dual-pivot-quicksort/
105105
*/
106-
}
106+
}

src/main/java/com/thealgorithms/strings/StringCompression.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ public static String appendCount(String res, int count, char ch) {
5858
}
5959
return res;
6060
}
61-
}
61+
}

src/test/java/com/thealgorithms/backtracking/AllPathsFromSourceToTargetTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ void testForFourthcase() {
5454
list2 = list1;
5555
assertIterableEquals(list1, list2);
5656
}
57-
}
57+
}

src/test/java/com/thealgorithms/backtracking/WordSearchTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ void test3() {
2929
String word = "ABCB";
3030
Assertions.assertFalse(ws.exist(board, word));
3131
}
32-
}
32+
}

src/test/java/com/thealgorithms/bitmanipulation/IndexOfRightMostSetBitTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ void testIndexOfRightMostSetBit() {
1717
assertEquals(-1, IndexOfRightMostSetBit.indexOfRightMostSetBit(0));
1818
assertEquals(3, IndexOfRightMostSetBit.indexOfRightMostSetBit(-40));
1919
}
20-
}
20+
}

src/test/java/com/thealgorithms/bitmanipulation/NonRepeatingNumberFinderTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ void testNonRepeatingNumberFinder() {
2020
int arr2[] = {12};
2121
assertEquals(12, NonRepeatingNumberFinder.findNonRepeatingNumber(arr2));
2222
}
23-
}
23+
}

src/test/java/com/thealgorithms/bitmanipulation/NumbersDifferentSignsTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ void testSameSignsPositive() {
3030
void testSameSignsNegative() {
3131
assertFalse(NumbersDifferentSigns.differentSigns(-5, -8));
3232
}
33-
}
33+
}

src/test/java/com/thealgorithms/conversions/BinaryToDecimalTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ public void testLargeBinaryToDecimal() {
3030
assertEquals(262144L, BinaryToDecimal.binaryToDecimal(1000000000000000000L));
3131
assertEquals(524287L, BinaryToDecimal.binaryToDecimal(1111111111111111111L));
3232
}
33-
}
33+
}

src/test/java/com/thealgorithms/datastructures/heaps/LeftistHeapTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ void testLeftistHeap() {
2525
heap.clear();
2626
Assertions.assertTrue(heap.isEmpty());
2727
}
28-
}
28+
}

src/test/java/com/thealgorithms/datastructures/queues/LinkedQueueTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ public void testQue() {
2323
if (element[0]++ != integer) throw new AssertionError();
2424
});
2525
}
26-
}
26+
}

src/test/java/com/thealgorithms/divideandconquer/StrassenMatrixMultiplicationTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ void StrassenMatrixMultiplicationTestNegetiveNumber4x4() {
3737
int[][] actResult = SMM.multiply(A, B);
3838
assertArrayEquals(expResult, actResult);
3939
}
40-
}
40+
}

src/test/java/com/thealgorithms/dynamicprogramming/KnapsackMemoizationTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ void Test3() {
3131
int capacity = 50;
3232
assertEquals(220, knapsackMemoization.knapSack(capacity, weight, value, weight.length));
3333
}
34-
}
34+
}

src/test/java/com/thealgorithms/dynamicprogramming/OptimalJobSchedulingTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,4 @@ public void testOptimalJobScheduling3() {
9595
}
9696
}
9797
}
98-
}
98+
}

src/test/java/com/thealgorithms/dynamicprogramming/PartitionProblemTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ public void testIfSumOfTheArrayIsEven1() {
2121
public void testIfSumOfTheArrayIsEven2() {
2222
assertFalse(PartitionProblem.partition(new int[] {1, 2, 3, 8}));
2323
}
24-
}
24+
}

src/test/java/com/thealgorithms/geometry/GrahamScanTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ void testGrahamScan() {
1313
GrahamScan graham = new GrahamScan(points);
1414
assertEquals(expectedResult, graham.hull().toString());
1515
}
16-
}
16+
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@ void testAllIllegalInput() {
9898
-> assertThrows(IllegalArgumentException.class, () -> Area.surfaceAreaCircle(0)),
9999
() -> assertThrows(IllegalArgumentException.class, () -> Area.surfaceAreaHemisphere(0)), () -> assertThrows(IllegalArgumentException.class, () -> Area.surfaceAreaCone(1, 0)), () -> assertThrows(IllegalArgumentException.class, () -> Area.surfaceAreaCone(0, 1)));
100100
}
101-
}
101+
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ void isDudeney() {
1414
assertTrue(() -> DudeneyNumber.isDudeney(validDudeneyNumber));
1515
assertFalse(() -> DudeneyNumber.isDudeney(invalidDudeneyNumber));
1616
}
17-
}
17+
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ void testPowerUsingRecursion() {
1717
assertEquals(97.65625, PowerUsingRecursion.power(2.5, 5));
1818
assertEquals(81, PowerUsingRecursion.power(3, 4));
1919
}
20-
}
20+
}

src/test/java/com/thealgorithms/others/CountCharTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ void testCountCharacters() {
1313

1414
assertEquals(expectedValue, CountChar.CountCharacters(input));
1515
}
16-
}
16+
}

src/test/java/com/thealgorithms/scheduling/PreemptivePrioritySchedulingTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ void testPreemptivePriorityScheduling() {
2929
// Assert
3030
assertEquals(expectedGanttChart, actualGanttChart);
3131
}
32-
}
32+
}

src/test/java/com/thealgorithms/scheduling/RRSchedulingTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ private List<ProcessDetails> addProcessesForRR() {
6060

6161
return processDetails;
6262
}
63-
}
63+
}

src/test/java/com/thealgorithms/scheduling/SJFSchedulingTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,4 @@ void schedulingOf_nothing() {
106106
a.scheduleProcesses();
107107
assertTrue(a.schedule.isEmpty());
108108
}
109-
}
109+
}

src/test/java/com/thealgorithms/searches/BreadthFirstSearchTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,4 @@ void testSearchValueThatNotExists() {
9999
// check path is the whole list
100100
assertArrayEquals(expectedPath.toArray(), bfs.getVisited().toArray());
101101
}
102-
}
102+
}

src/test/java/com/thealgorithms/searches/sortOrderAgnosticBinarySearchTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ public void testDescending() {
2323
int excepted = 3;
2424
assertEquals(excepted, ans);
2525
}
26-
}
26+
}

src/test/java/com/thealgorithms/sorts/BeadSortTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ public void bogoSortDuplicateIntegerArray() {
3939
int[] expectedOutput = {1, 6, 15, 23, 23, 27, 27, 36};
4040
assertArrayEquals(outputArray, expectedOutput);
4141
}
42-
}
42+
}

src/test/java/com/thealgorithms/sorts/BucketSortTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ public void bucketSortDuplicateIntegerArrayWithNegativeNum() {
4545
int[] expectedOutput = {-36, -15, -1, 6, 23, 23, 27, 27};
4646
assertArrayEquals(outputArray, expectedOutput);
4747
}
48-
}
48+
}

src/test/java/com/thealgorithms/sorts/DualPivotQuickSortTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ void quickSortWithStringArrayShouldPass() {
5959
String[] expected = {"ant", "apple", "boss", "cat", "dog", "eat"};
6060
assertArrayEquals(expected, sorted);
6161
}
62-
}
62+
}

src/test/java/com/thealgorithms/strings/HorspoolSearchTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ void testFindFirstPatternNull() {
8383
void testFindFirstTextNull() {
8484
assertThrows(NullPointerException.class, () -> HorspoolSearch.findFirst("Hello", null));
8585
}
86-
}
86+
}

0 commit comments

Comments
 (0)