Author: nicolas Date: Fri May 15 07:36:54 2009 New Revision: 775049 URL: http://svn.apache.org/viewvc?rev=775049&view=rev Log: MCHECKSTYLE-105 + MCHECKSTYLE-101
Modified: maven/plugins/trunk/maven-checkstyle-plugin/pom.xml maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportGenerator.java maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/avalon_checks.xml maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven_checks.xml maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/sun_checks.xml maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/turbine_checks.xml maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugin/checkstyle/CheckstyleReportListenerTest.java maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugin/checkstyle/CheckstyleResultsTest.java Modified: maven/plugins/trunk/maven-checkstyle-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/pom.xml?rev=775049&r1=775048&r2=775049&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/pom.xml (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/pom.xml Fri May 15 07:36:54 2009 @@ -127,12 +127,7 @@ <dependency> <groupId>checkstyle</groupId> <artifactId>checkstyle</artifactId> - <version>4.4</version> - </dependency> - <dependency> - <groupId>checkstyle</groupId> - <artifactId>checkstyle-optional</artifactId> - <version>4.4</version> + <version>5.0</version> </dependency> <dependency> <groupId>org.apache.maven.shared</groupId> Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java?rev=775049&r1=775048&r2=775049&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java Fri May 15 07:36:54 2009 @@ -19,20 +19,27 @@ * under the License. */ -import com.puppycrawl.tools.checkstyle.Checker; -import com.puppycrawl.tools.checkstyle.ConfigurationLoader; -import com.puppycrawl.tools.checkstyle.DefaultConfiguration; -import com.puppycrawl.tools.checkstyle.DefaultLogger; -import com.puppycrawl.tools.checkstyle.ModuleFactory; -import com.puppycrawl.tools.checkstyle.PackageNamesLoader; -import com.puppycrawl.tools.checkstyle.PropertiesExpander; -import com.puppycrawl.tools.checkstyle.XMLLogger; -import com.puppycrawl.tools.checkstyle.api.AuditListener; -import com.puppycrawl.tools.checkstyle.api.CheckstyleException; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.api.FilterSet; -import com.puppycrawl.tools.checkstyle.api.SeverityLevel; -import com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Properties; +import java.util.ResourceBundle; + import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.doxia.tools.SiteTool; import org.apache.maven.model.ReportPlugin; @@ -45,35 +52,31 @@ import org.apache.velocity.exception.ResourceNotFoundException; import org.apache.velocity.exception.VelocityException; import org.codehaus.doxia.site.renderer.SiteRenderer; +import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.ServiceLocator; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.Serviceable; import org.codehaus.plexus.resource.ResourceManager; import org.codehaus.plexus.resource.loader.FileResourceCreationException; import org.codehaus.plexus.resource.loader.FileResourceLoader; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.PathTool; import org.codehaus.plexus.util.StringInputStream; -import org.codehaus.plexus.util.StringOutputStream; import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.velocity.VelocityComponent; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Properties; -import java.util.ResourceBundle; +import com.puppycrawl.tools.checkstyle.Checker; +import com.puppycrawl.tools.checkstyle.ConfigurationLoader; +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.DefaultLogger; +import com.puppycrawl.tools.checkstyle.PackageNamesLoader; +import com.puppycrawl.tools.checkstyle.PropertiesExpander; +import com.puppycrawl.tools.checkstyle.XMLLogger; +import com.puppycrawl.tools.checkstyle.api.AuditListener; +import com.puppycrawl.tools.checkstyle.api.CheckstyleException; +import com.puppycrawl.tools.checkstyle.api.Configuration; +import com.puppycrawl.tools.checkstyle.api.FilterSet; +import com.puppycrawl.tools.checkstyle.api.SeverityLevel; +import com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader; /** * Perform a Checkstyle analysis, and generate a report on violations. @@ -86,6 +89,7 @@ */ public class CheckstyleReport extends AbstractMavenReport + implements Serviceable { private static final String PLUGIN_RESOURCES = "org/apache/maven/plugin/checkstyle"; @@ -485,7 +489,7 @@ * The file encoding to use when reading the source files. If the property <code>project.build.sourceEncoding</code> * is not set, the platform default encoding is used. <strong>Note:</strong> This parameter always overrides the * property <code>charset</code> from Checkstyle's <code>TreeWalker</code> module. - * + * * @parameter expression="${encoding}" default-value="${project.build.sourceEncoding}" * @since 2.2 */ @@ -500,15 +504,28 @@ /** * Velocity Component. - * - * @component role="org.codehaus.plexus.velocity.VelocityComponent" - * @required */ + // Not declared as @component to fix MCHECKSTYLE-101 private VelocityComponent velocityComponent; + /** + * ServiceLocator used to lookup VelocityComponent + */ + private ServiceLocator serviceLocator; + + /** + * {...@inheritdoc} + * + * @see org.codehaus.plexus.personality.plexus.lifecycle.phase.Serviceable#service(org.codehaus.plexus.personality.plexus.lifecycle.phase.ServiceLocator) + */ + public void service( ServiceLocator locator ) + { + this.serviceLocator = locator; + } + private static final File[] EMPTY_FILE_ARRAY = new File[0]; - private StringOutputStream stringOutputStream; + private ByteArrayOutputStream stringOutputStream; /** * @component @@ -598,12 +615,9 @@ String configFile = getConfigFile(); Properties overridingProperties = getOverridingProperties(); - ModuleFactory moduleFactory; Configuration config; CheckstyleResults results; - moduleFactory = getModuleFactory(); - config = ConfigurationLoader.loadConfiguration( configFile, new PropertiesExpander( overridingProperties ) ); String effectiveEncoding = @@ -618,8 +632,8 @@ for ( int i = 0; i < modules.length; i++ ) { Configuration module = modules[i]; - if ( "TreeWalker".equals( module.getName() ) - || "com.puppycrawl.tools.checkstyle.TreeWalker".equals( module.getName() ) ) + if ( "Checker".equals( module.getName() ) + || "com.puppycrawl.tools.checkstyle.Checker".equals( module.getName() ) ) { if ( module instanceof DefaultConfiguration ) { @@ -630,13 +644,25 @@ getLog().warn( "Failed to configure file encoding on module " + module ); } } + if ("TreeWalker".equals(module.getName()) + || "com.puppycrawl.tools.checkstyle.TreeWalker".equals(module.getName())) + { + if (module instanceof DefaultConfiguration) + { + ((DefaultConfiguration) module).addAttribute("cacheFile", cacheFile); + } + else + { + getLog().warn("Failed to configure cache file on module " + module); + } + } } - results = executeCheckstyle( config, moduleFactory ); + results = executeCheckstyle( config ); ResourceBundle bundle = getBundle( locale ); generateReportStatics(); - generateMainReport( results, config, moduleFactory, bundle ); + generateMainReport( results, config, bundle ); if ( enableRSS ) { generateRSS( results ); @@ -672,6 +698,18 @@ private void generateRSS( CheckstyleResults results ) throws MavenReportException { + if ( velocityComponent == null ) + { + try + { + velocityComponent = (VelocityComponent) serviceLocator.lookup( VelocityComponent.ROLE ); + } + catch ( ComponentLookupException e ) + { + throw new MavenReportException( "Failed to setup Velocity", e ); + } + } + VelocityTemplate vtemplate = new VelocityTemplate( velocityComponent, PLUGIN_RESOURCES ); vtemplate.setLog( getLog() ); @@ -727,8 +765,7 @@ return copyright; } - private void generateMainReport( CheckstyleResults results, Configuration config, ModuleFactory moduleFactory, - ResourceBundle bundle ) + private void generateMainReport( CheckstyleResults results, Configuration config, ResourceBundle bundle ) { CheckstyleReportGenerator generator = new CheckstyleReportGenerator( getSink(), bundle, project.getBasedir(), siteTool ); @@ -738,7 +775,6 @@ generator.setEnableFilesSummary( enableFilesSummary ); generator.setEnableRSS( enableRSS ); generator.setCheckstyleConfig( config ); - generator.setCheckstyleModuleFactory( moduleFactory ); if ( linkXRef ) { String relativePath = PathTool.getRelativePath( getOutputDirectory(), xrefLocation.getAbsolutePath() ); @@ -821,7 +857,7 @@ } } - private CheckstyleResults executeCheckstyle( Configuration config, ModuleFactory moduleFactory ) + private CheckstyleResults executeCheckstyle( Configuration config ) throws MavenReportException, CheckstyleException { File[] files; @@ -905,10 +941,7 @@ URLClassLoader projectClassLoader = new URLClassLoader( (URL[]) urls.toArray( new URL[urls.size()] ), null ); checker.setClassloader( projectClassLoader ); - if ( moduleFactory != null ) - { - checker.setModuleFactory( moduleFactory ); - } + checker.setModuleClassLoader( Thread.currentThread().getContextClassLoader() ); if ( filterSet != null ) { @@ -938,7 +971,11 @@ checker.addListener( sinkListener ); - int nbErrors = checker.process( files ); + ArrayList filesList = new ArrayList(); + for (int i = 0; i < files.length; i++) { + filesList.add(files[i]); + } + int nbErrors = checker.process( filesList ); checker.destroy(); @@ -1150,31 +1187,6 @@ } - private ModuleFactory getModuleFactory() - throws CheckstyleException - { - // default to internal module factory. - ModuleFactory moduleFactory = PackageNamesLoader.loadModuleFactory( Thread.currentThread() - .getContextClassLoader() ); - - try - { - // attempt to locate any specified package file. - File packageNamesFile = locator.resolveLocation( packageNamesLocation, "checkstyle-packages.xml" ); - - if ( packageNamesFile != null ) - { - // load resolved location. - moduleFactory = PackageNamesLoader.loadModuleFactory( packageNamesFile.getAbsolutePath() ); - } - } - catch ( IOException e ) - { - getLog().error( "Unable to process package names location: " + packageNamesLocation, e ); - } - return moduleFactory; - } - private String getSuppressionLocation() throws MavenReportException { @@ -1226,13 +1238,12 @@ if ( useFile == null ) { - stringOutputStream = new StringOutputStream(); + stringOutputStream = new ByteArrayOutputStream(); consoleListener = new DefaultLogger( stringOutputStream, false ); } else { OutputStream out = getOutputStream( useFile ); - consoleListener = new DefaultLogger( out, true ); } Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportGenerator.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportGenerator.java?rev=775049&r1=775048&r2=775049&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportGenerator.java (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportGenerator.java Fri May 15 07:36:54 2009 @@ -19,7 +19,7 @@ * under the License. */ -import com.puppycrawl.tools.checkstyle.ModuleFactory; +import com.puppycrawl.tools.checkstyle.Checker; import com.puppycrawl.tools.checkstyle.api.AuditEvent; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.Configuration; @@ -55,8 +55,6 @@ private Configuration checkstyleConfig; - private ModuleFactory checkstyleModuleFactory; - private boolean enableRulesSummary; private boolean enableSeveritySummary; @@ -68,7 +66,7 @@ private SiteTool siteTool; private String xrefLocation; - + public CheckstyleReportGenerator( Sink sink, ResourceBundle bundle, File basedir, SiteTool siteTool ) { this.bundle = bundle; @@ -520,17 +518,6 @@ private String countRuleViolation( Iterator files, String ruleName, String message, String severity ) { long count = 0; - String sourceName; - - try - { - sourceName = checkstyleModuleFactory.createModule( ruleName ).getClass().getName(); - } - catch ( CheckstyleException e ) - { - getLog().error( "Unable to obtain Source Name for Rule '" + ruleName + "'.", e ); - return "(report failure)"; - } while ( files.hasNext() ) { @@ -540,7 +527,10 @@ { AuditEvent event = (AuditEvent) error.next(); - if ( event.getSourceName().equals( sourceName ) ) + String eventSrcName = event.getSourceName(); + if ( eventSrcName != null + && ( eventSrcName.endsWith( ruleName ) + || eventSrcName.endsWith( ruleName + "Check" ) ) ) { // check message too, for those that have a specific one. // like GenericIllegalRegexp and Regexp @@ -574,7 +564,6 @@ } } } - return String.valueOf( count ); } @@ -879,13 +868,4 @@ this.checkstyleConfig = config; } - public ModuleFactory getCheckstyleModuleFactory() - { - return checkstyleModuleFactory; - } - - public void setCheckstyleModuleFactory( ModuleFactory checkstyleModuleFactory ) - { - this.checkstyleModuleFactory = checkstyleModuleFactory; - } } Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/avalon_checks.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/avalon_checks.xml?rev=775049&r1=775048&r2=775049&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/avalon_checks.xml (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/avalon_checks.xml Fri May 15 07:36:54 2009 @@ -52,8 +52,10 @@ <module name="Checker"> <!-- Checks that a package.html file exists for each package. --> - <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml --> - <module name="PackageHtml"/> + <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage --> + <module name="JavadocPackage"> + <property name="allowLegacy" value="false"/> + </module> <!-- Checks whether files end with a new line. --> <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> @@ -63,6 +65,21 @@ <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> <module name="Translation"/> + <module name="FileLength"/> + + <!-- Following interprets the header file as regular expressions. --> + <!-- <module name="RegexpHeader"/> --> + + <module name="FileTabCharacter"> + <property name="eachLine" value="true"/> + </module> + + <module name="RegexpSingleline"> + <!-- \s matches whitespace character, $ matches end of line. --> + <property name="format" value="\s+$"/> + <property name="message" value="Line has trailing spaces."/> + </module> + <module name="TreeWalker"> <property name="cacheFile" value="${checkstyle.cache.file}"/> @@ -122,10 +139,6 @@ <property name="headerFile" value="${checkstyle.header.file}"/> </module> - <!-- Following interprets the header file as regular expressions. --> - <!-- <module name="RegexpHeader"/> --> - - <!-- Checks for imports --> <!-- See http://checkstyle.sf.net/config_import.html --> <module name="AvoidStarImport"/> @@ -136,7 +149,6 @@ <!-- Checks for Size Violations. --> <!-- See http://checkstyle.sf.net/config_sizes.html --> - <module name="FileLength"/> <module name="LineLength"/> <module name="MethodLength"/> <module name="ParameterNumber"/> @@ -149,7 +161,6 @@ <module name="NoWhitespaceBefore"/> <module name="OperatorWrap"/> <module name="ParenPad"/> - <module name="TabCharacter"/> <module name="WhitespaceAfter"/> <module name="WhitespaceAround"/> @@ -196,10 +207,6 @@ <!-- See http://checkstyle.sf.net/config_misc.html --> <module name="ArrayTypeStyle"/> <module name="FinalParameters"/> - <module name="GenericIllegalRegexp"> - <property name="format" value="\s+$"/> - <property name="message" value="Line has trailing spaces."/> - </module> <module name="TodoComment"/> <module name="UpperEll"/> Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven_checks.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven_checks.xml?rev=775049&r1=775048&r2=775049&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven_checks.xml (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven_checks.xml Fri May 15 07:36:54 2009 @@ -29,8 +29,10 @@ <module name="Checker"> <!-- Checks that a package.html file exists for each package. --> - <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml --> - <!-- module name="PackageHtml"/ --> + <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage --> + <module name="JavadocPackage"> + <property name="allowLegacy" value="false"/> + </module> <!-- Checks whether files end with a new line. --> <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> @@ -40,6 +42,24 @@ <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> <!-- module name="Translation"/ --> + <module name="FileLength"/> + + <!-- Checks for Headers --> + <!-- See http://checkstyle.sf.net/config_header.html --> + <module name="RegexpHeader"> + <property name="headerFile" value="${checkstyle.header.file}"/> + </module> + + <module name="FileTabCharacter"> + <property name="eachLine" value="true"/> + </module> + + <!-- Line with trailing spaces (disabled as it's too noisy) --> + <!--<module name="RegexpSingleline"> + <property name="format" value="\s+$"/> + <property name="message" value="Line has trailing spaces."/> + </module>--> + <module name="TreeWalker"> <property name="cacheFile" value="${checkstyle.cache.file}"/> @@ -83,13 +103,6 @@ <module name="StaticVariableName"/> <module name="TypeName"/> - - <!-- Checks for Headers --> - <!-- See http://checkstyle.sf.net/config_header.html --> - <module name="RegexpHeader"> - <property name="headerFile" value="${checkstyle.header.file}"/> - </module> - <!-- Checks for imports --> <!-- See http://checkstyle.sf.net/config_import.html --> <module name="AvoidStarImport"/> @@ -100,7 +113,6 @@ <!-- Checks for Size Violations. --> <!-- See http://checkstyle.sf.net/config_sizes.html --> - <module name="FileLength"/> <module name="MethodLength"/> <module name="ParameterNumber"/> @@ -116,7 +128,6 @@ <module name="ParenPad"> <property name="option" value="space" /> </module> - <module name="TabCharacter"/> <module name="WhitespaceAfter"/> <module name="WhitespaceAround"/> <!-- module name="MethodParamPad"/ --> @@ -173,12 +184,6 @@ <!-- See http://checkstyle.sf.net/config_misc.html --> <!-- module name="ArrayTypeStyle"/ --> <!-- module name="FinalParameters"/ --> - <!-- Line with Trailing Spaces (disabled as it's to noisy) - <module name="GenericIllegalRegexp"> - <property name="format" value="\s+$"/> - <property name="message" value="Line has trailing spaces."/> - </module> - --> <!-- Let todo plugin handle this. <module name="TodoComment"/> --> Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/sun_checks.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/sun_checks.xml?rev=775049&r1=775048&r2=775049&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/sun_checks.xml (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/sun_checks.xml Fri May 15 07:36:54 2009 @@ -1,23 +1,4 @@ <?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. ---> - <!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> @@ -50,10 +31,17 @@ --> <module name="Checker"> - - <!-- Checks that a package.html file exists for each package. --> - <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml --> - <module name="PackageHtml"/> + <!-- + If you set the basedir property below, then all reported file + names will be relative to the specified directory. See + http://checkstyle.sourceforge.net/5.x/config.html#Checker + + <property name="basedir" value="${basedir}"/> + --> + + <!-- Checks that a package-info.java file exists for each package. --> + <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage --> + <module name="JavadocPackage"/> <!-- Checks whether files end with a new line. --> <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> @@ -63,10 +51,22 @@ <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> <module name="Translation"/> + <module name="FileLength"/> - <module name="TreeWalker"> + <!-- Following interprets the header file as regular expressions. --> + <!-- <module name="RegexpHeader"/> --> - <property name="cacheFile" value="${checkstyle.cache.file}"/> + <module name="FileTabCharacter"> + <property name="eachLine" value="true"/> + </module> + + <module name="RegexpSingleline"> + <!-- \s matches whitespace character, $ matches end of line. --> + <property name="format" value="\s+$"/> + <property name="message" value="Line has trailing spaces."/> + </module> + + <module name="TreeWalker"> <!-- Checks for Javadoc comments. --> <!-- See http://checkstyle.sf.net/config_javadoc.html --> @@ -103,9 +103,6 @@ <!-- value="${basedir}/java.header"/> --> <!-- </module> --> - <!-- Following interprets the header file as regular expressions. --> - <!-- <module name="RegexpHeader"/> --> - <!-- Checks for imports --> <!-- See http://checkstyle.sf.net/config_import.html --> @@ -117,7 +114,6 @@ <!-- Checks for Size Violations. --> <!-- See http://checkstyle.sf.net/config_sizes.html --> - <module name="FileLength"/> <module name="LineLength"/> <module name="MethodLength"/> <module name="ParameterNumber"/> @@ -132,7 +128,6 @@ <module name="OperatorWrap"/> <module name="ParenPad"/> <module name="TypecastParenPad"/> - <module name="TabCharacter"/> <module name="WhitespaceAfter"/> <module name="WhitespaceAround"/> @@ -180,10 +175,6 @@ <!-- See http://checkstyle.sf.net/config_misc.html --> <module name="ArrayTypeStyle"/> <module name="FinalParameters"/> - <module name="GenericIllegalRegexp"> - <property name="format" value="\s+$"/> - <property name="message" value="Line has trailing spaces."/> - </module> <module name="TodoComment"/> <module name="UpperEll"/> Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/turbine_checks.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/turbine_checks.xml?rev=775049&r1=775048&r2=775049&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/turbine_checks.xml (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/turbine_checks.xml Fri May 15 07:36:54 2009 @@ -52,8 +52,10 @@ <module name="Checker"> <!-- Checks that a package.html file exists for each package. --> - <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml --> - <module name="PackageHtml"/> + <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage --> + <module name="JavadocPackage"> + <property name="allowLegacy" value="false"/> + </module> <!-- Checks whether files end with a new line. --> <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> @@ -63,6 +65,21 @@ <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> <module name="Translation"/> + <module name="FileLength"/> + + <!-- Following interprets the header file as regular expressions. --> + <!-- <module name="RegexpHeader"/> --> + + <module name="FileTabCharacter"> + <property name="eachLine" value="true"/> + </module> + + <module name="RegexpSingleline"> + <!-- \s matches whitespace character, $ matches end of line. --> + <property name="format" value="\s+$"/> + <property name="message" value="Line has trailing spaces."/> + </module> + <module name="TreeWalker"> <property name="cacheFile" value="${checkstyle.cache.file}"/> @@ -118,10 +135,6 @@ <property name="ignoreLines" value="1,6"/> </module> - <!-- Following interprets the header file as regular expressions. --> - <!-- <module name="RegexpHeader"/> --> - - <!-- Checks for imports --> <!-- See http://checkstyle.sf.net/config_import.html --> <module name="AvoidStarImport"/> @@ -132,7 +145,6 @@ <!-- Checks for Size Violations. --> <!-- See http://checkstyle.sf.net/config_sizes.html --> - <module name="FileLength"/> <module name="MethodLength"/> <module name="ParameterNumber"/> @@ -144,7 +156,6 @@ <module name="NoWhitespaceBefore"/> <module name="OperatorWrap"/> <module name="ParenPad"/> - <module name="TabCharacter"/> <module name="WhitespaceAfter"/> <module name="WhitespaceAround"/> @@ -191,10 +202,6 @@ <!-- See http://checkstyle.sf.net/config_misc.html --> <module name="ArrayTypeStyle"/> <module name="FinalParameters"/> - <module name="GenericIllegalRegexp"> - <property name="format" value="\s+$"/> - <property name="message" value="Line has trailing spaces."/> - </module> <module name="TodoComment"/> <module name="UpperEll"/> Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugin/checkstyle/CheckstyleReportListenerTest.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugin/checkstyle/CheckstyleReportListenerTest.java?rev=775049&r1=775048&r2=775049&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugin/checkstyle/CheckstyleReportListenerTest.java (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugin/checkstyle/CheckstyleReportListenerTest.java Fri May 15 07:36:54 2009 @@ -65,20 +65,20 @@ AuditEvent event = new AuditEvent( this, "/source/path/file1", null ); fireFileStarted( event ); - LocalizedMessage message = new LocalizedMessage( 0, 0, "", "", null, SeverityLevel.INFO, null, getClass() ); + LocalizedMessage message = new LocalizedMessage( 0, 0, "", "", null, SeverityLevel.INFO, null, getClass(), null ); fireAddError( new AuditEvent( this, "/source/path/file1", message ) ); fireFileFinished( event ); event = new AuditEvent( this, "/source/path/file2", null ); fireFileStarted( event ); - message = new LocalizedMessage( 0, 0, "", "", null, SeverityLevel.WARNING, null, getClass() ); + message = new LocalizedMessage( 0, 0, "", "", null, SeverityLevel.WARNING, null, getClass(), null ); fireAddError( new AuditEvent( this, "/source/path/file2", message ) ); fireAddError( new AuditEvent( this, "/source/path/file2", message ) ); fireFileFinished( event ); event = new AuditEvent( this, "/source/path/file3", null ); fireFileStarted( event ); - message = new LocalizedMessage( 0, 0, "", "", null, SeverityLevel.ERROR, null, getClass() ); + message = new LocalizedMessage( 0, 0, "", "", null, SeverityLevel.ERROR, null, getClass(), null ); fireAddError( new AuditEvent( this, "/source/path/file3", message ) ); fireAddError( new AuditEvent( this, "/source/path/file3", message ) ); fireAddError( new AuditEvent( this, "/source/path/file3", message ) ); @@ -86,7 +86,7 @@ event = new AuditEvent( this, "/source/path/file4", null ); fireFileStarted( event ); - message = new LocalizedMessage( 0, 0, "", "", null, SeverityLevel.IGNORE, null, getClass() ); + message = new LocalizedMessage( 0, 0, "", "", null, SeverityLevel.IGNORE, null, getClass(), null ); fireAddError( new AuditEvent( this, "/source/path/file4", message ) ); fireAddError( new AuditEvent( this, "/source/path/file4", message ) ); fireAddError( new AuditEvent( this, "/source/path/file4", message ) ); Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugin/checkstyle/CheckstyleResultsTest.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugin/checkstyle/CheckstyleResultsTest.java?rev=775049&r1=775048&r2=775049&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugin/checkstyle/CheckstyleResultsTest.java (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugin/checkstyle/CheckstyleResultsTest.java Fri May 15 07:36:54 2009 @@ -65,24 +65,24 @@ { Map files = new HashMap(); - LocalizedMessage message = new LocalizedMessage( 0, 0, "", "", null, SeverityLevel.INFO, null, getClass() ); + LocalizedMessage message = new LocalizedMessage( 0, 0, "", "", null, SeverityLevel.INFO, null, getClass(), null ); AuditEvent event = new AuditEvent( this, "file1", message ); files.put( "file1", Collections.singletonList( event ) ); - message = new LocalizedMessage( 0, 0, "", "", null, SeverityLevel.WARNING, null, getClass() ); + message = new LocalizedMessage( 0, 0, "", "", null, SeverityLevel.WARNING, null, getClass(), null ); List events = new ArrayList(); events.add( new AuditEvent( this, "file2", message ) ); events.add( new AuditEvent( this, "file2", message ) ); files.put( "file2", events ); - message = new LocalizedMessage( 0, 0, "", "", null, SeverityLevel.ERROR, null, getClass() ); + message = new LocalizedMessage( 0, 0, "", "", null, SeverityLevel.ERROR, null, getClass(), null ); events = new ArrayList(); events.add( new AuditEvent( this, "file3", message ) ); events.add( new AuditEvent( this, "file3", message ) ); events.add( new AuditEvent( this, "file3", message ) ); files.put( "file3", events ); - message = new LocalizedMessage( 0, 0, "", "", null, SeverityLevel.IGNORE, null, getClass() ); + message = new LocalizedMessage( 0, 0, "", "", null, SeverityLevel.IGNORE, null, getClass(), null ); events = new ArrayList(); events.add( new AuditEvent( this, "file4", message ) ); events.add( new AuditEvent( this, "file4", message ) );