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 IndentPPDirectives: None
IndentWidth: 4 IndentWidth: 4
IndentWrappedFunctionNames: false IndentWrappedFunctionNames: false
InsertNewlineAtEOF: true
JavaScriptQuotes: Leave JavaScriptQuotes: Leave
JavaScriptWrapImports: true JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true KeepEmptyLinesAtTheStartOfBlocks: true

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -111,4 +111,4 @@ public class LeftistHeap {
lst.add(n.element); lst.add(n.element);
in_order_aux(n.right, lst); 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); int nthTerm = (int) ((Math.pow(phi, n) - Math.pow(-phi, -n)) / squareRootOf5);
return nthTerm; return nthTerm;
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,4 +31,4 @@ public class KnapsackMemoizationTest {
int capacity = 50; int capacity = 50;
assertEquals(220, knapsackMemoization.knapSack(capacity, weight, value, weight.length)); 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() { public void testIfSumOfTheArrayIsEven2() {
assertFalse(PartitionProblem.partition(new int[] {1, 2, 3, 8})); assertFalse(PartitionProblem.partition(new int[] {1, 2, 3, 8}));
} }
} }

View File

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

View File

@ -98,4 +98,4 @@ class AreaTest {
-> assertThrows(IllegalArgumentException.class, () -> Area.surfaceAreaCircle(0)), -> 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))); () -> 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)); assertTrue(() -> DudeneyNumber.isDudeney(validDudeneyNumber));
assertFalse(() -> DudeneyNumber.isDudeney(invalidDudeneyNumber)); assertFalse(() -> DudeneyNumber.isDudeney(invalidDudeneyNumber));
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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