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:
parent
78ca465b1e
commit
f010a47608
@ -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
|
||||||
|
4
.github/workflows/clang-format-lint.yml
vendored
4
.github/workflows/clang-format-lint.yml
vendored
@ -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
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,4 +26,4 @@ public class ArrayCombination {
|
|||||||
}
|
}
|
||||||
return Combination.combination(arr, length);
|
return Combination.combination(arr, length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,4 +25,4 @@ public class IndexOfRightMostSetBit {
|
|||||||
|
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,4 +14,4 @@ public class NonRepeatingNumberFinder {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,4 +17,4 @@ public class ReverseBits {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,4 +51,4 @@ public class PreemptivePriorityScheduling {
|
|||||||
|
|
||||||
return ganttChart;
|
return ganttChart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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/
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
@ -58,4 +58,4 @@ public class StringCompression {
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,4 +54,4 @@ public class AllPathsFromSourceToTargetTest {
|
|||||||
list2 = list1;
|
list2 = list1;
|
||||||
assertIterableEquals(list1, list2);
|
assertIterableEquals(list1, list2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,4 +20,4 @@ class NonRepeatingNumberFinderTest {
|
|||||||
int arr2[] = {12};
|
int arr2[] = {12};
|
||||||
assertEquals(12, NonRepeatingNumberFinder.findNonRepeatingNumber(arr2));
|
assertEquals(12, NonRepeatingNumberFinder.findNonRepeatingNumber(arr2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,4 +30,4 @@ class NumbersDifferentSignsTest {
|
|||||||
void testSameSignsNegative() {
|
void testSameSignsNegative() {
|
||||||
assertFalse(NumbersDifferentSigns.differentSigns(-5, -8));
|
assertFalse(NumbersDifferentSigns.differentSigns(-5, -8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,4 +25,4 @@ public class LeftistHeapTest {
|
|||||||
heap.clear();
|
heap.clear();
|
||||||
Assertions.assertTrue(heap.isEmpty());
|
Assertions.assertTrue(heap.isEmpty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,4 +23,4 @@ class LinkedQueueTest {
|
|||||||
if (element[0]++ != integer) throw new AssertionError();
|
if (element[0]++ != integer) throw new AssertionError();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,4 +37,4 @@ class StrassenMatrixMultiplicationTest {
|
|||||||
int[][] actResult = SMM.multiply(A, B);
|
int[][] actResult = SMM.multiply(A, B);
|
||||||
assertArrayEquals(expResult, actResult);
|
assertArrayEquals(expResult, actResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,4 +95,4 @@ public class OptimalJobSchedulingTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,4 +14,4 @@ class DudeneyNumberTest {
|
|||||||
assertTrue(() -> DudeneyNumber.isDudeney(validDudeneyNumber));
|
assertTrue(() -> DudeneyNumber.isDudeney(validDudeneyNumber));
|
||||||
assertFalse(() -> DudeneyNumber.isDudeney(invalidDudeneyNumber));
|
assertFalse(() -> DudeneyNumber.isDudeney(invalidDudeneyNumber));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,4 +13,4 @@ class CountCharTest {
|
|||||||
|
|
||||||
assertEquals(expectedValue, CountChar.CountCharacters(input));
|
assertEquals(expectedValue, CountChar.CountCharacters(input));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,4 +29,4 @@ class PreemptivePrioritySchedulingTest {
|
|||||||
// Assert
|
// Assert
|
||||||
assertEquals(expectedGanttChart, actualGanttChart);
|
assertEquals(expectedGanttChart, actualGanttChart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,4 +60,4 @@ class RRSchedulingTest {
|
|||||||
|
|
||||||
return processDetails;
|
return processDetails;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,4 +106,4 @@ class SJFSchedulingTest {
|
|||||||
a.scheduleProcesses();
|
a.scheduleProcesses();
|
||||||
assertTrue(a.schedule.isEmpty());
|
assertTrue(a.schedule.isEmpty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,4 +23,4 @@ public class sortOrderAgnosticBinarySearchTest {
|
|||||||
int excepted = 3;
|
int excepted = 3;
|
||||||
assertEquals(excepted, ans);
|
assertEquals(excepted, ans);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,4 +83,4 @@ class HorspoolSearchTest {
|
|||||||
void testFindFirstTextNull() {
|
void testFindFirstTextNull() {
|
||||||
assertThrows(NullPointerException.class, () -> HorspoolSearch.findFirst("Hello", null));
|
assertThrows(NullPointerException.class, () -> HorspoolSearch.findFirst("Hello", null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user