Compare commits

...

17 commits

22 changed files with 465 additions and 70 deletions

View file

@ -0,0 +1,57 @@
name: javadocs-pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout source repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Build Javadocs
run: ./bld download clean javadoc
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload generated Javadocs repository
path: 'build/javadoc/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

View file

@ -1,6 +1,6 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="Copyright &amp;#36;today.year the original author or authors.&#10; &#10;Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&#10;you may not use this file except in compliance with the License.&#10;You may obtain a copy of the License at&#10;&#10; https://www.apache.org/licenses/LICENSE-2.0&#10;&#10;Unless required by applicable law or agreed to in writing, software&#10;distributed under the License is distributed on an &quot;AS IS&quot; BASIS,&#10;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&#10;See the License for the specific language governing permissions and&#10;limitations under the License." />
<option name="notice" value="Copyright 2023-Copyright &amp;#36;today.yearamp;#36;today.year the original author or authors.&#10; &#10;Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&#10;you may not use this file except in compliance with the License.&#10;You may obtain a copy of the License at&#10;&#10; https://www.apache.org/licenses/LICENSE-2.0&#10;&#10;Unless required by applicable law or agreed to in writing, software&#10;distributed under the License is distributed on an &quot;AS IS&quot; BASIS,&#10;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&#10;See the License for the specific language governing permissions and&#10;limitations under the License." />
<option name="myName" value="Apache License" />
</copyright>
</component>
</component>

204
.idea/intellij-javadocs-4.0.1.xml generated Normal file
View file

@ -0,0 +1,204 @@
<?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>FIELD</LEVEL>
<LEVEL>METHOD</LEVEL>
<LEVEL>TYPE</LEVEL>
</LEVELS>
<VISIBILITIES>
<VISIBILITY>PUBLIC</VISIBILITY>
<VISIBILITY>PROTECTED</VISIBILITY>
<VISIBILITY>DEFAULT</VISIBILITY>
</VISIBILITIES>
</GENERAL>
<TEMPLATES>
<CLASSES>
<CLASS>
<KEY>^.*(public|protected|private)*.+interface\s+\w+.*</KEY>
<VALUE>/**\n
* The interface ${name}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
*/</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
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
*/</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
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</CONSTRUCTOR>
</CONSTRUCTORS>
<METHODS>
<METHOD>
<KEY>^.*(public|protected|private)*\s*.*(\w(\s*&lt;.+&gt;)*)+\s+get\w+\s*\(.*\).+</KEY>
<VALUE>/**\n
* Gets ${partName}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if isNotVoid&gt;
*\n
* @return the ${partName}\n
&lt;/#if&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
<METHOD>
<KEY>^.*(public|protected|private)*\s*.*(void|\w(\s*&lt;.+&gt;)*)+\s+set\w+\s*\(.*\).+</KEY>
<VALUE>/**\n
* Sets ${partName}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if isNotVoid&gt;
*\n
* @return the ${partName}\n
&lt;/#if&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</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
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
* @param ${element.parameterList.parameters[0].name} the input arguments\n
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
<METHOD>
<KEY>.+</KEY>
<VALUE>/**\n
* ${name}&lt;#if isNotVoid&gt; ${return}&lt;/#if&gt;.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if isNotVoid&gt;
*\n
* @return the ${return}\n
&lt;/#if&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</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
&lt;#if element.parent.isInterface()&gt;
* The constant ${element.getName()}.\n
&lt;#else&gt;
* The ${name}.\n
&lt;/#if&gt; */</VALUE>
</FIELD>
<FIELD>
<KEY>.+</KEY>
<VALUE>/**\n
&lt;#if element.parent.isEnum()&gt;
*${name} ${typeName}.\n
&lt;#else&gt;
* The ${name}.\n
&lt;/#if&gt;*/</VALUE>
</FIELD>
</FIELDS>
</TEMPLATES>
</component>
</project>

