Skip to content

Commit

Permalink
Checkstyle:
Browse files Browse the repository at this point in the history
1) wired checkstyle into the build (for verify)
2) suppressed all modules except fcrepo-audit, for the time being
3) modified trailing whitespace rule to allow trailing whitespace on lines with only a "*" (e.g. javadoc lines)

Eclipse code formatting cleanup:
1) fedora-formatter.xml incorrectly specified tabs instead of spaces
2) added fedora.importorder
  • Loading branch information
Edwin Shin committed Jun 25, 2013
1 parent 9beffae commit 9f0074a
Show file tree
Hide file tree
Showing 23 changed files with 75 additions and 135 deletions.
13 changes: 13 additions & 0 deletions checkstyle-suppressions.xml
Expand Up @@ -3,4 +3,17 @@
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress files="[\\/]fcrepo-generator-dc[\\/]" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]fcrepo-generator-rdf[\\/]" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]fcrepo-http-api[\\/]" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]fcrepo-http-commons[\\/]" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]fcrepo-jcr[\\/]" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]fcrepo-jms[\\/]" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]fcrepo-kernel[\\/]" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]fcrepo-metrics[\\/]" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]fcrepo-rss[\\/]" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]fcrepo-serialization[\\/]" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]fcrepo-storage-policy[\\/]" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]fcrepo-webapp[\\/]" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]fcrepo-webhooks[\\/]" checks="[a-zA-Z0-9]*"/>
</suppressions>
22 changes: 8 additions & 14 deletions checkstyle.xml
Expand Up @@ -30,12 +30,14 @@
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<!-- Licence Header -->
<!-- License Header -->
<!-- disabled in favor of license-maven-plugin
<module name="RegexpHeader">
<property name="header"
value="^/\*\*\n \* The contents of this file are subject to the license and copyright terms$\n^ \* detailed in the license directory at the root of the source tree \(also$\n^ \* available online at http://fedora-commons.org/license/\).$\n^ \*/"
/>
</module>
-->
<module name="TreeWalker">
<!-- Checks for redundant import statements -->
<module name="RedundantImport"/>
Expand Down Expand Up @@ -68,13 +70,6 @@
<property name="allowMissingThrowsTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
</module>
<module name="WriteTag">
<property name="id" value="dateTag"/>
<property name="tag" value="@date"/>
<property name="tagFormat" value="[A-Z][a-z]{2} \d{1,2}, \d{4}"/>
<property name="severity" value="error"/>
<property name="tagSeverity" value="ignore"/>
</module>
<!-- K&R style braces -->
<module name="NeedBraces"/>
<module name="LeftCurly"/>
Expand All @@ -85,11 +80,10 @@
/>
</module>
<module name="Indentation"/>
<!-- Trailing Whitespace -->
<module name="Regexp">
<property name="format" value="[ \t]+$"/>
<property name="illegalPattern" value="true"/>
<property name="message" value="Trailing whitespace"/>
</module>
</module>
<!-- No Trailing Whitespace, except on lines that only have an asterisk (e.g. Javadoc comments) -->
<module name="RegexpSingleline">
<property name="format" value="(?&lt;!\*)\s+$|\*\s\s+$"/>
<property name="message" value="Trailing whitespace"/>
</module>
</module>
6 changes: 0 additions & 6 deletions fcrepo-audit/checkstyle-suppressions.xml

This file was deleted.

