chore: enforce InsertNewlineAtEOF in clang-format (#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 <debasishbsws.dev@gmail.com>
This commit is contained in:
Piotr Idzik 2023-09-01 06:10:46 +02:00 committed by GitHub
parent 78ca465b1e
commit f010a47608
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 43 additions and 42 deletions

View File

@ -83,6 +83,7 @@ IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertNewlineAtEOF: true
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true

View File

@ -9,8 +9,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: DoozyX/clang-format-lint-action@v0.13
- uses: DoozyX/clang-format-lint-action@v0.16.2
with:
source: './src'
extensions: 'java'
clangFormatVersion: 12
clangFormatVersion: 16

View File

@ -98,4 +98,4 @@ public class AllPathsFromSourceToTarget {
return nm;
// returns all possible paths from source to destination
}
}
}

View File

@ -26,4 +26,4 @@ public class ArrayCombination {
}
return Combination.combination(arr, length);
}
}
}

View File

@ -25,4 +25,4 @@ public class IndexOfRightMostSetBit {
return index;
}
}
}

View File

@ -9,4 +9,4 @@ public class IsEven {
public static boolean isEven(int number) {
return (number & 1) == 0;
}
}
}

View File

@ -14,4 +14,4 @@ public class NonRepeatingNumberFinder {
}
return result;
}
}
}

View File

@ -10,4 +10,4 @@ public class NumbersDifferentSigns {
public static boolean differentSigns(int num1, int num2) {
return (num1 ^ num2) < 0;
}
}
}

View File

@ -17,4 +17,4 @@ public class ReverseBits {
}
return result;
}
}
}

View File

@ -111,4 +111,4 @@ public class LeftistHeap {
lst.add(n.element);
in_order_aux(n.right, lst);
}
}
}

View File

@ -109,4 +109,4 @@ public class Fibonacci {
int nthTerm = (int) ((Math.pow(phi, n) - Math.pow(-phi, -n)) / squareRootOf5);
return nthTerm;
}
}
}

View File

@ -126,4 +126,4 @@ public class OptimalJobScheduling {
public int getCost(int process, int machine) {
return Cost[process][machine];
}
}
}

View File

@ -17,4 +17,4 @@ public class PowerUsingRecursion {
// Recurse with a smaller exponent and multiply with base
return base * power(base, exponent - 1);
}
}
}

View File

@ -51,4 +51,4 @@ public class PreemptivePriorityScheduling {
return ganttChart;
}
}
}

View File

@ -103,4 +103,4 @@ public class DualPivotQuickSort implements SortAlgorithm {
/*
* References: https://www.geeksforgeeks.org/dual-pivot-quicksort/
*/
}
}

View File

@ -58,4 +58,4 @@ public class StringCompression {
}
return res;
}
}
}

View File

@ -54,4 +54,4 @@ public class AllPathsFromSourceToTargetTest {
list2 = list1;
assertIterableEquals(list1, list2);
}
}
}

View File

@ -29,4 +29,4 @@ public class WordSearchTest {
String word = "ABCB";
Assertions.assertFalse(ws.exist(board, word));
}
}
}

View File

@ -17,4 +17,4 @@ class IndexOfRightMostSetBitTest {
assertEquals(-1, IndexOfRightMostSetBit.indexOfRightMostSetBit(0));
assertEquals(3, IndexOfRightMostSetBit.indexOfRightMostSetBit(-40));
}
}
}

View File

@ -20,4 +20,4 @@ class NonRepeatingNumberFinderTest {
int arr2[] = {12};
assertEquals(12, NonRepeatingNumberFinder.findNonRepeatingNumber(arr2));
}
}
}

View File

@ -30,4 +30,4 @@ class NumbersDifferentSignsTest {
void testSameSignsNegative() {
assertFalse(NumbersDifferentSigns.differentSigns(-5, -8));
}
}
}

View File

@ -30,4 +30,4 @@ public class BinaryToDecimalTest {
assertEquals(262144L, BinaryToDecimal.binaryToDecimal(1000000000000000000L));
assertEquals(524287L, BinaryToDecimal.binaryToDecimal(1111111111111111111L));
}
}
}

View File