View file

@ -2,11 +2,12 @@
<library name="bld">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.5.jar!/" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.9.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.5-sources.jar!/" />
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.9.0-sources.jar!/" />
</SOURCES>
<excluded>
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
@ -14,4 +15,4 @@
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" type="SOURCES" />
</library>
</component>
</component>

13
.idea/misc.xml generated
View file

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<pattern value="rife.bld.extension.CheckstyleOperationBuild" />
@ -8,6 +9,18 @@
<option name="customRuleSets">
<list>
<option value="$PROJECT_DIR$/config/pmd.xml" />
<option value="K:\java\semver\config\pmd.xml" />
<option value="$PROJECT_DIR$/../bld-generated-version/config/pmd.xml" />
<option value="$PROJECT_DIR$/../bld-pitest/config/pmd.xml" />
<option value="$PROJECT_DIR$/../bld-jacoco-report/config/pmd.xml" />
<option value="$PROJECT_DIR$/../bld-exec/config/pmd.xml" />
<option value="$PROJECT_DIR$/../bld-testng/config/pmd.xml" />
<option value="$PROJECT_DIR$/../../bld-generated-version/config/pmd.xml" />
<option value="$PROJECT_DIR$/../../bld-pitest/config/pmd.xml" />
<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" />
</list>
</option>
<option name="skipTestSources" value="false" />

9
.vscode/launch.json vendored
View file

@ -5,7 +5,14 @@
"type": "java",
"name": "Run Tests",
"request": "launch",
"mainClass": "rife.bld.extension.CheckstyleOperationTest"
"mainClass": "org.junit.platform.console.ConsoleLauncher",
"args": [
"--details=verbose",
"--scan-classpath",
"--disable-banner",
"--disable-ansi-colors",
"--exclude-engine=junit-platform-suite",
"--exclude-engine=junit-vintage"]
}
]
}

10
.vscode/settings.json vendored
View file

@ -3,13 +3,13 @@
"src/main/java",
"src/main/resources",
"src/test/java",
"src/bld/java"
"src/test/resources",
"src/bld/java",
"src/bld/resources"
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
"${HOME}/.bld/dist/bld-1.7.5.jar",
"lib/compile/*.jar",
"lib/runtime/*.jar",
"lib/test/*.jar"
"${HOME}/.bld/dist/bld-1.9.0.jar",
"lib/**/*.jar"
]
}

View file

