This is an automated email from the ASF dual-hosted git repository.
claude pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/creadur-rat.git
The following commit(s) were added to refs/heads/master by this push:
new 329cfd2d RAT-485: Add environment variable documentation (#533)
329cfd2d is described below
commit 329cfd2da4a9d211fce6041bc1f71e244aed12f7
Author: Claude Warren <[email protected]>
AuthorDate: Sun Sep 21 11:55:40 2025 +0200
RAT-485: Add environment variable documentation (#533)
* Add environment variable documentation
---------
Co-authored-by: P. Ottlinger <[email protected]>
---
.../src/main/java/org/apache/rat/api/EnvVar.java | 4 +--
.../apache/rat/documentation/velocity/RatTool.java | 11 ++++++
.../main/resources/META-INF/maven/site-tools.xml | 23 +++++++++++++
.../rat/documentation/velocity/RatToolTest.java | 39 ++++++++++++++++++++++
apache-rat/pom.xml | 21 ++++++++++++
.../main/resources/META-INF/maven/site-tools.xml | 23 -------------
apache-rat/src/site/apt/env_vars.apt.vm | 32 ++++++++++++++++++
src/changes/changes.xml | 3 ++
src/main/resources/META-INF/maven/site-tools.xml | 24 -------------
src/site/site.xml | 1 +
10 files changed, 132 insertions(+), 49 deletions(-)
diff --git a/apache-rat-core/src/main/java/org/apache/rat/api/EnvVar.java
b/apache-rat-core/src/main/java/org/apache/rat/api/EnvVar.java
index cc5435e2..0a31798d 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/api/EnvVar.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/api/EnvVar.java
@@ -41,12 +41,12 @@ public enum EnvVar {
/**
* Defines the user HOME.
*/
- HOME("The home directory"),
+ HOME("The current user's home directory."),
/**
* Sets the log level for the DefaultLog when it is constructed.
*/
RAT_DEFAULT_LOG_LEVEL("The default log level for the command line logger.
Should be one of: " +
-
Arrays.stream(Log.Level.values()).map(Log.Level::name).collect(Collectors.joining(",
")));
+
Arrays.stream(Log.Level.values()).map(Log.Level::name).collect(Collectors.joining(",
")) + ".");
/**
* The documentation for this EnvVar.
*/
diff --git
a/apache-rat-tools/src/main/java/org/apache/rat/documentation/velocity/RatTool.java
b/apache-rat-tools/src/main/java/org/apache/rat/documentation/velocity/RatTool.java
index f654ad03..317d6c25 100644
---
a/apache-rat-tools/src/main/java/org/apache/rat/documentation/velocity/RatTool.java
+++
b/apache-rat-tools/src/main/java/org/apache/rat/documentation/velocity/RatTool.java
@@ -33,6 +33,7 @@ import org.apache.commons.cli.Option;
import org.apache.commons.lang3.StringUtils;
import org.apache.rat.Defaults;
import org.apache.rat.OptionCollection;
+import org.apache.rat.api.EnvVar;
import org.apache.rat.commandline.StyleSheets;
import org.apache.rat.config.exclusion.StandardCollection;
import org.apache.rat.config.parameters.ComponentType;
@@ -180,6 +181,16 @@ public class RatTool {
.collect(Collectors.toList());
}
+ /**
+ * Gets the list of environment variables.
+ * @return a list of environment variables.
+ */
+ public List<EnvVar> environmentVariables() {
+ return Arrays.stream(EnvVar.values())
+ .sorted(Comparator.comparing(EnvVar::name))
+ .collect(Collectors.toList());
+ }
+
/**
* Gets the set of Matchers.
* @return the set of Matchers.
diff --git a/apache-rat-tools/src/main/resources/META-INF/maven/site-tools.xml
b/apache-rat-tools/src/main/resources/META-INF/maven/site-tools.xml
new file mode 100644
index 00000000..0bdb8b91
--- /dev/null
+++ b/apache-rat-tools/src/main/resources/META-INF/maven/site-tools.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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
+
+ http://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.
+-->
+<tools>
+ <toolbox scope="application">
+ <tool class="org.apache.rat.documentation.velocity.RatTool"/>
+ <tool key="stringUtils" class="org.apache.commons.lang3.StringUtils"/>
+ </toolbox>
+</tools>
diff --git
a/apache-rat-tools/src/test/java/org/apache/rat/documentation/velocity/RatToolTest.java
b/apache-rat-tools/src/test/java/org/apache/rat/documentation/velocity/RatToolTest.java
new file mode 100644
index 00000000..cafd7361
--- /dev/null
+++
b/apache-rat-tools/src/test/java/org/apache/rat/documentation/velocity/RatToolTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * http://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 org.apache.rat.documentation.velocity;
+
+import java.util.List;
+import org.apache.rat.api.EnvVar;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class RatToolTest {
+ final RatTool tool = new RatTool();
+
+ @Test
+ void ratTool() {
+ List<EnvVar> vars = tool.environmentVariables();
+ assertThat(vars.size()).isEqualTo(EnvVar.values().length);
+ for (EnvVar envVar : EnvVar.values()) {
+ vars.remove(envVar);
+ }
+ assertThat(vars.isEmpty());
+ }
+}
diff --git a/apache-rat/pom.xml b/apache-rat/pom.xml
index 99f85bc8..3e63b4ad 100644
--- a/apache-rat/pom.xml
+++ b/apache-rat/pom.xml
@@ -172,6 +172,27 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.doxia</groupId>
+ <artifactId>doxia-module-markdown</artifactId>
+ <version>2.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apache-rat-tools</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apache-rat-core</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
diff --git a/apache-rat/src/main/resources/META-INF/maven/site-tools.xml
b/apache-rat/src/main/resources/META-INF/maven/site-tools.xml
deleted file mode 100644
index 9ef43d26..00000000
--- a/apache-rat/src/main/resources/META-INF/maven/site-tools.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<tools>
- <!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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
-
- http://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.
- -->
- <toolbox scope="application">
- <tool class="org.apache.rat.documentation.velocity.RatTool"/>
- </toolbox>
-</tools>
diff --git a/apache-rat/src/site/apt/env_vars.apt.vm
b/apache-rat/src/site/apt/env_vars.apt.vm
new file mode 100644
index 00000000..8bcdf673
--- /dev/null
+++ b/apache-rat/src/site/apt/env_vars.apt.vm
@@ -0,0 +1,32 @@
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~ Licensed to the Apache Software Foundation (ASF) under one or more
+~~ contributor license agreements. See the NOTICE file distributed with
+~~ this work for additional information regarding copyright ownership.
+~~ The ASF licenses this file to You 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
+~~
+~~ http://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.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ --------------------------
+ Environment Variables
+ --------------------------
+
+Environment Variables
+
+ There are several environment variables that affect the RAT engine. They are:
+
+#foreach ($envvar in ${rat.environmentVariables})
+ #set($desc = $rat.aptEscape(${envvar.documentation}))
+ ** ${envvar.name}
+
+ ${desc}
+
+#end
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index f4d3de91..caccc66c 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -72,6 +72,9 @@ The <action> type attribute can be one of:
</release>
-->
<release version="0.17-SNAPSHOT" date="xxxx-yy-zz" description="Current
SNAPSHOT - release to be done">
+ <action issue="RAT-485" type="add" dev="claudenw">
+ Add documentation of environment variables used in the RAT engine.
+ </action>
<action issue="RAT-362" type="add" dev="claudenw">
Improve test and test result reporting for .gitignore parsing.
Introduce environment variable abstraction.
</action>
diff --git a/src/main/resources/META-INF/maven/site-tools.xml
b/src/main/resources/META-INF/maven/site-tools.xml
deleted file mode 100644
index fd3a6a0b..00000000
--- a/src/main/resources/META-INF/maven/site-tools.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0"?>
-<tools>
- <!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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
-
- http://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.
- -->
- <toolbox scope ="application">
- <tool class="org.apache.rat.documentation.velocity.RatTool"/>
- </toolbox>
-</tools>
diff --git a/src/site/site.xml b/src/site/site.xml
index f2076634..773a3835 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -53,6 +53,7 @@
<menu name="RAT from the Command Line" inherit="bottom">
<item name="Command Line Introduction" href="apache-rat/index.html"/>
<item name="Command Line Options" href="apache-rat/cli_options.html"/>
+ <item name="Environment Variables" href="apache-rat/env_vars.html" />
<item name="Exclusion Expressions"
href="apache-rat-core/exclusion_expression.html"/>
<item name="Standard Collections"
href="apache-rat/standard_collections.html"/>
</menu>