@ -25,4 +25,4 @@ public class LeftistHeapTest {
heap.clear();
Assertions.assertTrue(heap.isEmpty());
}
}
}

View File

@ -23,4 +23,4 @@ class LinkedQueueTest {
if (element[0]++ != integer) throw new AssertionError();
});
}
}
}

View File

@ -37,4 +37,4 @@ class StrassenMatrixMultiplicationTest {
int[][] actResult = SMM.multiply(A, B);
assertArrayEquals(expResult, actResult);
}
}
}

View File

@ -31,4 +31,4 @@ public class KnapsackMemoizationTest {
int capacity = 50;
assertEquals(220, knapsackMemoization.knapSack(capacity, weight, value, weight.length));
}
}
}

View File

@ -95,4 +95,4 @@ public class OptimalJobSchedulingTest {
}
}
}
}
}

View File

@ -21,4 +21,4 @@ class PartitionProblemTest {
public void testIfSumOfTheArrayIsEven2() {
assertFalse(PartitionProblem.partition(new int[] {1, 2, 3, 8}));
}
}
}

View File

@ -13,4 +13,4 @@ public class GrahamScanTest {
GrahamScan graham = new GrahamScan(points);
assertEquals(expectedResult, graham.hull().toString());
}
}
}

View File

@ -98,4 +98,4 @@ class AreaTest {
-> assertThrows(IllegalArgumentException.class, () -> Area.surfaceAreaCircle(0)),
() -> assertThrows(IllegalArgumentException.class, () -> Area.surfaceAreaHemisphere(0)), () -> assertThrows(IllegalArgumentException.class, () -> Area.surfaceAreaCone(1, 0)), () -> assertThrows(IllegalArgumentException.class, () -> Area.surfaceAreaCone(0, 1)));
}
}
}

View File

@ -14,4 +14,4 @@ class DudeneyNumberTest {
assertTrue(() -> DudeneyNumber.isDudeney(validDudeneyNumber));
assertFalse(() -> DudeneyNumber.isDudeney(invalidDudeneyNumber));
}
}
}

View File

@ -17,4 +17,4 @@ class PowerUsingRecursionTest {
assertEquals(97.65625, PowerUsingRecursion.power(2.5, 5));
assertEquals(81, PowerUsingRecursion.power(3, 4));
}
}
}

View File

@ -13,4 +13,4 @@ class CountCharTest {
assertEquals(expectedValue, CountChar.CountCharacters(input));
}
}
}

View File

@ -29,4 +29,4 @@ class PreemptivePrioritySchedulingTest {
// Assert
assertEquals(expectedGanttChart, actualGanttChart);
}
}
}

View File

@ -60,4 +60,4 @@ class RRSchedulingTest {
return processDetails;
}
}
}

View File

@ -106,4 +106,4 @@ class SJFSchedulingTest {
a.scheduleProcesses();
assertTrue(a.schedule.isEmpty());
}
}
}

View File

@ -99,4 +99,4 @@ public class BreadthFirstSearchTest {
// check path is the whole list
assertArrayEquals(expectedPath.toArray(), bfs.getVisited().toArray());
}
}
}

View File

@ -23,4 +23,4 @@ public class sortOrderAgnosticBinarySearchTest {
int excepted = 3;
assertEquals(excepted, ans);
}
}
}

View File

@ -39,4 +39,4 @@ public class BeadSortTest {
int[] expectedOutput = {1, 6, 15, 23, 23, 27, 27, 36};
assertArrayEquals(outputArray, expectedOutput);
}
}
}

View File

@ -45,4 +45,4 @@ public class BucketSortTest {
int[] expectedOutput = {-36, -15, -1, 6, 23, 23, 27, 27};
assertArrayEquals(outputArray, expectedOutput);
}
}
}

View File

@ -59,4 +59,4 @@ class DualPivotQuickSortTest {
String[] expected = {"ant", "apple", "boss", "cat", "dog", "eat"};
assertArrayEquals(expected, sorted);
}
}
}

View File

@ -83,4 +83,4 @@ class HorspoolSearchTest {
void testFindFirstTextNull() {
assertThrows(NullPointerException.class, () -> HorspoolSearch.findFirst("Hello", null));
}
}
}