@ -1,8 +1,8 @@
# [Checkstyle](https://checkstyle.sourceforge.io/) Extension for [b<span style="color:orange">l</span>d](https://rife2.com/bldb)
# [Checkstyle](https://checkstyle.sourceforge.io/) Extension for [b<span style="color:orange">l</span>d](https://rife2.com/bldb)
[![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Java](https://img.shields.io/badge/java-17%2B-blue)](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
[![bld](https://img.shields.io/badge/1.7.3-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld)
[![bld](https://img.shields.io/badge/1.9.0-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld)
[![Release](https://flat.badgen.net/maven/v/metadata-url/repo.rife2.com/releases/com/uwyn/rife2/bld-checkstyle/maven-metadata.xml?color=blue)](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-checkstyle)
[![Snapshot](https://flat.badgen.net/maven/v/metadata-url/repo.rife2.com/snapshots/com/uwyn/rife2/bld-checkstyle/maven-metadata.xml?label=snapshot)](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-checkstyle)
[![GitHub CI](https://github.com/rife2/bld-checkstyle/actions/workflows/bld.yml/badge.svg)](https://github.com/rife2/bld-checkstyle/actions/workflows/bld.yml)
@ -21,19 +21,21 @@ public void checkstyle() throws Exception {
}
```
```
```console
./bld checkstyle
```
- [View Examples](https://github.com/rife2/bld-checkstyle/blob/master/examples/src/bld/java/com/example/)
Please check the [CheckstyleOperation documentation](https://rife2.github.io/bld-checkstyle/rife/bld/extension/CheckstyleOperation.html#method-summary) for all available configuration options.
Please check the [CheckstyleOperation documentation](https://rife2.github.io/bld-checkstyle/rife/bld/extension/CheckstyleOperation.html#method-summary)
for all available configuration options.
### Checkstyle Dependency
## Checkstyle Dependency
Don't forget to add a Checkstyle `test` dependency to your build file, as it is not provided by the extension. For example:
Don't forget to add a Checkstyle `test` dependency to your build file, as it is
not provided by the extension. For example:
```java
repositories = List.of(MAVEN_CENTRAL);
scope(test).include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 12, 2)));
scope(test).include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 14, 2)));
```

12
checkcliargs.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash
MAIN="com.puppycrawl.tools.checkstyle.Main"
TMPNEW=/tmp/checkcliargs-new
TMPOLD=/tmp/checkcliargs-old
java -cp "lib/test/*" $MAIN --help >$TMPNEW
java -cp "examples/lib/test/*" $MAIN --help >$TMPOLD
diff $TMPOLD $TMPNEW
rm -rf $TMPNEW $TMPOLD

1
examples/.idea/.name generated Normal file
View file

@ -0,0 +1 @@
bld-checkstyle-examples

View file

@ -2,11 +2,12 @@
<library name="bld">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.5.jar!/" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.9.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.5-sources.jar!/" />
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.9.0-sources.jar!/" />
</SOURCES>
<excluded>
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
@ -14,4 +15,4 @@
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" type="SOURCES" />
</library>
</component>
</component>

View file

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PDMPlugin">
<option name="customRuleSets">
@ -11,4 +10,4 @@
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build" />
</component>
</project>
</project>

View file

@ -3,13 +3,13 @@
"src/main/java",
"src/main/resources",
"src/test/java",
"src/bld/java"
"src/test/resources",
"src/bld/java",
"src/bld/resources"
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
"${HOME}/.bld/dist/bld-1.7.5.jar",
"lib/compile/*.jar",
"lib/runtime/*.jar",
"lib/test/*.jar"
"${HOME}/.bld/dist/bld-1.9.0.jar",
"lib/**/*.jar"
]
}

6
examples/README.md Normal file
View file

@ -0,0 +1,6 @@
# Compile and Run Checkstyle
```console
./bld compile checkstyle
```

Binary file not shown.

View file

@ -1,7 +1,7 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.extensions=com.uwyn.rife2:bld-checkstyle:0.9.0-SNAPSHOT
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_RELEASES
bld.extensions=com.uwyn.rife2:bld-checkstyle:0.9.5
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories=
bld.version=1.7.5
bld.version=1.9.0

View file

@ -16,10 +16,12 @@ public class ExamplesBuild extends BaseProject {
mainClass = "com.example.ExamplesMain";
version = version(0, 1, 0);
autoDownloadPurge = true;
downloadSources = true;
repositories = List.of(MAVEN_CENTRAL);
scope(test).include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 12, 4)));
scope(test).include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 14, 2)));
testOperation().mainClass("com.example.ExamplesTest");
}
@ -36,4 +38,4 @@ public class ExamplesBuild extends BaseProject {
.execute();
}
}
}

Binary file not shown.

View file

@ -1,8 +1,8 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.2
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.0
bld.repositories=MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.7
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.3
bld.repositories=MAVEN_CENTRAL,MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories=
bld.version=1.7.5
bld.version=1.9.0

View file

@ -1,5 +1,5 @@
/*
* Copyright 2023 the original author or authors.
* Copyright 2023-2024 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.
@ -27,14 +27,15 @@ import java.util.List;
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
import static rife.bld.dependencies.Repository.RIFE2_RELEASES;
import static rife.bld.dependencies.Scope.*;
import static rife.bld.dependencies.Scope.compile;
import static rife.bld.dependencies.Scope.test;
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
public class CheckstyleOperationBuild extends Project {
public CheckstyleOperationBuild() {
pkg = "rife.bld.extension";
name = "CheckstyleOperation";
version = version(0, 9, 0, "SNAPSHOT");
version = version(0, 9, 5);
javaRelease = 17;
downloadSources = true;
@ -42,15 +43,15 @@ public class CheckstyleOperationBuild extends Project {
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
scope(compile)
.include(dependency("com.uwyn.rife2", "bld", version(1, 7, 5)));
.include(dependency("com.uwyn.rife2", "bld", version(1, 9, 0)));
scope(test)
.include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 12, 4)))
.include(dependency("org.jsoup", "jsoup", version(1, 16, 2)))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0)))
.include(dependency("org.assertj", "assertj-core", version(3, 24, 2)));
.include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 14, 2)))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 2)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 2)))
.include(dependency("org.assertj", "assertj-core", version(3, 25, 3)));
javadocOperation()
.javadocOptions()
.author()
.docLint(NO_MISSING)
.link("https://rife2.github.io/bld/")
.link("https://rife2.github.io/rife2/");
@ -60,15 +61,26 @@ public class CheckstyleOperationBuild extends Project {
.info()
.groupId("com.uwyn.rife2")
.artifactId("bld-checkstyle")
.description("bld Checkstyle Extensions")
.description("bld Checkstyle Extension")
.url("https://github.com/rife2/bld-checkstyle")
.developer(new PublishDeveloper().id("ethauvin").name("Erik C. Thauvin").email("erik@thauvin.net")
.url("https://erik.thauvin.net/"))
.license(new PublishLicense().name("The Apache License, Version 2.0")
.url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
.scm(new PublishScm().connection("scm:git:https://github.com/rife2/bld-checkstyle.git")
.developerConnection("scm:git:git@github.com:rife2/bld-checkstyle.git")
.url("https://github.com/rife2/bld-checkstyle"))
.developer(
new PublishDeveloper()
.id("ethauvin")
.name("Erik C. Thauvin")
.email("erik@thauvin.net")
.url("https://erik.thauvin.net/")
)
.license(
new PublishLicense()
.name("The Apache License, Version 2.0")
.url("http://www.apache.org/licenses/LICENSE-2.0.txt")
)
.scm(
new PublishScm()
.connection("scm:git:https://github.com/rife2/bld-checkstyle.git")
.developerConnection("scm:git:git@github.com:rife2/bld-checkstyle.git")
.url("https://github.com/rife2/bld-checkstyle")
)
.signKey(property("sign.key"))
.signPassphrase(property("sign.passphrase"));
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 2023 the original author or authors.
* Copyright 2023-2024 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.
@ -45,9 +45,14 @@ public class CheckstyleOperation extends AbstractProcessOperation<CheckstyleOper
/**
* Shows Abstract Syntax Tree(AST) branches that match given XPath query.
*
* @param xPathQuery the xPath query
* @return the checkstyle operation
*/
public CheckstyleOperation branchMatchingXpath(String xPathQuery) {
options.put("-b", xPathQuery);
if (isNotBlank(xPathQuery)) {
options.put("-b", xPathQuery);
}
return this;
}
@ -55,14 +60,22 @@ public class CheckstyleOperation extends AbstractProcessOperation<CheckstyleOper
* Specifies the location of the file that defines the configuration modules. The location can either be a
* filesystem location, or a name passed to the {@link ClassLoader#getResource(String) ClassLoader.getResource() }
* method. A configuration file is required.
*
* @param file the file
* @return the checkstyle operation
*/
public CheckstyleOperation configurationFile(String file) {
options.put("-c", file);
if (isNotBlank(file)) {
options.put("-c", file);
}
return this;
}
/**
* Prints all debug logging of CheckStyle utility.
*
* @param isDebug {@code true} or {@code false}
* @return the checkstyle operation
*/
public CheckstyleOperation debug(boolean isDebug) {
if (isDebug) {
@ -77,11 +90,15 @@ public class CheckstyleOperation extends AbstractProcessOperation<CheckstyleOper
* Directory/file to exclude from CheckStyle. The path can be the full, absolute path, or relative to the current
* path. Multiple excludes are allowed.
*
* @param path one or more paths
* @return the checkstyle operation
* @see #sourceDir(Collection)
*/
public CheckstyleOperation exclude(String... path) {
for (var p : path) {
options.put("-e", p);
if (isNotBlank(p)) {
options.put("-e", p);
}
}
return this;
}
@ -90,20 +107,29 @@ public class CheckstyleOperation extends AbstractProcessOperation<CheckstyleOper
* Directory/file to exclude from CheckStyle. The path can be the full, absolute path, or relative to the current
* path. Multiple excludes are allowed.
*
* @param paths the list of paths
* @return the checkstyle operation
* @see #exclude(String...)
*/
public CheckstyleOperation exclude(Collection<String> paths) {
for (var p : paths) {
options.put("-e", p);
if (isNotBlank(p)) {
options.put("-e", p);
}
}
return this;
}
/**
* Directory/file pattern to exclude from CheckStyle. Multiple excludes are allowed.
*
* @param pattern the pattern
* @return the checkstyle operation
*/
public CheckstyleOperation excludedPathPattern(String pattern) {
options.put("-x", pattern);
if (isNotBlank(pattern)) {
options.put("-x", pattern);
}
return this;
}
@ -152,6 +178,9 @@ public class CheckstyleOperation extends AbstractProcessOperation<CheckstyleOper
/**
* Allows ignored modules to be run.
*
* @param isAllowIgnoreModules {@code true} or {@code false}
* @return the checkstyle operation
*/
public CheckstyleOperation executeIgnoredModules(boolean isAllowIgnoreModules) {
if (isAllowIgnoreModules) {
@ -165,9 +194,14 @@ public class CheckstyleOperation extends AbstractProcessOperation<CheckstyleOper
/**
* Specifies the output format. Valid values: {@code xml}, {@code sarif}, {@code plain} for the XML, sarif and
* default logger respectively. Defaults to {@code plain}.
*
* @param format the format
* @return the checkstyle operation
*/
public CheckstyleOperation format(String format) {
options.put("-f", format);
if (isNotBlank(format)) {
options.put("-f", format);
}
return this;
}
@ -176,6 +210,9 @@ public class CheckstyleOperation extends AbstractProcessOperation<CheckstyleOper
* every violation, all violations will be caught and single suppressions xml file will be printed out.
* Used only with the {@link #configurationFile(String) configurationFile} option. Output location can be specified
* with the {@link #output(String) output} option.
*
* @param xPathSuppression {@code true} or {@code false}
* @return the checkstyle operation
*/
public CheckstyleOperation generateXpathSuppression(boolean xPathSuppression) {
if (xPathSuppression) {
@ -186,10 +223,20 @@ public class CheckstyleOperation extends AbstractProcessOperation<CheckstyleOper
return this;
}
/*
* Determines if a string is not blank.
*/
private boolean isNotBlank(String s) {
return s != null && !s.isBlank();
}
/**
* Prints Parse Tree of the Javadoc comment. The file have to contain <b>only Javadoc comment content</b>
* without including '&#47;**' and '*&#47;' at the beginning and at the end respectively. The option cannot
* be used other options and requires exactly one file to run on to be specified.
*
* @param isTree {@code true} or {@code false}
* @return the checkstyle operation
*/
public CheckstyleOperation javadocTree(boolean isTree) {
if (isTree) {
@ -208,51 +255,73 @@ public class CheckstyleOperation extends AbstractProcessOperation<CheckstyleOper
* <b>ATTENTION</b>: generated result will have few queries, joined by pipe(|). Together they will match all AST nodes
* on specified line and column. You need to choose only one and recheck that it works. Usage of all of them is also
* ok, but might result in undesirable matching and suppress other issues.
*
* @param lineColumn the line column
* @return the checkstyle operation
*/
public CheckstyleOperation lineColumn(String lineColumn) {
options.put("-s", lineColumn);
if (isNotBlank(lineColumn)) {
options.put("-s", lineColumn);
}
return this;
}
/**
* Sets the output file. Defaults to stdout.
*
* @param file the file
* @return the checkstyle operation
*/
public CheckstyleOperation output(String file) {
options.put("-o", file);
if (isNotBlank(file)) {
options.put("-o", file);
}
return this;
}
/**
* Sets the property files to load.
*
* @param file the file
* @return the checkstyle operation
*/
public CheckstyleOperation propertiesFile(String file) {
options.put("-p", file);
if (isNotBlank(file)) {
options.put("-p", file);
}
return this;
}
/**
* Specified the file(s) or folder(s) containing the source files to check.
*
* @param dir one or more directories
* @return the checkstyle operation
* @see #sourceDir(Collection)
*/
public CheckstyleOperation sourceDir(String... dir) {
sourceDirs.addAll(Arrays.asList(dir));
sourceDirs.addAll(Arrays.stream(dir).filter(this::isNotBlank).toList());
return this;
}
/**
* Specified the file(s) or folder(s) containing the source files to check.
*
* @param dirs the directories
* @return the checkstyle operation
* @see #sourceDir(String...)
*/
public CheckstyleOperation sourceDir(Collection<String> dirs) {
sourceDirs.addAll(dirs);
sourceDirs.addAll(dirs.stream().filter(this::isNotBlank).toList());
return this;
}
/**
* Sets the length of the tab character. Used only with the {@link #lineColumn(String) lineColum} option.
* Default value is {@code 8}.
*
* @param length the length
* @return the checkstyle operation
*/
public CheckstyleOperation tabWith(int length) {
options.put("-w", String.valueOf(length));
@ -262,6 +331,9 @@ public class CheckstyleOperation extends AbstractProcessOperation<CheckstyleOper
/**
* Prints Abstract Syntax Tree(AST) of the checked file. The option cannot be used other options and requires
* exactly one file to run on to be specified.
*
* @param isTree {@code true} or {@code false}
* @return the checkstyle operation
*/
public CheckstyleOperation tree(boolean isTree) {
if (isTree) {
@ -275,6 +347,9 @@ public class CheckstyleOperation extends AbstractProcessOperation<CheckstyleOper
/**
* Prints Abstract Syntax Tree(AST) with comment nodes of the checked file. The option cannot be used with other
* options and requires exactly one file to run on to be specified.
*
* @param isTree {@code true} or {@code false}
* @return the checkstyle operation
*/
public CheckstyleOperation treeWithComments(boolean isTree) {
if (isTree) {
@ -290,6 +365,9 @@ public class CheckstyleOperation extends AbstractProcessOperation<CheckstyleOper
* number and columns will not be the same as it is a file due to the fact that each javadoc comment is parsed
* separately from java file. The option cannot be used with other options and requires exactly one file to run on
* to be specified.
*
* @param isTree {@code true} or {@code false}
* @return the checkstyle operation
*/
public CheckstyleOperation treeWithJavadoc(boolean isTree) {
if (isTree) {
@ -299,4 +377,4 @@ public class CheckstyleOperation extends AbstractProcessOperation<CheckstyleOper
}
return this;
}
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 2023 the original author or authors.
* Copyright 2023-2024 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.
@ -201,4 +201,4 @@ class CheckstyleOperationTest {
op = op.treeWithJavadoc(false);
assertThat(op.options.containsKey("-J")).as(REMOVE).isFalse();
}
}
}