Compare commits
No commits in common. "master" and "0.9.2" have entirely different histories.
34 changed files with 460 additions and 1834 deletions
21
.github/workflows/bld.yml
vendored
21
.github/workflows/bld.yml
vendored
|
@ -4,28 +4,29 @@ on: [ push, pull_request, workflow_dispatch ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-bld-project:
|
build-bld-project:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java-version: [ 17, 21, 24 ]
|
java-version: [ 17, 19, 20 ]
|
||||||
kotlin-version: [ 1.9.25, 2.0.21, 2.1.20 ]
|
|
||||||
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source repository
|
- name: Checkout source repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up JDK ${{ matrix.java-version }}
|
- name: Set up JDK ${{ matrix.java-version }}
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: "zulu"
|
distribution: 'zulu'
|
||||||
java-version: ${{ matrix.java-version }}
|
java-version: ${{ matrix.java-version }}
|
||||||
|
|
||||||
- name: Download dependencies
|
- name: Grant execute permission for bld
|
||||||
|
run: chmod +x bld
|
||||||
|
|
||||||
|
- name: Download the dependencies
|
||||||
run: ./bld download
|
run: ./bld download
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests with bld
|
||||||
run: ./bld compile test
|
run: ./bld compile test
|
12
.github/workflows/pages.yml
vendored
12
.github/workflows/pages.yml
vendored
|
@ -30,14 +30,14 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source repository
|
- name: Checkout source repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: "zulu"
|
distribution: 'zulu'
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
|
||||||
- name: Build Javadocs
|
- name: Build Javadocs
|
||||||
|
@ -47,11 +47,11 @@ jobs:
|
||||||
uses: actions/configure-pages@v3
|
uses: actions/configure-pages@v3
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-pages-artifact@v3
|
uses: actions/upload-pages-artifact@v1
|
||||||
with:
|
with:
|
||||||
# Upload generated Javadocs repository
|
# Upload generated Javadocs repository
|
||||||
path: "build/javadoc/"
|
path: 'build/javadoc/'
|
||||||
|
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
uses: actions/deploy-pages@v4
|
uses: actions/deploy-pages@v1
|
6
.idea/bld.xml
generated
6
.idea/bld.xml
generated
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="BldConfiguration">
|
|
||||||
<events />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
2
.idea/copyright/Apache_License.xml
generated
2
.idea/copyright/Apache_License.xml
generated
|
@ -1,6 +1,6 @@
|
||||||
<component name="CopyrightManager">
|
<component name="CopyrightManager">
|
||||||
<copyright>
|
<copyright>
|
||||||
<option name="notice" value="Copyright 2023-&#36;today.year the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." />
|
<option name="notice" value=" Copyright &#36;today.year the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." />
|
||||||
<option name="myName" value="Apache License" />
|
<option name="myName" value="Apache License" />
|
||||||
</copyright>
|
</copyright>
|
||||||
</component>
|
</component>
|
13
.idea/icon.svg
generated
13
.idea/icon.svg
generated
|
@ -1,13 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
||||||
<svg width="100%" height="100%" viewBox="0 0 179 108" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
|
||||||
<g transform="matrix(1,0,0,1,-210.511,-96.3382)">
|
|
||||||
<g transform="matrix(1,0,0,1,-23.3386,-649.816)">
|
|
||||||
<g transform="matrix(0.221288,0,0,0.24,73.9536,390.254)">
|
|
||||||
<path d="M722.568,1482.92L722.568,1921.1L808.968,1921.1L808.968,1888.7C822.168,1907.9 846.168,1930.1 893.568,1930.1C933.168,1930.1 961.968,1917.5 985.368,1893.5C1012.97,1865.9 1027.37,1827.5 1027.37,1786.1C1027.37,1741.7 1011.17,1705.1 985.368,1680.5C961.968,1658.3 928.968,1644.5 892.368,1644.5C862.968,1644.5 830.568,1654.1 808.968,1683.5L808.968,1482.92L722.568,1482.92ZM871.368,1718.9C888.768,1718.9 903.768,1723.7 917.568,1736.9C930.168,1748.9 938.568,1766.3 938.568,1787.9C938.568,1807.7 930.168,1825.1 917.568,1837.1C904.368,1849.7 887.568,1855.7 872.568,1855.7C856.368,1855.7 837.168,1849.1 823.368,1835.9C813.168,1826.3 803.568,1810.1 803.568,1787.9C803.568,1765.1 812.568,1749.5 822.768,1738.7C836.568,1724.3 852.768,1718.9 871.368,1718.9Z" style="fill:rgb(35,146,255);fill-rule:nonzero;"/>
|
|
||||||
<rect x="1083.77" y="1482.92" width="86.4" height="438.182" style="fill:rgb(250,144,82);fill-rule:nonzero;"/>
|
|
||||||
<path d="M1531.37,1482.92L1444.97,1482.92L1444.97,1683.5C1423.37,1654.1 1390.97,1644.5 1361.57,1644.5C1324.97,1644.5 1291.97,1658.3 1268.57,1680.5C1242.77,1705.1 1226.57,1741.7 1226.57,1786.1C1226.57,1827.5 1240.97,1865.9 1268.57,1893.5C1291.97,1917.5 1320.77,1930.1 1360.37,1930.1C1407.77,1930.1 1431.77,1907.9 1444.97,1888.7L1444.97,1921.1L1531.37,1921.1L1531.37,1482.92ZM1382.57,1718.9C1401.17,1718.9 1417.37,1724.3 1431.17,1738.7C1441.37,1749.5 1450.37,1765.1 1450.37,1787.9C1450.37,1810.1 1440.77,1826.3 1430.57,1835.9C1416.77,1849.1 1397.57,1855.7 1381.37,1855.7C1366.37,1855.7 1349.57,1849.7 1336.37,1837.1C1323.77,1825.1 1315.37,1807.7 1315.37,1787.9C1315.37,1766.3 1323.77,1748.9 1336.37,1736.9C1350.17,1723.7 1365.17,1718.9 1382.57,1718.9Z" style="fill:rgb(35,146,255);fill-rule:nonzero;"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 2.4 KiB |
204
.idea/intellij-javadocs-4.0.1.xml
generated
204
.idea/intellij-javadocs-4.0.1.xml
generated
|
@ -1,204 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="JavaDocConfiguration">
|
|
||||||
<GENERAL>
|
|
||||||
<MODE>UPDATE</MODE>
|
|
||||||
<OVERRIDDEN_METHODS>false</OVERRIDDEN_METHODS>
|
|
||||||
<SPLITTED_CLASS_NAME>true</SPLITTED_CLASS_NAME>
|
|
||||||
<LEVELS>
|
|
||||||
<LEVEL>METHOD</LEVEL>
|
|
||||||
<LEVEL>TYPE</LEVEL>
|
|
||||||
<LEVEL>FIELD</LEVEL>
|
|
||||||
</LEVELS>
|
|
||||||
<VISIBILITIES>
|
|
||||||
<VISIBILITY>DEFAULT</VISIBILITY>
|
|
||||||
<VISIBILITY>PUBLIC</VISIBILITY>
|
|
||||||
<VISIBILITY>PROTECTED</VISIBILITY>
|
|
||||||
</VISIBILITIES>
|
|
||||||
</GENERAL>
|
|
||||||
<TEMPLATES>
|
|
||||||
<CLASSES>
|
|
||||||
<CLASS>
|
|
||||||
<KEY>^.*(public|protected|private)*.+interface\s+\w+.*</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The interface ${name}.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</CLASS>
|
|
||||||
<CLASS>
|
|
||||||
<KEY>^.*(public|protected|private)*.+enum\s+\w+.*</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The enum ${name}.\n
|
|
||||||
*/</VALUE>
|
|
||||||
</CLASS>
|
|
||||||
<CLASS>
|
|
||||||
<KEY>^.*(public|protected|private)*.+class\s+\w+.*</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The type ${name}.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</CLASS>
|
|
||||||
<CLASS>
|
|
||||||
<KEY>.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The type ${name}.\n
|
|
||||||
*/</VALUE>
|
|
||||||
</CLASS>
|
|
||||||
</CLASSES>
|
|
||||||
<CONSTRUCTORS>
|
|
||||||
<CONSTRUCTOR>
|
|
||||||
<KEY>.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* Instantiates a new ${name}.\n
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.parameterList.parameters as parameter>
|
|
||||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
|
||||||
</#list>
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</CONSTRUCTOR>
|
|
||||||
</CONSTRUCTORS>
|
|
||||||
<METHODS>
|
|
||||||
<METHOD>
|
|
||||||
<KEY>^.*(public|protected|private)*\s*.*(\w(\s*<.+>)*)+\s+get\w+\s*\(.*\).+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* Gets ${partName}.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.parameterList.parameters as parameter>
|
|
||||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
|
||||||
</#list>
|
|
||||||
<#if isNotVoid>
|
|
||||||
*\n
|
|
||||||
* @return the ${partName}\n
|
|
||||||
</#if>
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</METHOD>
|
|
||||||
<METHOD>
|
|
||||||
<KEY>^.*(public|protected|private)*\s*.*(void|\w(\s*<.+>)*)+\s+set\w+\s*\(.*\).+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* Sets ${partName}.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.parameterList.parameters as parameter>
|
|
||||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
|
||||||
</#list>
|
|
||||||
<#if isNotVoid>
|
|
||||||
*\n
|
|
||||||
* @return the ${partName}\n
|
|
||||||
</#if>
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</METHOD>
|
|
||||||
<METHOD>
|
|
||||||
<KEY>^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The entry point of application.\n
|
|
||||||
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
* @param ${element.parameterList.parameters[0].name} the input arguments\n
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</METHOD>
|
|
||||||
<METHOD>
|
|
||||||
<KEY>.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* ${name}<#if isNotVoid> ${return}</#if>.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.parameterList.parameters as parameter>
|
|
||||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
|
||||||
</#list>
|
|
||||||
<#if isNotVoid>
|
|
||||||
*\n
|
|
||||||
* @return the ${return}\n
|
|
||||||
</#if>
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</METHOD>
|
|
||||||
</METHODS>
|
|
||||||
<FIELDS>
|
|
||||||
<FIELD>
|
|
||||||
<KEY>^.*(public|protected|private)*.+static.*(\w\s\w)+.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The constant ${element.getName()}.\n
|
|
||||||
*/</VALUE>
|
|
||||||
</FIELD>
|
|
||||||
<FIELD>
|
|
||||||
<KEY>^.*(public|protected|private)*.*(\w\s\w)+.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
<#if element.parent.isInterface()>
|
|
||||||
* The constant ${element.getName()}.\n
|
|
||||||
<#else>
|
|
||||||
* The ${name}.\n
|
|
||||||
</#if> */</VALUE>
|
|
||||||
</FIELD>
|
|
||||||
<FIELD>
|
|
||||||
<KEY>.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
<#if element.parent.isEnum()>
|
|
||||||
*${name} ${typeName}.\n
|
|
||||||
<#else>
|
|
||||||
* The ${name}.\n
|
|
||||||
</#if>*/</VALUE>
|
|
||||||
</FIELD>
|
|
||||||
</FIELDS>
|
|
||||||
</TEMPLATES>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
7
.idea/libraries/bld.xml
generated
7
.idea/libraries/bld.xml
generated
|
@ -2,12 +2,11 @@
|
||||||
<library name="bld">
|
<library name="bld">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||||
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" />
|
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.0.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.0-sources.jar!/" />
|
||||||
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-sources.jar!/" />
|
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<excluded>
|
<excluded>
|
||||||
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
||||||
|
@ -15,4 +14,4 @@
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" type="SOURCES" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" type="SOURCES" />
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
4
.idea/libraries/compile.xml
generated
4
.idea/libraries/compile.xml
generated
|
@ -7,7 +7,7 @@
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/compile" />
|
<root url="file://$PROJECT_DIR$/lib/compile" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
4
.idea/libraries/runtime.xml
generated
4
.idea/libraries/runtime.xml
generated
|
@ -7,7 +7,7 @@
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/runtime" />
|
<root url="file://$PROJECT_DIR$/lib/runtime" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
4
.idea/libraries/test.xml
generated
4
.idea/libraries/test.xml
generated
|
@ -7,7 +7,7 @@
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/test" />
|
<root url="file://$PROJECT_DIR$/lib/test" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
24
.idea/misc.xml
generated
24
.idea/misc.xml
generated
|
@ -9,18 +9,30 @@
|
||||||
<pattern value="rife.bld.extension.PmdOperation" method="addInputPath" />
|
<pattern value="rife.bld.extension.PmdOperation" method="addInputPath" />
|
||||||
<pattern value="rife.bld.extension.PmdOperation" method="addRelativizeRoot" />
|
<pattern value="rife.bld.extension.PmdOperation" method="addRelativizeRoot" />
|
||||||
<pattern value="rife.bld.extension.PmdOperation" method="addRuleSet" />
|
<pattern value="rife.bld.extension.PmdOperation" method="addRuleSet" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="cache" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="debug" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="defaultLanguage" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="encoding" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="failOnViolation" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="forceVersion" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="fromProject" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="ignoreFile" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="incrementalAnalysis" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="inputPaths" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="relativizeRoots" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="reportFormat" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="ruleSets" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="showSuppressed" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="suppressedMarker" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="threads" />
|
||||||
|
<pattern value="rife.bld.extension.PmdOperation" method="uri" />
|
||||||
<pattern value="rife.bld.extension.PmdOperationBuild" method="jacoco" />
|
<pattern value="rife.bld.extension.PmdOperationBuild" method="jacoco" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PDMPlugin">
|
<component name="PDMPlugin">
|
||||||
<option name="customRuleSets">
|
<option name="customRuleSets">
|
||||||
<list>
|
<list>
|
||||||
<option value="$PROJECT_DIR$/../bld-jacoco-report/config/pmd.xml" />
|
|
||||||
<option value="$PROJECT_DIR$/../bld-checkstyle/config/pmd.xml" />
|
|
||||||
<option value="$PROJECT_DIR$/../bld-exec/config/pmd.xml" />
|
|
||||||
<option value="$PROJECT_DIR$/../bld-testng/config/pmd.xml" />
|
|
||||||
<option value="K:\java\semver\config\pmd.xml" />
|
<option value="K:\java\semver\config\pmd.xml" />
|
||||||
<option value="$PROJECT_DIR$/../bld-pitest/config/pmd.xml" />
|
|
||||||
<option value="$PROJECT_DIR$/../bld-generated-version/config/pmd.xml" />
|
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
<option name="skipTestSources" value="false" />
|
<option name="skipTestSources" value="false" />
|
||||||
|
|
9
.idea/runConfigurations/PmdOperation.xml
generated
Normal file
9
.idea/runConfigurations/PmdOperation.xml
generated
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="PmdOperation" type="Application" factoryName="Application" nameIsGenerated="true">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="rife.bld.extension.PmdOperation" />
|
||||||
|
<module name="app" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
13
.idea/runConfigurations/Run Tests.xml
generated
Normal file
13
.idea/runConfigurations/Run Tests.xml
generated
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Run Tests" type="JUnit" factoryName="JUnit">
|
||||||
|
<module name="app" />
|
||||||
|
<option name="PACKAGE_NAME" value="moog" />
|
||||||
|
<option name="MAIN_CLASS_NAME" value="rife.bld.extension" />
|
||||||
|
<option name="METHOD_NAME" value="" />
|
||||||
|
<option name="TEST_OBJECT" value="directory" />
|
||||||
|
<dir value="$PROJECT_DIR$/src/test/java" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
7
.vscode/launch.json
vendored
7
.vscode/launch.json
vendored
|
@ -1,6 +1,11 @@
|
||||||
{
|
{
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"name": "Run Main",
|
||||||
|
"request": "launch",
|
||||||
|
"mainClass": "rife.bld.extension.PmdOperation },
|
||||||
{
|
{
|
||||||
"type": "java",
|
"type": "java",
|
||||||
"name": "Run Tests",
|
"name": "Run Tests",
|
||||||
|
@ -15,4 +20,4 @@
|
||||||
"--exclude-engine=junit-vintage"]
|
"--exclude-engine=junit-vintage"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
10
.vscode/settings.json
vendored
10
.vscode/settings.json
vendored
|
@ -3,13 +3,13 @@
|
||||||
"src/main/java",
|
"src/main/java",
|
||||||
"src/main/resources",
|
"src/main/resources",
|
||||||
"src/test/java",
|
"src/test/java",
|
||||||
"src/test/resources",
|
"src/bld/java"
|
||||||
"src/bld/java",
|
|
||||||
"src/bld/resources"
|
|
||||||
],
|
],
|
||||||
"java.configuration.updateBuildConfiguration": "automatic",
|
"java.configuration.updateBuildConfiguration": "automatic",
|
||||||
"java.project.referencedLibraries": [
|
"java.project.referencedLibraries": [
|
||||||
"${HOME}/.bld/dist/bld-2.2.1.jar",
|
"${HOME}bld-1.7.0-SNAPSHOT.jar",
|
||||||
"lib/**/*.jar"
|
"lib/compile/*.jar",
|
||||||
|
"lib/runtime/*.jar",
|
||||||
|
"lib/test/*.jar"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
31
README.md
31
README.md
|
@ -1,26 +1,19 @@
|
||||||
# [bld](https://rife2.com/bld) Extension to Perform Static Code Analysis with [PMD](https://pmd.github.io/)
|
# [Bld](https://rife2.com/bld) Extension to Perform Static Code Analysis with [PMD](https://pmd.github.io/)
|
||||||
|
|
||||||
|
|
||||||
[](https://opensource.org/licenses/Apache-2.0)
|
[](https://opensource.org/licenses/Apache-2.0)
|
||||||
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
|
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
|
||||||
[](https://rife2.com/bld)
|
[](https://rife2.com/bld)
|
||||||
[](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-pmd)
|
[](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-pmd)
|
||||||
[](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-pmd)
|
[](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-pmd)
|
||||||
[](https://github.com/rife2/bld-pmd/actions/workflows/bld.yml)
|
[](https://github.com/rife2/bld-pmd/actions/workflows/bld.yml)
|
||||||
|
|
||||||
To install the latest version, add the following to the `lib/bld/bld-wrapper.properties` file:
|
To install, please refer to the [extensions documentation](https://github.com/rife2/bld/wiki/Extensions).
|
||||||
|
|
||||||
```properties
|
To check all source code using the [java quickstart rule](https://pmd.github.io/pmd/pmd_rules_java.html), add the following to your build file
|
||||||
bld.extension-pmd=com.uwyn.rife2:bld-pmd
|
|
||||||
```
|
|
||||||
|
|
||||||
For more information, please refer to the [extensions](https://github.com/rife2/bld/wiki/Extensions) documentation.
|
|
||||||
|
|
||||||
## Check Source with PMD
|
|
||||||
|
|
||||||
To check all source Codecode using the [Java Quickstart](https://docs.pmd-code.org/latest/pmd_rules_java.html) configuration, add the following to your build file:
|
|
||||||
|
|
||||||
```java
|
```java
|
||||||
@BuildCommand(summary = "Checks source code with PMD")
|
@BuildCommand
|
||||||
public void pmd() throws Exception {
|
public void pmd() throws Exception {
|
||||||
new PmdOperation()
|
new PmdOperation()
|
||||||
.fromProject(this)
|
.fromProject(this)
|
||||||
|
@ -28,26 +21,26 @@ public void pmd() throws Exception {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
```console
|
```text
|
||||||
./bld pmd test
|
./bld pmd test
|
||||||
```
|
```
|
||||||
|
|
||||||
To check the main source directory using a custom ruleset, [Java Error Prone](https://docs.pmd-code.org/latest/pmd_rules_java.html#error-prone) configuration, and failing on any violation.
|
To check the main source directory using a custom rule, [java error prone rule](https://pmd.github.io/pmd/pmd_rules_java.html) and failing on any violation.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
@BuildCommand(value = "pmd-main", summary = "Checks main source code with PMD")
|
@BuildCommand
|
||||||
public void pmdMain() throws Exception {
|
public void pmdMain() throws Exception {
|
||||||
new PmdOperation()
|
new PmdOperation()
|
||||||
.fromProject(this)
|
.fromProject(this)
|
||||||
.failOnViolation(true)
|
.failOnViolation(true)
|
||||||
.inputPaths(srcMainDirectory())
|
.inputPaths(this.srcMainDirectory().toPath())
|
||||||
.ruleSets("config/pmd.xml", "category/java/errorprone.xml")
|
.ruleSets("config/pmd.xml", "category/java/errorprone.xml")
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
```console
|
```text
|
||||||
./bld compile pmd-main
|
./bld compile pmdMain
|
||||||
```
|
```
|
||||||
|
|
||||||
Please check the [PmdOperation documentation](https://rife2.github.io/bld-pmd/rife/bld/extension/PmdOperation.html#method-summary) for all available configuration options.
|
Please check the [PmdOperation documentation](https://rife2.github.io/bld-pmd/rife/bld/extension/PmdOperation.html#method-summary) for all available configuration options.
|
||||||
|
|
109
config/pmd.xml
109
config/pmd.xml
|
@ -1,109 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<ruleset name="erik"
|
|
||||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
|
||||||
<description>Erik's Ruleset</description>
|
|
||||||
<!-- BEST PRACTICES -->
|
|
||||||
<rule ref="category/java/bestpractices.xml">
|
|
||||||
<exclude name="AvoidPrintStackTrace"/>
|
|
||||||
<exclude name="GuardLogStatement"/>
|
|
||||||
<exclude name="UnitTestContainsTooManyAsserts"/>
|
|
||||||
<exclude name="UnitTestShouldUseTestAnnotation"/>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<rule ref="category/java/bestpractices.xml/MissingOverride">
|
|
||||||
<properties>
|
|
||||||
<property name="violationSuppressXPath"
|
|
||||||
value="//MethodDeclaration[@Name='hashCode' or @Name='equals' or @Name='toString']"/>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- CODE STYLE -->
|
|
||||||
<rule ref="category/java/codestyle.xml">
|
|
||||||
<exclude name="AtLeastOneConstructor"/>
|
|
||||||
<exclude name="ClassNamingConventions"/>
|
|
||||||
<exclude name="CommentDefaultAccessModifier"/>
|
|
||||||
<exclude name="ConfusingTernary"/>
|
|
||||||
<exclude name="FieldNamingConventions"/>
|
|
||||||
<exclude name="LocalVariableCouldBeFinal"/>
|
|
||||||
<exclude name="LongVariable"/>
|
|
||||||
<exclude name="MethodArgumentCouldBeFinal"/>
|
|
||||||
<exclude name="OnlyOneReturn"/>
|
|
||||||
<exclude name="PackageCase"/>
|
|
||||||
<exclude name="ShortClassName"/>
|
|
||||||
<exclude name="ShortMethodName"/>
|
|
||||||
<exclude name="ShortVariable"/>
|
|
||||||
<exclude name="UseExplicitTypes"/>
|
|
||||||
<exclude name="UseUnderscoresInNumericLiterals"/>
|
|
||||||
<exclude name="UselessParentheses"/>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<rule ref="category/java/codestyle.xml/UnnecessaryImport">
|
|
||||||
<properties>
|
|
||||||
<property name="violationSuppressRegex" value="Unused (static|.*\.\*).*"/>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- DESIGN -->
|
|
||||||
<rule ref="category/java/design.xml">
|
|
||||||
<exclude name="AvoidCatchingGenericException"/>
|
|
||||||
<exclude name="AvoidDeeplyNestedIfStmts"/>
|
|
||||||
<exclude name="AvoidUncheckedExceptionsInSignatures"/>
|
|
||||||
<exclude name="CognitiveComplexity"/>
|
|
||||||
<exclude name="CyclomaticComplexity"/>
|
|
||||||
<exclude name="ExcessiveParameterList"/>
|
|
||||||
<exclude name="ExcessivePublicCount"/>
|
|
||||||
<exclude name="GodClass"/>
|
|
||||||
<exclude name="LawOfDemeter"/>
|
|
||||||
<exclude name="LoosePackageCoupling"/>
|
|
||||||
<exclude name="NPathComplexity"/>
|
|
||||||
<exclude name="NcssCount"/>
|
|
||||||
<exclude name="TooManyFields"/>
|
|
||||||
<exclude name="TooManyMethods"/>
|
|
||||||
<exclude name="UseObjectForClearerAPI"/>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- DOCUMENTATION -->
|
|
||||||
<rule ref="category/java/documentation.xml">
|
|
||||||
<exclude name="CommentRequired"/>
|
|
||||||
<exclude name="CommentSize"/>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- ERROR PRONE -->
|
|
||||||
<rule ref="category/java/errorprone.xml">
|
|
||||||
<exclude name="AssignmentInOperand"/>
|
|
||||||
<exclude name="AvoidCatchingNPE"/>
|
|
||||||
<exclude name="AvoidDuplicateLiterals"/>
|
|
||||||
<exclude name="AvoidFieldNameMatchingMethodName"/>
|
|
||||||
<exclude name="AvoidFieldNameMatchingTypeName"/>
|
|
||||||
<exclude name="AvoidLiteralsInIfCondition"/>
|
|
||||||
<exclude name="NullAssignment"/>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<rule ref="category/java/errorprone.xml/AssignmentInOperand">
|
|
||||||
<properties>
|
|
||||||
<property name="allowWhile" value="true"/>
|
|
||||||
<property name="allowFor" value="true"/>
|
|
||||||
<property name="allowIf" value="true"/>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
<rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals">
|
|
||||||
<properties>
|
|
||||||
<property name="skipAnnotations" value="true"/>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- MULTITHREADING -->
|
|
||||||
<rule ref="category/java/multithreading.xml">
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- PERFORMANCE -->
|
|
||||||
<rule ref="category/java/performance.xml">
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- SECURITY -->
|
|
||||||
<rule ref="category/java/security.xml">
|
|
||||||
</rule>
|
|
||||||
</ruleset>
|
|
Binary file not shown.
|
@ -1,5 +1,6 @@
|
||||||
bld.downloadExtensionJavadoc=false
|
bld.downloadExtensionJavadoc=false
|
||||||
bld.downloadExtensionSources=true
|
bld.downloadExtensionSources=true
|
||||||
|
bld.extensions=com.uwyn.rife2:bld-jacoco-report:0.9.0-SNAPSHOT
|
||||||
|
bld.repositories=RIFE2_SNAPSHOTS,RIFE2_RELEASES,MAVEN_CENTRAL
|
||||||
bld.downloadLocation=
|
bld.downloadLocation=
|
||||||
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
bld.version=1.7.1
|
||||||
bld.version=2.2.1
|
|
||||||
|
|
|
@ -1,86 +1,68 @@
|
||||||
/*
|
|
||||||
* Copyright 2023-2025 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package rife.bld.extension;
|
package rife.bld.extension;
|
||||||
|
|
||||||
|
import rife.bld.BuildCommand;
|
||||||
import rife.bld.Project;
|
import rife.bld.Project;
|
||||||
import rife.bld.publish.PublishDeveloper;
|
import rife.bld.publish.PublishDeveloper;
|
||||||
import rife.bld.publish.PublishLicense;
|
import rife.bld.publish.PublishLicense;
|
||||||
import rife.bld.publish.PublishScm;
|
import rife.bld.publish.PublishScm;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static rife.bld.dependencies.Repository.*;
|
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
|
||||||
import static rife.bld.dependencies.Scope.*;
|
import static rife.bld.dependencies.Repository.RIFE2_RELEASES;
|
||||||
|
import static rife.bld.dependencies.Scope.compile;
|
||||||
|
import static rife.bld.dependencies.Scope.runtime;
|
||||||
|
import static rife.bld.dependencies.Scope.test;
|
||||||
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
|
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
|
||||||
|
|
||||||
public class PmdOperationBuild extends Project {
|
public class PmdOperationBuild extends Project {
|
||||||
public PmdOperationBuild() {
|
public PmdOperationBuild() {
|
||||||
pkg = "rife.bld.extension";
|
pkg = "rife.bld.extension";
|
||||||
name = "bld-pmd";
|
name = "bld-pmd";
|
||||||
version = version(1, 2, 3);
|
version = version(0, 9, 2);
|
||||||
|
|
||||||
javaRelease = 17;
|
javaRelease = 17;
|
||||||
|
|
||||||
downloadSources = true;
|
downloadSources = true;
|
||||||
autoDownloadPurge = true;
|
autoDownloadPurge = true;
|
||||||
|
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
|
||||||
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS);
|
|
||||||
|
|
||||||
var pmd = version(7, 13, 0);
|
var pmd = version(7, 0, 0, "rc3");
|
||||||
|
var rife2 = version(1,7,0);
|
||||||
scope(compile)
|
scope(compile)
|
||||||
.include(dependency("com.uwyn.rife2", "bld", version(2, 2, 1)))
|
.include(dependency("com.uwyn.rife2", "rife2", rife2))
|
||||||
|
.include(dependency("com.uwyn.rife2", "bld", version(1, 7, 1)))
|
||||||
.include(dependency("net.sourceforge.pmd", "pmd-java", pmd));
|
.include(dependency("net.sourceforge.pmd", "pmd-java", pmd));
|
||||||
scope(runtime)
|
scope(runtime)
|
||||||
.include(dependency("org.slf4j", "slf4j-simple", version(2, 0, 17)));
|
.include(dependency("net.sourceforge.pmd", "pmd-java", pmd))
|
||||||
|
.include(dependency("org.slf4j", "slf4j-simple", version(2,0,7)));
|
||||||
scope(test)
|
scope(test)
|
||||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 12, 2)))
|
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0)))
|
||||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 12, 2)))
|
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0)))
|
||||||
.include(dependency("org.assertj", "assertj-core", version(3, 27, 3)));
|
.include(dependency("org.assertj:assertj-joda-time:2.2.0"));
|
||||||
|
|
||||||
javadocOperation()
|
javadocOperation()
|
||||||
.javadocOptions()
|
.javadocOptions()
|
||||||
.author()
|
|
||||||
.docLint(NO_MISSING)
|
.docLint(NO_MISSING)
|
||||||
.link("https://rife2.github.io/bld/")
|
.link("https://rife2.github.io/bld/")
|
||||||
.link("https://rife2.github.io/rife2/")
|
.link("https://rife2.github.io/rife2/")
|
||||||
.link("https://javadoc.io/doc/net.sourceforge.pmd/pmd-core/latest/");
|
.link("https://javadoc.io/doc/net.sourceforge.pmd/pmd-core/latest/");
|
||||||
|
|
||||||
publishOperation()
|
publishOperation()
|
||||||
|
// .repository(MAVEN_LOCAL)
|
||||||
.repository(version.isSnapshot() ? repository("rife2-snapshot") : repository("rife2"))
|
.repository(version.isSnapshot() ? repository("rife2-snapshot") : repository("rife2"))
|
||||||
.repository(repository("github"))
|
|
||||||
.info()
|
.info()
|
||||||
.groupId("com.uwyn.rife2")
|
.groupId("com.uwyn.rife2")
|
||||||
.artifactId("bld-pmd")
|
.artifactId("bld-pmd")
|
||||||
.description("bld Extension to Perform Static Code Analysis with PMD")
|
.description("bld Extension to Perform Static Code Analysis with PMD")
|
||||||
.url("https://github.com/rife2/bld-pmd")
|
.url("https://github.com/rife2/bld-pmd")
|
||||||
.developer(new PublishDeveloper()
|
.developer(new PublishDeveloper().id("ethauvin").name("Erik C. Thauvin").email("erik@thauvin.net")
|
||||||
.id("ethauvin").name("Erik C. Thauvin")
|
.url("https://erik.thauvin.net/"))
|
||||||
.email("erik@thauvin.net")
|
.license(new PublishLicense().name("The Apache License, Version 2.0")
|
||||||
.url("https://erik.thauvin.net/")
|
.url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
|
||||||
)
|
.scm(new PublishScm().connection("scm:git:https://github.com/rife2/bld-pmd.git")
|
||||||
.license(new PublishLicense()
|
|
||||||
.name("The Apache License, Version 2.0")
|
|
||||||
.url("https://www.apache.org/licenses/LICENSE-2.0.txt")
|
|
||||||
)
|
|
||||||
.scm(new PublishScm()
|
|
||||||
.connection("scm:git:https://github.com/rife2/bld-pmd.git")
|
|
||||||
.developerConnection("scm:git:git@github.com:rife2/bld-pmd.git")
|
.developerConnection("scm:git:git@github.com:rife2/bld-pmd.git")
|
||||||
.url("https://github.com/rife2/bld-pmd")
|
.url("https://github.com/rife2/bld-pmd"))
|
||||||
)
|
|
||||||
.signKey(property("sign.key"))
|
.signKey(property("sign.key"))
|
||||||
.signPassphrase(property("sign.passphrase"));
|
.signPassphrase(property("sign.passphrase"));
|
||||||
}
|
}
|
||||||
|
@ -88,4 +70,11 @@ public class PmdOperationBuild extends Project {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new PmdOperationBuild().start(args);
|
new PmdOperationBuild().start(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@BuildCommand(summary = "Generates JaCoCo Reports")
|
||||||
|
public void jacoco() throws IOException {
|
||||||
|
new JacocoReportOperation()
|
||||||
|
.fromProject(this)
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,41 +1,30 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2025 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package rife.bld.extension;
|
package rife.bld.extension;
|
||||||
|
|
||||||
import net.sourceforge.pmd.PMDConfiguration;
|
|
||||||
import net.sourceforge.pmd.lang.LanguageRegistry;
|
|
||||||
import net.sourceforge.pmd.lang.rule.RulePriority;
|
|
||||||
import org.assertj.core.api.AutoCloseableSoftAssertions;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import rife.bld.BaseProject;
|
|
||||||
import rife.bld.operations.exceptions.ExitStatusException;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.assertj.core.api.Assertions.assertThatCode;
|
import static org.assertj.core.api.Assertions.assertThatCode;
|
||||||
|
@ -47,148 +36,37 @@ import static org.assertj.core.api.Assertions.assertThatCode;
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class PmdOperationTest {
|
class PmdOperationTest {
|
||||||
static final String BAR = "bar";
|
|
||||||
static final String CATEGORY_FOO = "category/foo.xml";
|
static final String CATEGORY_FOO = "category/foo.xml";
|
||||||
|
static final String CODE_STYLE = "category/java/codestyle.xml";
|
||||||
static final Path CODE_STYLE_SAMPLE = Path.of("src/test/resources/java/CodeStyle.java");
|
static final Path CODE_STYLE_SAMPLE = Path.of("src/test/resources/java/CodeStyle.java");
|
||||||
static final String CODE_STYLE_XML = "category/java/codestyle.xml";
|
static final int CODING_STYLE_ERRORS = 13;
|
||||||
static final String COMMAND_NAME = "pmd";
|
static final String COMMAND_NAME = "pmd";
|
||||||
static final String DESIGN_XML = "category/java/design.xml";
|
static final String ERROR_PRONE = "category/java/errorprone.xml";
|
||||||
static final String DOCUMENTATION_XML = "category/java/documentation.xml";
|
static final int ERROR_PRONE_ERRORS = 8;
|
||||||
static final Path ERROR_PRONE_SAMPLE = Path.of("src/test/resources/java/ErrorProne.java");
|
static final Path ERROR_PRONE_SAMPLE = Path.of("src/test/resources/java/ErrorProne.java");
|
||||||
static final String ERROR_PRONE_XML = "category/java/errorprone.xml";
|
|
||||||
static final File FILE_BAR = new File(BAR);
|
|
||||||
static final String FOO = "foo";
|
|
||||||
static final File FILE_FOO = new File(FOO);
|
|
||||||
static final Path PATH_BAR = Path.of(BAR);
|
|
||||||
static final Path PATH_FOO = Path.of(FOO);
|
|
||||||
static final String PERFORMANCE_XML = "category/java/performance.xml";
|
|
||||||
static final String SECURITY_XML = "category/java/security.xml";
|
|
||||||
static final String TEST = "test";
|
static final String TEST = "test";
|
||||||
|
|
||||||
PmdOperation newPmdOperation() {
|
PmdOperation newPmdOperation() {
|
||||||
return new PmdOperation()
|
final PmdOperation pmdOperation = new PmdOperation();
|
||||||
.inputPaths(Path.of("src/main"), Path.of("src/test"))
|
pmdOperation.inputPaths(Path.of("src/main"), Path.of("src/test"));
|
||||||
.cache("build/" + COMMAND_NAME + "/pmd-cache")
|
pmdOperation.reportFile = Paths.get("build", COMMAND_NAME, "pmd-test-report.txt");
|
||||||
.failOnViolation(false)
|
pmdOperation.cache = Paths.get("build", COMMAND_NAME, "pmd-cache");
|
||||||
.reportFile(Paths.get("build", COMMAND_NAME, "pmd-test-report.txt"));
|
pmdOperation.failOnViolation = false;
|
||||||
|
return pmdOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testAddExcludes() {
|
void testAddInputPaths() {
|
||||||
var pmd = newPmdOperation().ruleSets(CATEGORY_FOO).addExcludes(PATH_FOO);
|
var pmd = newPmdOperation().ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE).inputPaths(ERROR_PRONE_SAMPLE)
|
||||||
var config = pmd.initConfiguration(COMMAND_NAME);
|
.addInputPath(CODE_STYLE_SAMPLE);
|
||||||
assertThat(config.getExcludes()).containsExactly(PATH_FOO);
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(36);
|
||||||
|
|
||||||
pmd = pmd.addExcludes(PATH_BAR);
|
|
||||||
config = pmd.initConfiguration(COMMAND_NAME);
|
|
||||||
assertThat(config.getExcludes()).containsExactly(PATH_FOO, PATH_BAR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testAddExcludesFiles() {
|
void testCache() {
|
||||||
var pmd = newPmdOperation().ruleSets(CATEGORY_FOO).addExcludesFiles(FILE_FOO);
|
|
||||||
var config = pmd.initConfiguration(COMMAND_NAME);
|
|
||||||
assertThat(config.getExcludes()).containsExactly(FILE_FOO.toPath());
|
|
||||||
|
|
||||||
pmd = pmd.addExcludesFiles(FILE_BAR);
|
|
||||||
config = pmd.initConfiguration(COMMAND_NAME);
|
|
||||||
assertThat(config.getExcludes()).containsExactly(FILE_FOO.toPath(), FILE_BAR.toPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testAddExcludesStrings() {
|
|
||||||
var pmd = newPmdOperation().ruleSets(CATEGORY_FOO).addExcludesStrings(FOO);
|
|
||||||
var config = pmd.initConfiguration(COMMAND_NAME);
|
|
||||||
assertThat(config.getExcludes()).containsExactly(PATH_FOO);
|
|
||||||
|
|
||||||
pmd = pmd.addExcludesStrings(BAR);
|
|
||||||
config = pmd.initConfiguration(COMMAND_NAME);
|
|
||||||
assertThat(config.getExcludes()).containsExactly(PATH_FOO, PATH_BAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testAddInputPaths() throws ExitStatusException {
|
|
||||||
var project = new BaseProject();
|
|
||||||
var pmd = new PmdOperation().fromProject(project);
|
|
||||||
|
|
||||||
assertThat(pmd.inputPaths()).as("default").containsExactly(project.srcMainDirectory().toPath(),
|
|
||||||
project.srcTestDirectory().toPath());
|
|
||||||
|
|
||||||
var err = pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME));
|
|
||||||
|
|
||||||
pmd.inputPaths().clear();
|
|
||||||
pmd = pmd.addInputPaths(project.srcMainDirectory(), project.srcTestDirectory());
|
|
||||||
|
|
||||||
assertThat(pmd.inputPaths()).as("File...").containsExactly(project.srcMainDirectory().toPath(),
|
|
||||||
project.srcTestDirectory().toPath());
|
|
||||||
|
|
||||||
pmd.inputPaths().clear();
|
|
||||||
pmd = pmd.addInputPathsFiles(List.of(project.srcMainDirectory(), project.srcTestDirectory()));
|
|
||||||
|
|
||||||
assertThat(pmd.inputPaths()).as("List(File...)")
|
|
||||||
.containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath());
|
|
||||||
|
|
||||||
pmd.inputPaths().clear();
|
|
||||||
pmd = pmd.addInputPaths(project.srcMainDirectory().getAbsolutePath(),
|
|
||||||
project.srcTestDirectory().getAbsolutePath());
|
|
||||||
|
|
||||||
assertThat(pmd.inputPaths()).as("String...")
|
|
||||||
.containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath());
|
|
||||||
|
|
||||||
pmd.inputPaths().clear();
|
|
||||||
pmd = pmd.addInputPathsStrings(
|
|
||||||
List.of(project.srcMainDirectory().getAbsolutePath(), project.srcTestDirectory().getAbsolutePath()));
|
|
||||||
|
|
||||||
assertThat(pmd.inputPaths()).as("List(String...)")
|
|
||||||
.containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath());
|
|
||||||
|
|
||||||
pmd.inputPaths().clear();
|
|
||||||
pmd = pmd.addInputPaths(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath());
|
|
||||||
|
|
||||||
assertThat(pmd.inputPaths()).as("Path...")
|
|
||||||
.containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath());
|
|
||||||
|
|
||||||
pmd.inputPaths().clear();
|
|
||||||
pmd = pmd.addInputPaths(List.of(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath()));
|
|
||||||
|
|
||||||
assertThat(pmd.inputPaths()).as("List(Path)")
|
|
||||||
.containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath());
|
|
||||||
|
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)))
|
|
||||||
.isGreaterThan(0).isEqualTo(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testAddRuleSets() throws ExitStatusException {
|
|
||||||
var pmd = new PmdOperation().fromProject(new BaseProject());
|
|
||||||
|
|
||||||
assertThat(pmd.ruleSets()).containsExactly(PmdOperation.RULE_SET_DEFAULT);
|
|
||||||
|
|
||||||
pmd.addRuleSet(ERROR_PRONE_XML);
|
|
||||||
|
|
||||||
assertThat(pmd.ruleSets()).containsExactly(PmdOperation.RULE_SET_DEFAULT, ERROR_PRONE_XML);
|
|
||||||
|
|
||||||
var err = pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME));
|
|
||||||
|
|
||||||
pmd.ruleSets().clear();
|
|
||||||
|
|
||||||
pmd.addRuleSet(List.of(PmdOperation.RULE_SET_DEFAULT, ERROR_PRONE_XML));
|
|
||||||
|
|
||||||
assertThat(pmd.ruleSets()).as("collection")
|
|
||||||
.containsExactly(PmdOperation.RULE_SET_DEFAULT, ERROR_PRONE_XML);
|
|
||||||
|
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)))
|
|
||||||
.isGreaterThan(0).isEqualTo(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testCache() throws ExitStatusException {
|
|
||||||
var cache = Path.of("build/pmd/temp-cache");
|
var cache = Path.of("build/pmd/temp-cache");
|
||||||
var pmd = newPmdOperation()
|
var pmd = newPmdOperation().ruleSets(CODE_STYLE).inputPaths(CODE_STYLE_SAMPLE).cache(cache);
|
||||||
.ruleSets(CODE_STYLE_XML)
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(CODING_STYLE_ERRORS);
|
||||||
.inputPaths(List.of(CODE_STYLE_SAMPLE))
|
|
||||||
.cache(cache);
|
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
|
||||||
var f = cache.toFile();
|
var f = cache.toFile();
|
||||||
assertThat(f.exists()).as("file exits").isTrue();
|
assertThat(f.exists()).as("file exits").isTrue();
|
||||||
assertThat(f.delete()).as("delete file").isTrue();
|
assertThat(f.delete()).as("delete file").isTrue();
|
||||||
|
@ -197,124 +75,23 @@ class PmdOperationTest {
|
||||||
@Test
|
@Test
|
||||||
void testEncoding() {
|
void testEncoding() {
|
||||||
var pmd = newPmdOperation().ruleSets(CATEGORY_FOO).encoding("UTF-16");
|
var pmd = newPmdOperation().ruleSets(CATEGORY_FOO).encoding("UTF-16");
|
||||||
PMDConfiguration config = pmd.initConfiguration(COMMAND_NAME);
|
|
||||||
assertThat(config.getSourceEncoding()).as("UTF-16").isEqualTo(StandardCharsets.UTF_16);
|
|
||||||
|
|
||||||
pmd = pmd.encoding(StandardCharsets.ISO_8859_1);
|
|
||||||
config = pmd.initConfiguration(COMMAND_NAME);
|
|
||||||
assertThat(config.getSourceEncoding()).as("ISO_8859").isEqualTo(StandardCharsets.ISO_8859_1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testExcludes() {
|
|
||||||
var foz = Path.of("foz/baz");
|
|
||||||
var baz = Path.of("baz/foz");
|
|
||||||
|
|
||||||
var pmd = newPmdOperation().ruleSets(CATEGORY_FOO).excludes(PATH_FOO, PATH_BAR);
|
|
||||||
var config = pmd.initConfiguration(COMMAND_NAME);
|
var config = pmd.initConfiguration(COMMAND_NAME);
|
||||||
assertThat(pmd.excludes()).containsExactly(List.of(PATH_FOO, PATH_BAR).toArray(new Path[0]));
|
assertThat(config.getSourceEncoding()).isEqualTo(StandardCharsets.UTF_16);
|
||||||
assertThat(config.getExcludes()).containsExactly(List.of(PATH_FOO, PATH_BAR).toArray(new Path[0]));
|
|
||||||
|
|
||||||
var excludes = List.of(List.of(PATH_FOO, PATH_BAR), List.of(foz, baz));
|
|
||||||
for (var exclude : excludes) {
|
|
||||||
pmd = newPmdOperation().ruleSets(CATEGORY_FOO).excludes(exclude);
|
|
||||||
config = pmd.initConfiguration(COMMAND_NAME);
|
|
||||||
assertThat(config.getExcludes()).containsExactly(exclude.toArray(new Path[0]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testExcludesFiles() {
|
|
||||||
var foz = new File("foz");
|
|
||||||
var baz = new File("baz");
|
|
||||||
|
|
||||||
var pmd = newPmdOperation().ruleSets(CATEGORY_FOO).excludesFiles(FILE_FOO, FILE_BAR);
|
|
||||||
var config = pmd.initConfiguration(COMMAND_NAME);
|
|
||||||
assertThat(config.getExcludes()).containsExactly(FILE_FOO.toPath(), FILE_BAR.toPath());
|
|
||||||
|
|
||||||
var excludes = List.of(List.of(FILE_FOO, FILE_BAR), List.of(foz, baz));
|
|
||||||
for (var exclude : excludes) {
|
|
||||||
pmd = newPmdOperation().ruleSets(CATEGORY_FOO).excludesFiles(exclude);
|
|
||||||
config = pmd.initConfiguration(COMMAND_NAME);
|
|
||||||
assertThat(config.getExcludes()).containsExactly(exclude.stream().map(File::toPath).toArray(Path[]::new));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testExcludesStrings() {
|
|
||||||
var foz = "foz";
|
|
||||||
var baz = "baz";
|
|
||||||
|
|
||||||
var pmd = newPmdOperation().ruleSets(CATEGORY_FOO).excludesStrings(FOO, BAR);
|
|
||||||
var config = pmd.initConfiguration(COMMAND_NAME);
|
|
||||||
assertThat(pmd.excludes()).containsExactly(PATH_FOO, PATH_BAR);
|
|
||||||
assertThat(config.getExcludes()).containsExactly(PATH_FOO, PATH_BAR);
|
|
||||||
|
|
||||||
var excludes = List.of(List.of(FOO, BAR), List.of(foz, baz));
|
|
||||||
for (var exclude : excludes) {
|
|
||||||
pmd = newPmdOperation().ruleSets(CATEGORY_FOO).excludesStrings(exclude);
|
|
||||||
config = pmd.initConfiguration(COMMAND_NAME);
|
|
||||||
assertThat(config.getExcludes()).containsExactly(exclude.stream().map(Paths::get).toArray(Path[]::new));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testExecute() throws ExitStatusException {
|
|
||||||
var pmd = new PmdOperation().fromProject(new BaseProject());
|
|
||||||
|
|
||||||
assertThat(pmd.inputPaths()).containsExactly(Paths.get("src/main").toAbsolutePath(),
|
|
||||||
Paths.get("src/test").toAbsolutePath());
|
|
||||||
|
|
||||||
pmd.inputPaths().clear();
|
|
||||||
pmd.inputPaths("src/main/java", "src/test/java")
|
|
||||||
.ruleSets("config/pmd.xml");
|
|
||||||
|
|
||||||
assertThat(pmd.ruleSets()).containsExactly("config/pmd.xml");
|
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testExecuteNoProject() {
|
|
||||||
var pmd = new PmdOperation();
|
|
||||||
assertThatCode(pmd::execute).isInstanceOf(ExitStatusException.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testFailOnError() {
|
|
||||||
var pmd = newPmdOperation().ruleSets("src/test/resources/xml/old.xml")
|
|
||||||
.inputPaths(Path.of("src/test/resources/java/Documentation.java"));
|
|
||||||
assertThatCode(() -> pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)))
|
|
||||||
.isInstanceOf(ExitStatusException.class);
|
|
||||||
assertThatCode(() -> pmd.failOnError(false).performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)))
|
|
||||||
.doesNotThrowAnyException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testFailOnValidation() {
|
void testFailOnValidation() {
|
||||||
var pmd = newPmdOperation().ruleSets(DOCUMENTATION_XML)
|
var pmd = newPmdOperation().ruleSets("category/java/documentation.xml")
|
||||||
.inputPaths(Path.of("src/test/resources/java/Documentation.java"));
|
.inputPaths(Path.of("src/test/resources/java/Documentation.java"));
|
||||||
assertThatCode(() -> pmd.failOnViolation(true).performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)))
|
assertThatCode(() -> pmd.failOnViolation(true).performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))
|
||||||
.isInstanceOf(ExitStatusException.class);
|
).isInstanceOf(RuntimeException.class).hasMessageContaining('[' + TEST + ']');
|
||||||
assertThatCode(() -> pmd.failOnViolation(false).performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)))
|
|
||||||
.doesNotThrowAnyException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testIgnoreFile() throws ExitStatusException {
|
void testIgnoreFile() {
|
||||||
var pmd = newPmdOperation()
|
var pmd = newPmdOperation().ruleSets(ERROR_PRONE, CODE_STYLE).inputPaths(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE)
|
||||||
.ruleSets(ERROR_PRONE_XML, CODE_STYLE_XML)
|
|
||||||
.ignoreFile(Path.of("src/test/resources/ignore.txt"));
|
.ignoreFile(Path.of("src/test/resources/ignore.txt"));
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
|
||||||
|
|
||||||
pmd.inputPaths().clear();
|
|
||||||
pmd.inputPaths(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
|
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(0);
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(0);
|
||||||
|
|
||||||
pmd.ruleSets().clear();
|
|
||||||
pmd.inputPaths().clear();
|
|
||||||
assertThat(pmd.inputPaths(ERROR_PRONE_SAMPLE)
|
|
||||||
.ignoreFile(new File("src/test/resources/ignore-single.txt"))
|
|
||||||
.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -325,244 +102,133 @@ class PmdOperationTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testInputPaths() throws ExitStatusException {
|
void testJavaBestPractices() {
|
||||||
var pmd = newPmdOperation()
|
|
||||||
.ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML)
|
|
||||||
.inputPaths(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
|
|
||||||
assertThat(pmd.inputPaths()).as("Path....").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
|
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
|
||||||
|
|
||||||
pmd = newPmdOperation()
|
|
||||||
.ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML)
|
|
||||||
.inputPaths(ERROR_PRONE_SAMPLE.toFile(), CODE_STYLE_SAMPLE.toFile());
|
|
||||||
assertThat(pmd.inputPaths()).as("File...").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
|
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
|
||||||
|
|
||||||
pmd = newPmdOperation()
|
|
||||||
.ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML)
|
|
||||||
.inputPaths(ERROR_PRONE_SAMPLE.toString(), CODE_STYLE_SAMPLE.toString());
|
|
||||||
assertThat(pmd.inputPaths()).as("String...").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
|
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
|
||||||
|
|
||||||
pmd = newPmdOperation()
|
|
||||||
.ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML)
|
|
||||||
.inputPathsFiles(List.of(ERROR_PRONE_SAMPLE.toFile(), CODE_STYLE_SAMPLE.toFile()));
|
|
||||||
assertThat(pmd.inputPaths()).as("List(Path...)").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
|
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
|
||||||
|
|
||||||
pmd = newPmdOperation()
|
|
||||||
.ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML)
|
|
||||||
.inputPathsStrings(List.of(ERROR_PRONE_SAMPLE.toString(), CODE_STYLE_SAMPLE.toString()));
|
|
||||||
assertThat(pmd.inputPaths()).as("List(String...)").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
|
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testJavaBestPractices() throws ExitStatusException {
|
|
||||||
var pmd = newPmdOperation().ruleSets("category/java/bestpractices.xml")
|
var pmd = newPmdOperation().ruleSets("category/java/bestpractices.xml")
|
||||||
.inputPaths(Path.of("src/test/resources/java/BestPractices.java"));
|
.inputPaths(Path.of("src/test/resources/java/BestPractices.java"));
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(11);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testJavaCodeStyle() throws ExitStatusException {
|
void testJavaCodeStyle() {
|
||||||
var pmd = newPmdOperation().ruleSets(CODE_STYLE_XML).inputPaths(CODE_STYLE_SAMPLE);
|
var pmd = newPmdOperation().ruleSets(CODE_STYLE).inputPaths(CODE_STYLE_SAMPLE);
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(CODING_STYLE_ERRORS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testJavaCodeStyleAndErrorProne() throws ExitStatusException {
|
void testJavaCodeStyleAndErrorProne() {
|
||||||
var pmd = newPmdOperation().ruleSets(CODE_STYLE_XML).inputPaths(CODE_STYLE_SAMPLE);
|
var pmd = newPmdOperation().ruleSets(CODE_STYLE).inputPaths(CODE_STYLE_SAMPLE);
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)))
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)))
|
||||||
.as("code style").isGreaterThan(0);
|
.as("code style").isEqualTo(CODING_STYLE_ERRORS);
|
||||||
|
pmd = pmd.addRuleSet(ERROR_PRONE).addInputPath(ERROR_PRONE_SAMPLE);
|
||||||
pmd = pmd.ruleSets(ERROR_PRONE_XML).inputPaths(ERROR_PRONE_SAMPLE);
|
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)))
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)))
|
||||||
.as("code style + error prone").isGreaterThan(0);
|
.as("code style + error prone").isEqualTo(34);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testJavaDesign() throws ExitStatusException {
|
void testJavaDesign() {
|
||||||
var pmd = newPmdOperation()
|
var pmd = newPmdOperation().ruleSets("category/java/design.xml")
|
||||||
.ruleSets(DESIGN_XML)
|
.inputPaths(Path.of("src/test/resources/java/Design.java"))
|
||||||
.inputPaths("src/test/resources/java/Design.java")
|
.cache(Path.of("build/pmd/design-cache"));
|
||||||
.cache(new File("build/pmd/design-cache"));
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(4);
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testJavaDocumentation() throws ExitStatusException {
|
void testJavaDocumentation() {
|
||||||
var pmd = newPmdOperation()
|
var pmd = newPmdOperation().ruleSets("category/java/documentation.xml")
|
||||||
.ruleSets(DOCUMENTATION_XML)
|
|
||||||
.inputPaths(Path.of("src/test/resources/java/Documentation.java"));
|
.inputPaths(Path.of("src/test/resources/java/Documentation.java"));
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testJavaErrorProne() throws ExitStatusException {
|
void testJavaErrorProne() {
|
||||||
var pmd = newPmdOperation().ruleSets(ERROR_PRONE_XML).inputPaths(ERROR_PRONE_SAMPLE);
|
var pmd = newPmdOperation().ruleSets(ERROR_PRONE).inputPaths(ERROR_PRONE_SAMPLE);
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(ERROR_PRONE_ERRORS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testJavaMultiThreading() throws ExitStatusException {
|
void testJavaMultiThreading() {
|
||||||
var pmd = newPmdOperation().ruleSets("category/java/multithreading.xml")
|
var pmd = newPmdOperation().ruleSets("category/java/multithreading.xml")
|
||||||
.inputPaths(Path.of("src/test/resources/java/MultiThreading.java"));
|
.inputPaths(Path.of("src/test/resources/java/MultiThreading.java"));
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testJavaPerformance() throws ExitStatusException {
|
void testJavaPerformance() {
|
||||||
var pmd = newPmdOperation()
|
var pmd = newPmdOperation().ruleSets("category/java/performance.xml")
|
||||||
.ruleSets(PERFORMANCE_XML)
|
|
||||||
.inputPaths(Path.of("src/test/resources/java/Performance.java"));
|
.inputPaths(Path.of("src/test/resources/java/Performance.java"));
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(9);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testJavaQuickStart() throws ExitStatusException {
|
void testJavaQuickStart() {
|
||||||
var pmd = newPmdOperation().ruleSets(PmdOperation.RULE_SET_DEFAULT)
|
var pmd = newPmdOperation().ruleSets("rulesets/java/quickstart.xml")
|
||||||
.inputPaths(new File("src/test/resources/java/"));
|
.inputPaths(Path.of("src/test/resources/java"));
|
||||||
assertThat(pmd.ruleSets()).containsExactly(PmdOperation.RULE_SET_DEFAULT);
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(34);
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testJavaSecurity() throws ExitStatusException {
|
void testJavaSecurity() {
|
||||||
var pmd = newPmdOperation().ruleSets(SECURITY_XML)
|
var pmd = newPmdOperation().ruleSets("category/java/security.xml")
|
||||||
.inputPaths(Path.of("src/test/resources/java/Security.java"));
|
.inputPaths(Path.of("src/test/resources/java/Security.java"));
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testLanguageVersions() throws ExitStatusException {
|
void testMainOperation() {
|
||||||
var language = LanguageRegistry.PMD.getLanguageById("java");
|
var pmd = newPmdOperation().inputPaths(Path.of("src/main"))
|
||||||
assertThat(language).isNotNull();
|
|
||||||
|
|
||||||
var pmd = newPmdOperation()
|
|
||||||
.forceLanguageVersion(language.getLatestVersion())
|
|
||||||
.defaultLanguageVersions(language.getVersions())
|
|
||||||
.languageVersions(language.getDefaultVersion())
|
|
||||||
.ruleSets(PmdOperation.RULE_SET_DEFAULT);
|
|
||||||
assertThat(pmd.languageVersions()).contains(language.getDefaultVersion());
|
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
|
||||||
|
|
||||||
assertThat(pmd.defaultLanguageVersions(language.getVersion("17"), language.getVersion("21"))
|
|
||||||
.languageVersions(language.getVersions()).performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)))
|
|
||||||
.as("17 & 21").isGreaterThan(0);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testMainOperation() throws ExitStatusException {
|
|
||||||
var pmd = newPmdOperation().inputPaths(new File("src/main"))
|
|
||||||
.performPmdAnalysis(TEST, newPmdOperation().initConfiguration(COMMAND_NAME));
|
.performPmdAnalysis(TEST, newPmdOperation().initConfiguration(COMMAND_NAME));
|
||||||
assertThat(pmd).isEqualTo(0);
|
assertThat(pmd).isEqualTo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void testPrependAuxClasspath() {
|
|
||||||
var pmd = newPmdOperation().ruleSets(CATEGORY_FOO).prependAuxClasspath(FOO, BAR);
|
|
||||||
assertThat(pmd.prependAuxClasspath()).isEqualTo(FOO + File.pathSeparator + BAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testPriority() throws ExitStatusException {
|
|
||||||
var pmd = newPmdOperation().inputPaths(CODE_STYLE_SAMPLE).minimumPriority(RulePriority.HIGH);
|
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testRelativizeRoots() {
|
void testRelativizeRoots() {
|
||||||
var baz = Path.of("baz/foz");
|
var foo = Path.of("foo/bar");
|
||||||
|
var bar = Path.of("bar/foo");
|
||||||
|
|
||||||
var pmd = newPmdOperation().ruleSets(List.of(CATEGORY_FOO)).relativizeRoots(PATH_FOO).
|
var pmd = newPmdOperation().ruleSets(CATEGORY_FOO).relativizeRoots(foo).addRelativizeRoot(bar);
|
||||||
relativizeRoots(PATH_BAR.toFile()).relativizeRoots(baz.toString())
|
|
||||||
.relativizeRoots(List.of(PATH_FOO, PATH_BAR, baz));
|
|
||||||
var config = pmd.initConfiguration(COMMAND_NAME);
|
var config = pmd.initConfiguration(COMMAND_NAME);
|
||||||
assertThat(config.getRelativizeRoots()).isEqualTo(pmd.relativizeRoots())
|
assertThat(config.getRelativizeRoots()).contains(foo).contains(bar);
|
||||||
.containsExactly(PATH_FOO, PATH_BAR, baz, PATH_FOO, PATH_BAR, baz);
|
|
||||||
|
|
||||||
pmd = newPmdOperation().ruleSets(List.of(CATEGORY_FOO))
|
|
||||||
.relativizeRootsFiles(List.of(PATH_FOO.toFile(), PATH_BAR.toFile(), baz.toFile()));
|
|
||||||
config = pmd.initConfiguration(COMMAND_NAME);
|
|
||||||
assertThat(config.getRelativizeRoots()).as("List(File...)").isEqualTo(pmd.relativizeRoots())
|
|
||||||
.containsExactly(PATH_FOO, PATH_BAR, baz);
|
|
||||||
|
|
||||||
pmd = newPmdOperation().ruleSets(List.of(CATEGORY_FOO))
|
|
||||||
.relativizeRootsStrings(List.of(PATH_FOO.toString(), PATH_BAR.toString(), baz.toString()));
|
|
||||||
config = pmd.initConfiguration(COMMAND_NAME);
|
|
||||||
assertThat(config.getRelativizeRoots()).as("List(String....)").isEqualTo(pmd.relativizeRoots())
|
|
||||||
.containsExactly(PATH_FOO, PATH_BAR, baz);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testReportFile() throws FileNotFoundException, ExitStatusException {
|
void testReportFormat() throws IOException {
|
||||||
var report = new File("build", "pmd-report-file");
|
var pmd = newPmdOperation().ruleSets(ERROR_PRONE).reportFormat("xml").inputPaths(ERROR_PRONE_SAMPLE);
|
||||||
report.deleteOnExit();
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(ERROR_PRONE_ERRORS);
|
||||||
var pmd = newPmdOperation().ruleSets(List.of(ERROR_PRONE_XML, DESIGN_XML)).reportFile(report);
|
try (var br = Files.newBufferedReader(pmd.reportFile)) {
|
||||||
pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME));
|
assertThat(br.readLine()).as("xml report").startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||||
assertThat(report).exists();
|
|
||||||
|
|
||||||
try (var writer = new PrintWriter(report)) {
|
|
||||||
writer.write("");
|
|
||||||
}
|
|
||||||
assertThat(report).isEmpty();
|
|
||||||
|
|
||||||
pmd.reportFile(report.getAbsolutePath()).performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME));
|
|
||||||
assertThat(report).isNotEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testReportFormat() throws IOException, ExitStatusException {
|
|
||||||
var pmd = newPmdOperation().ruleSets(ERROR_PRONE_XML).reportFormat("xml").inputPaths(ERROR_PRONE_SAMPLE);
|
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
|
||||||
try (var softly = new AutoCloseableSoftAssertions()) {
|
|
||||||
try (var br = Files.newBufferedReader(pmd.reportFile())) {
|
|
||||||
softly.assertThat(br.readLine()).as("xml report")
|
|
||||||
.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testReportProperties() throws ExitStatusException {
|
void testRuleSetsConfigFile() {
|
||||||
var pmd = newPmdOperation().ruleSets(CODE_STYLE_XML, ERROR_PRONE_XML)
|
|
||||||
.includeLineNumber(true)
|
|
||||||
.reportProperties(new Properties());
|
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testRuleSetsConfigFile() throws ExitStatusException {
|
|
||||||
var pmd = newPmdOperation().ruleSets("src/test/resources/pmd.xml")
|
var pmd = newPmdOperation().ruleSets("src/test/resources/pmd.xml")
|
||||||
.ignoreFile("src/test/resources/ignore-all.txt");
|
.ignoreFile(Path.of("src/test/resources/ignore-all.txt"));
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(0);
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testRuleSetsEmpty() throws ExitStatusException {
|
void testRuleSetsEmpty() {
|
||||||
var pmd = newPmdOperation().ruleSets("").failOnError(false);
|
var pmd = newPmdOperation().ruleSets("");
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(0);
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testShowSuppressed() {
|
void testShowSuppressed() {
|
||||||
var pmd = newPmdOperation().ruleSets(ERROR_PRONE_XML).showSuppressed(true);
|
var pmd = newPmdOperation().ruleSets(ERROR_PRONE).showSuppressed(true);
|
||||||
var config = pmd.initConfiguration(COMMAND_NAME);
|
var config = pmd.initConfiguration(COMMAND_NAME);
|
||||||
assertThat(config.isShowSuppressedViolations()).isTrue();
|
assertThat(config.isShowSuppressedViolations()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSuppressedMarker() {
|
void testSuppressedMarker() {
|
||||||
var pmd = newPmdOperation().ruleSets(ERROR_PRONE_XML).suppressedMarker(TEST);
|
var pmd = newPmdOperation().ruleSets(ERROR_PRONE).suppressedMarker(TEST);
|
||||||
var config = pmd.initConfiguration(COMMAND_NAME);
|
var config = pmd.initConfiguration(COMMAND_NAME);
|
||||||
assertThat(config.getSuppressMarker()).isEqualTo(TEST);
|
assertThat(config.getSuppressMarker()).isEqualTo(TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testThreads() {
|
void testThreads() {
|
||||||
var pmd = newPmdOperation().ruleSets(ERROR_PRONE_XML).threads(5);
|
var pmd = newPmdOperation().ruleSets(ERROR_PRONE).threads(5);
|
||||||
var config = pmd.initConfiguration(COMMAND_NAME);
|
var config = pmd.initConfiguration(COMMAND_NAME);
|
||||||
assertThat(config.getThreads()).isEqualTo(5);
|
assertThat(config.getThreads()).isEqualTo(5);
|
||||||
}
|
}
|
||||||
|
@ -570,15 +236,15 @@ class PmdOperationTest {
|
||||||
@Test
|
@Test
|
||||||
void testUri() throws URISyntaxException {
|
void testUri() throws URISyntaxException {
|
||||||
var uri = new URI("https://example.com");
|
var uri = new URI("https://example.com");
|
||||||
var pmd = newPmdOperation().ruleSets(ERROR_PRONE_XML).uri(uri);
|
var pmd = newPmdOperation().ruleSets(ERROR_PRONE).uri(uri);
|
||||||
var config = pmd.initConfiguration(COMMAND_NAME);
|
var config = pmd.initConfiguration(COMMAND_NAME);
|
||||||
assertThat(config.getUri()).isEqualTo(uri);
|
assertThat(config.getUri()).isEqualTo(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testXml() throws ExitStatusException {
|
void testXml() {
|
||||||
var pmd = newPmdOperation().addInputPaths("src/test/resources/pmd.xml")
|
var pmd = newPmdOperation().inputPaths(Path.of("src/test/resources/pmd.xml"))
|
||||||
.ruleSets("src/test/resources/xml/basic.xml");
|
.ruleSets("src/test/resources/xml/basic.xml");
|
||||||
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
|
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
src/test/resources/java/ErrorProne.java
|
|
|
@ -1,17 +1,17 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package java;
|
package java;
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package java;
|
package java;
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package java;
|
package java;
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package java;
|
package java;
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package java;
|
package java;
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package java;
|
package java;
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package java;
|
package java;
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package java;
|
package java;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<ruleset name="test"
|
||||||
name="test"
|
|
||||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||||
<description>Erik's Ruleset</description>
|
<description>Erik's Ruleset</description>
|
||||||
<!-- BEST PRACTICES -->
|
<!-- BEST PRACTICES -->
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<ruleset name="Basic"
|
||||||
name="Basic"
|
|
||||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||||
<description>
|
<description>
|
||||||
The Basic ruleset contains a collection of good practices which should be followed.
|
The Basic ruleset contains a collection of good practices which should be followed.
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
name="old"
|
|
||||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
|
||||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
|
||||||
<description>Deprecated (old) rule</description>
|
|
||||||
<rule ref="category/java/performance.xml/UnnecessaryWrapperObjectCreation"/>
|
|
||||||
</ruleset>
|
|
Loading…
Add table
Add a link
Reference in a new issue