7 changes: 3 additions & 4 deletions fcrepo-audit/src/main/java/org/fcrepo/audit/Auditor.java
Expand Up @@ -14,10 +14,9 @@
public interface Auditor {

/**
*
* @param e The {@Event} to record.
*
* @throws RepositoryException
* @param e
* The {@Event} to record.
* @throws RepositoryException
*/
@Subscribe
void recordEvent(final Event e) throws RepositoryException;
Expand Down
Expand Up @@ -12,7 +12,6 @@
import org.slf4j.LoggerFactory;

import com.google.common.eventbus.EventBus;

import com.google.common.eventbus.Subscribe;

/**
Expand All @@ -30,6 +29,9 @@ public class LogbackAuditor implements Auditor {
@Inject
private EventBus eventBus;

/**
* Register with the EventBus to receive events.
*/
@PostConstruct
public void register() {
logger.debug("Initializing: " + this.getClass().getCanonicalName());
Expand Down
6 changes: 0 additions & 6 deletions fcrepo-generator-dc/checkstyle-suppressions.xml

This file was deleted.

6 changes: 0 additions & 6 deletions fcrepo-generator-rdf/checkstyle-suppressions.xml

This file was deleted.

6 changes: 0 additions & 6 deletions fcrepo-http-api/checkstyle-suppressions.xml

This file was deleted.

6 changes: 0 additions & 6 deletions fcrepo-http-commons/checkstyle-suppressions.xml

This file was deleted.

6 changes: 0 additions & 6 deletions fcrepo-jcr/checkstyle-suppressions.xml

This file was deleted.

6 changes: 0 additions & 6 deletions fcrepo-jms/checkstyle-suppressions.xml

This file was deleted.

8 changes: 0 additions & 8 deletions fcrepo-kernel/checkstyle-suppressions.xml

This file was deleted.

6 changes: 0 additions & 6 deletions fcrepo-legacy-api/checkstyle-suppressions.xml

This file was deleted.

6 changes: 0 additions & 6 deletions fcrepo-metrics/checkstyle-suppressions.xml

This file was deleted.

6 changes: 0 additions & 6 deletions fcrepo-rss/checkstyle-suppressions.xml

This file was deleted.

6 changes: 0 additions & 6 deletions fcrepo-serialization/checkstyle-suppressions.xml

This file was deleted.

6 changes: 0 additions & 6 deletions fcrepo-storage-policy/checkstyle-suppressions.xml

This file was deleted.

6 changes: 0 additions & 6 deletions fcrepo-webapp/checkstyle-suppressions.xml

This file was deleted.

6 changes: 0 additions & 6 deletions fcrepo-webhooks/checkstyle-suppressions.xml

This file was deleted.

37 changes: 37 additions & 0 deletions pom.xml
Expand Up @@ -41,6 +41,9 @@
<!-- https://github.com/github/maven-plugins/blob/master/README.md -->
<github.global.server>github</github.global.server>
<powermock.version>1.5.1</powermock.version>

<!-- plugin versions -->
<checkstyle.version>2.10</checkstyle.version>
</properties>

<modules>
Expand Down Expand Up @@ -481,6 +484,22 @@
<version>2.4.0</version>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.version}</version>
<configuration>
<consoleOutput>true</consoleOutput>
<configLocation>checkstyle.xml</configLocation>
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
Expand Down Expand Up @@ -628,6 +647,11 @@
<artifactId>maven-enunciate-cxf-plugin</artifactId>
<version>1.26.2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>1.5</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
Expand Down Expand Up @@ -777,6 +801,10 @@
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
Expand Down Expand Up @@ -828,6 +856,10 @@
<jacoco-agent.destFile>${project.basedir}/target/jacoco-it.exec</jacoco-agent.destFile>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
Expand All @@ -837,6 +869,11 @@

<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.version}</version>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.15</version>
Expand Down
19 changes: 0 additions & 19 deletions src/site/eclipse/fedora-codetemplates.xml
@@ -1,22 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="settercomment_context" deleted="false" description="Comment for setter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment">/**
* @param ${param} the ${bare_field_name} to set
*/</template><template autoinsert="true" context="delegatecomment_context" deleted="false" description="Comment for delegate methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name="delegatecomment">/**
* ${tags}
* ${see_to_target}
*/</template><template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment">/**
* @author Gregory Jansen
*
* ${tags}
*/</template><template autoinsert="true" context="filecomment_context" deleted="false" description="Comment for created Java files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/**
*
*/</template><template autoinsert="true" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name="constructorcomment">/**
* ${tags}
*/</template><template autoinsert="true" context="methodcomment_context" deleted="false" description="Comment for non-overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name="methodcomment">/**
* ${tags}
*/</template><template autoinsert="true" context="gettercomment_context" deleted="false" description="Comment for getter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment">/**
* @return the ${bare_field_name}
*/</template><template autoinsert="true" context="fieldcomment_context" deleted="false" description="Comment for fields" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name="fieldcomment">/**
*
*/</template><template autoinsert="true" context="overridecomment_context" deleted="false" description="Comment for overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment">/* (non-Javadoc)
* ${see_to_overridden}
*/</template></templates>
10 changes: 5 additions & 5 deletions src/site/eclipse/fedora-formatter.xml
Expand Up @@ -51,7 +51,7 @@
<setting id="org.eclipse.jdt.core.compiler.source" value="1.7"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
Expand Down Expand Up @@ -89,7 +89,7 @@
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="16"/>
<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
Expand Down Expand Up @@ -204,7 +204,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
Expand All @@ -221,7 +221,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="17"/>
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
Expand Down Expand Up @@ -252,7 +252,7 @@
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
Expand Down
6 changes: 6 additions & 0 deletions src/site/eclipse/fedora.importorder
@@ -0,0 +1,6 @@
#Organize Import Order
#Tue Jun 25 19:58:10 SGT 2013
3=com
2=org
1=javax
0=java

0 comments on commit 9f0074a

Please sign in to comment.