Skip to content

chore: enforce InsertNewlineAtEOF in clang-format #4343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertNewlineAtEOF: true
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/clang-format-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ public static List<List<Integer>> allPathsFromSourceToTarget(int vertices, int[]
return nm;
// returns all possible paths from source to destination
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ public static List<TreeSet<Integer>> combination(int n, int k) {
}
return Combination.combination(arr, length);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ public static int indexOfRightMostSetBit(int n) {

return index;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ public class IsEven {
public static boolean isEven(int number) {
return (number & 1) == 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ public static int findNonRepeatingNumber(int[] arr) {
}
return result;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ public class NumbersDifferentSigns {
public static boolean differentSigns(int num1, int num2) {
return (num1 ^ num2) < 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ public static int reverseBits(int n) {
}
return result;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ private void in_order_aux(Node n, ArrayList<Integer> lst) {
lst.add(n.element);
in_order_aux(n.right, lst);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ public static int fibBinet(int n) {
int nthTerm = (int) ((Math.pow(phi, n) - Math.pow(-phi, -n)) / squareRootOf5);
return nthTerm;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ private void showResults() {
public int getCost(int process, int machine) {
return Cost[process][machine];
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ public static double power(double base, int exponent) {
// Recurse with a smaller exponent and multiply with base
return base * power(base, exponent - 1);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ public static List<String> preemptivePriorityScheduling(List<Process> processes)

return ganttChart;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ public static void main(String[] args) {
/*
* References: https://www.geeksforgeeks.org/dual-pivot-quicksort/
*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ public static String appendCount(String res, int count, char ch) {
}
return res;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ void testForFourthcase() {
list2 = list1;
assertIterableEquals(list1, list2);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ void test3() {
String word = "ABCB";
Assertions.assertFalse(ws.exist(board, word));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ void testIndexOfRightMostSetBit() {
assertEquals(-1, IndexOfRightMostSetBit.indexOfRightMostSetBit(0));
assertEquals(3, IndexOfRightMostSetBit.indexOfRightMostSetBit(-40));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ void testNonRepeatingNumberFinder() {
int arr2[] = {12};
assertEquals(12, NonRepeatingNumberFinder.findNonRepeatingNumber(arr2));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ void testSameSignsPositive() {
void testSameSignsNegative() {
assertFalse(NumbersDifferentSigns.differentSigns(-5, -8));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ public void testLargeBinaryToDecimal() {
assertEquals(262144L, BinaryToDecimal.binaryToDecimal(1000000000000000000L));
assertEquals(524287L, BinaryToDecimal.binaryToDecimal(1111111111111111111L));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ void testLeftistHeap() {
heap.clear();
Assertions.assertTrue(heap.isEmpty());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ public void testQue() {
if (element[0]++ != integer) throw new AssertionError();
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ void StrassenMatrixMultiplicationTestNegetiveNumber4x4() {
int[][] actResult = SMM.multiply(A, B);
assertArrayEquals(expResult, actResult);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ void Test3() {
int capacity = 50;
assertEquals(220, knapsackMemoization.knapSack(capacity, weight, value, weight.length));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ public void testOptimalJobScheduling3() {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ public void testIfSumOfTheArrayIsEven1() {
public void testIfSumOfTheArrayIsEven2() {
assertFalse(PartitionProblem.partition(new int[] {1, 2, 3, 8}));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ void testGrahamScan() {
GrahamScan graham = new GrahamScan(points);
assertEquals(expectedResult, graham.hull().toString());
}
}
}
2 changes: 1 addition & 1 deletion src/test/java/com/thealgorithms/maths/AreaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ void testAllIllegalInput() {
-> 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)));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ void isDudeney() {
assertTrue(() -> DudeneyNumber.isDudeney(validDudeneyNumber));
assertFalse(() -> DudeneyNumber.isDudeney(invalidDudeneyNumber));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ void testPowerUsingRecursion() {
assertEquals(97.65625, PowerUsingRecursion.power(2.5, 5));
assertEquals(81, PowerUsingRecursion.power(3, 4));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ void testCountCharacters() {

assertEquals(expectedValue, CountChar.CountCharacters(input));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ void testPreemptivePriorityScheduling() {
// Assert
assertEquals(expectedGanttChart, actualGanttChart);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ private List<ProcessDetails> addProcessesForRR() {

return processDetails;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ void schedulingOf_nothing() {
a.scheduleProcesses();
assertTrue(a.schedule.isEmpty());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ void testSearchValueThatNotExists() {
// check path is the whole list
assertArrayEquals(expectedPath.toArray(), bfs.getVisited().toArray());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ public void testDescending() {
int excepted = 3;
assertEquals(excepted, ans);
}
}
}
2 changes: 1 addition & 1 deletion src/test/java/com/thealgorithms/sorts/BeadSortTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ public void bogoSortDuplicateIntegerArray() {
int[] expectedOutput = {1, 6, 15, 23, 23, 27, 27, 36};
assertArrayEquals(outputArray, expectedOutput);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ public void bucketSortDuplicateIntegerArrayWithNegativeNum() {
int[] expectedOutput = {-36, -15, -1, 6, 23, 23, 27, 27};
assertArrayEquals(outputArray, expectedOutput);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ void quickSortWithStringArrayShouldPass() {
String[] expected = {"ant", "apple", "boss", "cat", "dog", "eat"};
assertArrayEquals(expected, sorted);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ void testFindFirstPatternNull() {
void testFindFirstTextNull() {
assertThrows(NullPointerException.class, () -> HorspoolSearch.findFirst("Hello", null));
}
}
}