Add Perl support to CPD.

This commit is contained in:
Vickenty Fesunov 2015-12-23 18:26:15 +01:00
parent c0d29af1c2
commit f647e19fd6
8 changed files with 146 additions and 0 deletions

View File

@ -103,6 +103,11 @@
<artifactId>pmd-matlab</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-perl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-objectivec</artifactId>

81
pmd-perl/pom.xml Normal file
View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>pmd-perl</artifactId>
<name>PMD Perl</name>
<parent>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>5.5.0-SNAPSHOT</version>
</parent>
<properties>
<config.basedir>${basedir}/../pmd-core</config.basedir>
</properties>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<useDefaultDelimiters>false</useDefaultDelimiters>
<delimiters>
<delimiter>${*}</delimiter>
</delimiters>
</configuration>
</plugin>
<plugin>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-build</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>pmd-clean</id>
<phase>clean</phase>
<configuration>
<target>
<echo>PMD specific tasks: cleaning generated markdown</echo>
<delete quiet="true">
<fileset dir="${basedir}/src/site/markdown/rules/" includes="**/*.md" />
<fileset dir="${basedir}/src/site/markdown/" includes="mergedruleset.xml" />
<fileset dir="${basedir}/src/site/" includes="site.xml" />
</delete>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-core</artifactId>
</dependency>
<dependency>
<groupId>org.mozilla</groupId>
<artifactId>rhino</artifactId>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,10 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.cpd;
public class PerlLanguage extends AbstractLanguage {
public PerlLanguage() {
super("Perl", "perl", new PerlTokenizer(), ".pm", ".pl", ".t");
}
}

View File

@ -0,0 +1,20 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.cpd;
import java.util.ArrayList;
public class PerlTokenizer extends AbstractTokenizer {
public PerlTokenizer() {
this.stringToken = new ArrayList<>();
this.stringToken.add( "\'" );
this.stringToken.add( "\"" );
this.ignorableCharacter = new ArrayList<>();
this.ignorableStmt = new ArrayList<>();
this.spanMultipleLinesString = true;
}
}

View File

@ -0,0 +1 @@
net.sourceforge.pmd.cpd.PerlLanguage

View File

@ -0,0 +1,5 @@
# PMD Perl
Contains the PMD implementation to support the Perl programming language.
Only very basic CPD support is implemented currently.

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/DECORATION/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.1.0 http://maven.apache.org/xsd/decoration-1.1.0.xsd"
name="PMD Perl">
<body>
<menu ref="parent"/>
<!-- The rulesets part of navigation will be added during pre-site and the
list is build dynamically based on rulesets folder directory layout -->
<menu name="Rule Sets"/>
<!-- *********** -->
<menu ref="reports"/>
</body>
</project>

View File

@ -932,6 +932,7 @@
<module>pmd-jsp</module>
<module>pmd-matlab</module>
<module>pmd-objectivec</module>
<module>pmd-perl</module>
<module>pmd-php</module>
<module>pmd-plsql</module>
<module>pmd-python</module>