diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 39a690f9aec..faf5dd6aa9b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,3 +33,5 @@ jobs: run: mvn checkstyle:check - name: SpotBugs run: mvn spotbugs:check + - name: PMD + run: mvn pmd:check diff --git a/pmd-exclude.properties b/pmd-exclude.properties new file mode 100644 index 00000000000..fb8470d8ba8 --- /dev/null +++ b/pmd-exclude.properties @@ -0,0 +1,95 @@ +com.thealgorithms.bitmanipulation.SingleBitOperations=UselessParentheses +com.thealgorithms.ciphers.AffineCipher=UselessParentheses +com.thealgorithms.ciphers.ColumnarTranspositionCipher=UnnecessaryFullyQualifiedName +com.thealgorithms.ciphers.DES=UselessParentheses +com.thealgorithms.ciphers.HillCipher=UselessParentheses +com.thealgorithms.ciphers.RSA=UselessParentheses +com.thealgorithms.conversions.AnyBaseToAnyBase=UselessParentheses +com.thealgorithms.conversions.AnytoAny=UselessParentheses +com.thealgorithms.conversions.HexToOct=UselessParentheses +com.thealgorithms.conversions.IntegerToRoman=UnnecessaryFullyQualifiedName +com.thealgorithms.datastructures.crdt.LWWElementSet=UselessParentheses +com.thealgorithms.datastructures.crdt.Pair=UnusedPrivateField +com.thealgorithms.datastructures.graphs.A_Star=UselessParentheses +com.thealgorithms.datastructures.graphs.AdjacencyMatrixGraph=CollapsibleIfStatements,UnnecessaryFullyQualifiedName,UselessParentheses +com.thealgorithms.datastructures.graphs.BipartiteGrapfDFS=CollapsibleIfStatements +com.thealgorithms.datastructures.graphs.Kruskal=UselessParentheses +com.thealgorithms.datastructures.hashmap.hashing.HashMapCuckooHashing=UselessParentheses +com.thealgorithms.datastructures.heaps.FibonacciHeap=UselessParentheses +com.thealgorithms.datastructures.heaps.HeapElement=UselessParentheses +com.thealgorithms.datastructures.heaps.HeapNode=UselessParentheses +com.thealgorithms.datastructures.lists.DoublyLinkedList=UselessParentheses +com.thealgorithms.datastructures.lists.SearchSinglyLinkedListRecursion=UselessParentheses +com.thealgorithms.datastructures.lists.SinglyLinkedList=UnusedLocalVariable +com.thealgorithms.datastructures.queues.PriorityQueue=UselessParentheses +com.thealgorithms.datastructures.stacks.NodeStack=UnnecessaryFullyQualifiedName,UnusedFormalParameter +com.thealgorithms.datastructures.stacks.StackArray=UselessParentheses +com.thealgorithms.datastructures.trees.CheckBinaryTreeIsValidBST=UselessParentheses +com.thealgorithms.datastructures.trees.Point=OverrideBothEqualsAndHashcode +com.thealgorithms.datastructures.trees.SegmentTree=UselessParentheses +com.thealgorithms.devutils.nodes.LargeTreeNode=UselessParentheses +com.thealgorithms.devutils.nodes.SimpleNode=UselessParentheses +com.thealgorithms.devutils.nodes.SimpleTreeNode=UselessParentheses +com.thealgorithms.devutils.nodes.TreeNode=UselessParentheses +com.thealgorithms.divideandconquer.ClosestPair=UnnecessaryFullyQualifiedName,UselessParentheses +com.thealgorithms.divideandconquer.Point=UselessParentheses +com.thealgorithms.dynamicprogramming.KnapsackMemoization=UselessParentheses +com.thealgorithms.dynamicprogramming.MatrixChainMultiplication=UselessParentheses +com.thealgorithms.dynamicprogramming.ShortestSuperSequence=UselessParentheses +com.thealgorithms.dynamicprogramming.UniquePaths=UnnecessarySemicolon +com.thealgorithms.dynamicprogramming.WineProblem=UselessParentheses +com.thealgorithms.maths.BinomialCoefficient=UselessParentheses +com.thealgorithms.maths.Complex=UselessParentheses +com.thealgorithms.maths.DistanceFormulaTest=UnnecessaryFullyQualifiedName +com.thealgorithms.maths.DudeneyNumber=UselessParentheses +com.thealgorithms.maths.FibonacciJavaStreamsTest=BigIntegerInstantiation +com.thealgorithms.maths.Gaussian=UselessParentheses +com.thealgorithms.maths.GcdSolutionWrapper=UselessParentheses +com.thealgorithms.maths.HeronsFormula=UselessParentheses +com.thealgorithms.maths.KaprekarNumbers=UselessParentheses +com.thealgorithms.maths.KeithNumber=UselessParentheses +com.thealgorithms.maths.LeonardoNumber=UselessParentheses +com.thealgorithms.maths.LinearDiophantineEquationsSolver=UselessParentheses +com.thealgorithms.maths.MatrixUtil=BigIntegerInstantiation,UselessParentheses +com.thealgorithms.maths.RomanNumeralUtil=UselessParentheses +com.thealgorithms.maths.SecondMinMax=UselessParentheses +com.thealgorithms.maths.SecondMinMaxTest=UnnecessaryFullyQualifiedName +com.thealgorithms.maths.StandardDeviation=UselessParentheses +com.thealgorithms.maths.SumOfArithmeticSeries=UselessParentheses +com.thealgorithms.maths.TrinomialTriangle=UselessParentheses +com.thealgorithms.maths.VampireNumber=CollapsibleIfStatements +com.thealgorithms.maths.Volume=UselessParentheses +com.thealgorithms.matrixexponentiation.Fibonacci=UnnecessaryFullyQualifiedName +com.thealgorithms.misc.Sparsity=UselessParentheses +com.thealgorithms.misc.ThreeSumProblem=UselessParentheses +com.thealgorithms.misc.WordBoggle=UselessParentheses +com.thealgorithms.others.CRC16=UselessParentheses +com.thealgorithms.others.Damm=UnnecessaryFullyQualifiedName +com.thealgorithms.others.Luhn=UnnecessaryFullyQualifiedName +com.thealgorithms.others.Mandelbrot=UselessParentheses +com.thealgorithms.others.MaximumSumOfDistinctSubarraysWithLengthK=CollapsibleIfStatements +com.thealgorithms.others.MiniMaxAlgorithm=UselessParentheses +com.thealgorithms.others.PageRank=UselessParentheses +com.thealgorithms.others.PerlinNoise=UselessParentheses +com.thealgorithms.others.QueueUsingTwoStacks=UselessParentheses +com.thealgorithms.others.QueueWithStack=UselessParentheses +com.thealgorithms.others.Trieac=UselessParentheses +com.thealgorithms.others.Verhoeff=UnnecessaryFullyQualifiedName +com.thealgorithms.searches.InterpolationSearch=UselessParentheses +com.thealgorithms.searches.KMPSearch=UselessParentheses +com.thealgorithms.searches.LinearSearchThread=EmptyCatchBlock +com.thealgorithms.searches.RabinKarpAlgorithm=UselessParentheses +com.thealgorithms.sorts.BubbleSortRecursion=UselessParentheses +com.thealgorithms.sorts.CircleSort=EmptyControlStatement +com.thealgorithms.sorts.CombSort=UselessParentheses +com.thealgorithms.sorts.DutchNationalFlagSort=UselessParentheses +com.thealgorithms.sorts.LinkListSort=EmptyControlStatement,UnusedLocalVariable +com.thealgorithms.sorts.MergeSortNoExtraSpace=UselessParentheses +com.thealgorithms.sorts.PigeonholeSort=UselessParentheses +com.thealgorithms.sorts.RadixSort=UselessParentheses +com.thealgorithms.sorts.WiggleSort=UselessParentheses +com.thealgorithms.stacks.PostfixToInfix=UselessParentheses +com.thealgorithms.strings.HorspoolSearch=UnnecessaryFullyQualifiedName,UselessParentheses +com.thealgorithms.strings.MyAtoi=UselessParentheses +com.thealgorithms.strings.Palindrome=UselessParentheses +com.thealgorithms.strings.Solution=CollapsibleIfStatements diff --git a/pom.xml b/pom.xml index 738461cc6f4..96478c48483 100644 --- a/pom.xml +++ b/pom.xml @@ -135,6 +135,17 @@ + + org.apache.maven.plugins + maven-pmd-plugin + 3.22.0 + + true + true + false + pmd-exclude.properties + +