Skip to content

Commit

Permalink
Rename Spring checks
Browse files Browse the repository at this point in the history
Rename all check implementations to start with Spring. This should
help prevent clashes with any other third-party checks.

Closes spring-iogh-41
  • Loading branch information
philwebb committed Jun 19, 2018
1 parent 95e4b8e commit 779881a
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import com.puppycrawl.tools.checkstyle.api.FileText;
import com.puppycrawl.tools.checkstyle.api.LocalizedMessage;
import com.puppycrawl.tools.checkstyle.filters.SuppressElement;
import io.spring.javaformat.checkstyle.check.HeaderCheck;
import io.spring.javaformat.checkstyle.check.SpringHeaderCheck;

/**
* {@link FileSetCheck} that applies Spring checkstype rules.
Expand All @@ -60,9 +60,9 @@ public class SpringChecks extends AbstractFileSetCheck implements ExternalResour

private boolean debug;

private String headerType = HeaderCheck.DEFAULT_HEADER_TYPE;
private String headerType = SpringHeaderCheck.DEFAULT_HEADER_TYPE;

private String headerCopyrightPattern = HeaderCheck.DEFAULT_HEADER_COPYRIGHT_PATTERN;
private String headerCopyrightPattern = SpringHeaderCheck.DEFAULT_HEADER_COPYRIGHT_PATTERN;

/**
* Sets tab width.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @author Phillip Webb
*/
public class CatchCheck extends AbstractCheck {
public class SpringCatchCheck extends AbstractCheck {

@Override
public int[] getDefaultTokens() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*
* @author Phillip Webb
*/
public class HeaderCheck extends AbstractFileSetCheck {
public class SpringHeaderCheck extends AbstractFileSetCheck {

private static final String UNCHECKED = "unchecked";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
* @author Phillip Webb
*/
public class JavadocCheck extends AbstractCheck {
public class SpringJavadocCheck extends AbstractCheck {

private static final Pattern[] PATTERNS = {
CommonUtils.createPattern("@param\\s+\\S+\\s+(.*)"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*
* @author Phillip Webb
*/
public class LambdaCheck extends AbstractCheck {
public class SpringLambdaCheck extends AbstractCheck {

@Override
public int[] getDefaultTokens() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*
* @author Phillip Webb
*/
public class TernaryCheck extends AbstractCheck {
public class SpringTernaryCheck extends AbstractCheck {

@Override
public int[] getDefaultTokens() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="com.puppycrawl.tools.checkstyle.Checker">
<!-- Root Checks -->
<module name="io.spring.javaformat.checkstyle.check.HeaderCheck">
<module name="io.spring.javaformat.checkstyle.check.SpringHeaderCheck">
<property name="fileExtensions" value="java" />
<property name="headerType" value="${headerType}"/>
<property name="headerCopyrightPattern" value="${headerCopyrightPattern}"/>
Expand Down Expand Up @@ -164,9 +164,9 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck" />

<!-- Spring Conventions -->
<module name="io.spring.javaformat.checkstyle.check.LambdaCheck" />
<module name="io.spring.javaformat.checkstyle.check.TernaryCheck" />
<module name="io.spring.javaformat.checkstyle.check.CatchCheck" />
<module name="io.spring.javaformat.checkstyle.check.JavadocCheck" />
<module name="io.spring.javaformat.checkstyle.check.SpringLambdaCheck" />
<module name="io.spring.javaformat.checkstyle.check.SpringTernaryCheck" />
<module name="io.spring.javaformat.checkstyle.check.SpringCatchCheck" />
<module name="io.spring.javaformat.checkstyle.check.SpringJavadocCheck" />
</module>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.puppycrawl.tools.checkstyle.PropertiesExpander;
import com.puppycrawl.tools.checkstyle.PropertyResolver;
import com.puppycrawl.tools.checkstyle.api.FileSetCheck;
import io.spring.javaformat.checkstyle.check.HeaderCheck;
import io.spring.javaformat.checkstyle.check.SpringHeaderCheck;
import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -51,9 +51,9 @@ public void loadShouldLoadChecks() {

private PropertyResolver getPropertyResolver() {
Properties properties = new Properties();
properties.put("headerType", HeaderCheck.DEFAULT_HEADER_TYPE);
properties.put("headerType", SpringHeaderCheck.DEFAULT_HEADER_TYPE);
properties.put("headerCopyrightPattern",
HeaderCheck.DEFAULT_HEADER_COPYRIGHT_PATTERN);
SpringHeaderCheck.DEFAULT_HEADER_COPYRIGHT_PATTERN);
return new PropertiesExpander(properties);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
+HeaderDate.java:2: header.mismatch [Header]
+HeaderDate.java:2: header.mismatch [SpringHeader]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
+HeaderMismatch.java:5: header.mismatch [Header]
+HeaderMismatch.java:5: header.mismatch [SpringHeader]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
+HeaderTooLong.java:15: header.mismatch [Header]
+HeaderTooLong.java:15: header.mismatch [SpringHeader]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
+HeaderTooShort.java:14: header.mismatch [Header]
+HeaderTooShort.java:14: header.mismatch [SpringHeader]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
+JavadocBadCase.java:20:15: Javadoc element descriptions should not start with an uppercase letter [Javadoc]
+JavadocBadCase.java:27:29: Javadoc element descriptions should not start with an uppercase letter [Javadoc]
+JavadocBadCase.java:28:20: Javadoc element descriptions should not start with an uppercase letter [Javadoc]
+JavadocBadCase.java:29:37: Javadoc element descriptions should not start with an uppercase letter [Javadoc]
+JavadocBadCase.java:20:15: Javadoc element descriptions should not start with an uppercase letter [SpringJavadoc]
+JavadocBadCase.java:27:29: Javadoc element descriptions should not start with an uppercase letter [SpringJavadoc]
+JavadocBadCase.java:28:20: Javadoc element descriptions should not start with an uppercase letter [SpringJavadoc]
+JavadocBadCase.java:29:37: Javadoc element descriptions should not start with an uppercase letter [SpringJavadoc]
+4 errors
Original file line number Diff line number Diff line change
@@ -1 +1 @@
+Lambda argument missing parentheses [Lambda]
+Lambda argument missing parentheses [SpringLambda]

0 comments on commit 779881a

Please sign in to comment.