You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2012/05/26 22:07:35 UTC
svn commit: r1342954 - in /maven/plugins/trunk/maven-pmd-plugin/src:
main/java/org/apache/maven/plugin/pmd/PmdReport.java
site/apt/examples/javascriptReport.apt.vm site/apt/index.apt.vm site/site.xml
Author: olamy
Date: Sat May 26 20:07:35 2012
New Revision: 1342954
URL: http://svn.apache.org/viewvc?rev=1342954&view=rev
Log:
[MPMD-150] Add Javascript documentation
Submitted by Andreas Dangel.
Added:
maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/javascriptReport.apt.vm (with props)
Modified:
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
maven/plugins/trunk/maven-pmd-plugin/src/site/apt/index.apt.vm
maven/plugins/trunk/maven-pmd-plugin/src/site/site.xml
Modified: maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java?rev=1342954&r1=1342953&r2=1342954&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java (original)
+++ maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java Sat May 26 20:07:35 2012
@@ -91,6 +91,7 @@ public class PmdReport
* </p>
*
* @parameter default-value="java"
+ * @since 2.8
*/
private String language;
Added: maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/javascriptReport.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/javascriptReport.apt.vm?rev=1342954&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/javascriptReport.apt.vm (added)
+++ maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/javascriptReport.apt.vm Sat May 26 20:07:35 2012
@@ -0,0 +1,88 @@
+ ------
+ Analyzing JavaScript Code
+ ------
+ Andreas Dangel
+ ------
+ 23 May 2012
+ ------
+
+ ~~ 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.
+
+~~ NOTE: For help with the syntax of this file, see:
+~~ http://maven.apache.org/doxia/references/apt-format.html
+
+Analyzing JavaScript Code
+
+ The PMD plugin analyzes by default java. You can configure it to analyze JavaScript files instead as shown below.
+
+ The example assumes that the javascript source code is stored in the subfolder <<<src/main/javascript>>> and
+ enables three built-in rulesets (<basic>, <braces>, <unnecessary>).
+
+ Note that you have to make sure that the build-helper-maven-plugin is executed, so that the additional source folder
+ is actually added. To generate the site report, you can include e.g. the <generate-sources> phase:
+
+ <<<mvn generate-sources site>>>
+
++-----+
+<project>
+ ...
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.7</version>
+ <configuration>
+ <sources>
+ <source>${basedir}/src/main/javascript/</source>
+ </sources>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <version>${project.version}</version>
+ <configuration>
+ <language>javascript</language>
+ <rulesets>
+ <ruleset>ecmascript-basic</ruleset>
+ <ruleset>ecmascript-braces</ruleset>
+ <ruleset>ecmascript-unnecessary</ruleset>
+ </rulesets>
+ <includes>
+ <include>**/*.js</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ ...
+</project>
++-----+
Propchange: maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/javascriptReport.apt.vm
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/javascriptReport.apt.vm
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/plugins/trunk/maven-pmd-plugin/src/site/apt/index.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/site/apt/index.apt.vm?rev=1342954&r1=1342953&r2=1342954&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/site/apt/index.apt.vm (original)
+++ maven/plugins/trunk/maven-pmd-plugin/src/site/apt/index.apt.vm Sat May 26 20:07:35 2012
@@ -83,4 +83,6 @@ Maven PMD Plugin
* {{{./examples/violationChecking.html}Violation Checking}}
+ * {{{./examples/javascriptReport.html}Analyzing JavaScript Code}}
+
[]
Modified: maven/plugins/trunk/maven-pmd-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/site/site.xml?rev=1342954&r1=1342953&r2=1342954&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/site/site.xml (original)
+++ maven/plugins/trunk/maven-pmd-plugin/src/site/site.xml Sat May 26 20:07:35 2012
@@ -35,6 +35,7 @@ under the License.
<item name="Target JDK" href="examples/targetJdk.html"/>
<item name="Using Rule Sets" href="examples/usingRuleSets.html"/>
<item name="Violation Checking" href="examples/violationChecking.html"/>
+ <item name="Analyzing JavaScript" href="examples/javascriptReport.html"/>
</menu>
</body>
</project>