Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added CheckStyle rule enforcing indentation guides #297

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,17 @@
<!-- Report on each line in each file -->
<property name="eachLine" value="true"/>
</module>


<module name="TreeWalker">
<!-- Checks that the indentation style in this project is uniformly "2 spaces". -->
<module name="Indentation">
<property name="basicOffset" value="2"/>
<property name="braceAdjustment" value="0"/>
<property name="caseIndent" value="2"/>
<property name="throwsIndent" value="4"/>
<property name="lineWrappingIndentation" value="4"/>
<property name="arrayInitIndent" value="2"/>
</module>
</module>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
*/
public class EasyMock2Matchers {

public static String equalTo(String string) {
EasyMock2Adapter.adapt(IsEqual.equalTo(string));
return null;
}
public static String equalTo(String string) {
EasyMock2Adapter.adapt(IsEqual.equalTo(string));
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class JMock1Matchers {

public static Constraint equalTo(String string) {
return JMock1Adapter.adapt(IsEqual.equalTo(string));
}
public static Constraint equalTo(String string) {
return JMock1Adapter.adapt(IsEqual.equalTo(string));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
* @author Neil Dunn
*/
public class JavaLangMatcherAssert {
private JavaLangMatcherAssert() {};
private JavaLangMatcherAssert() {
}

public static <T> boolean that(T argument, Matcher<? super T> matcher) {
return matcher.matches(argument);
}
;

public static <T> boolean that(T argument, Matcher<? super T> matcher) {
return matcher.matches(argument);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@
*/
public class EasyMock2Adapter implements IArgumentMatcher {

/**
* Convenience factory method that will adapt a
* Hamcrest {@link org.hamcrest.Matcher} to act as an
* EasyMock {@link org.easymock.IArgumentMatcher} and
* report it to EasyMock so it can be kept track of.
*/
public static IArgumentMatcher adapt(Matcher<?> matcher) {
EasyMock2Adapter easyMock2Matcher = new EasyMock2Adapter(matcher);
EasyMock.reportMatcher(easyMock2Matcher);
return easyMock2Matcher;
}
/**
* Convenience factory method that will adapt a
* Hamcrest {@link org.hamcrest.Matcher} to act as an
* EasyMock {@link org.easymock.IArgumentMatcher} and
* report it to EasyMock so it can be kept track of.
*/
public static IArgumentMatcher adapt(Matcher<?> matcher) {
EasyMock2Adapter easyMock2Matcher = new EasyMock2Adapter(matcher);
EasyMock.reportMatcher(easyMock2Matcher);
return easyMock2Matcher;
}

private final Matcher<?> hamcrestMatcher;
private final Matcher<?> hamcrestMatcher;

public EasyMock2Adapter(Matcher<?> matcher) {
this.hamcrestMatcher = matcher;
}
public EasyMock2Adapter(Matcher<?> matcher) {
this.hamcrestMatcher = matcher;
}

@Override
public boolean matches(Object argument) {
return hamcrestMatcher.matches(argument);
}
@Override
public boolean matches(Object argument) {
return hamcrestMatcher.matches(argument);
}

@Override
public void appendTo(StringBuffer buffer) {
hamcrestMatcher.describeTo(new StringDescription(buffer));
}
@Override
public void appendTo(StringBuffer buffer) {
hamcrestMatcher.describeTo(new StringDescription(buffer));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,29 @@
*/
public class JMock1Adapter implements Constraint {

/**
* Convenience factory method that will adapt a
* Hamcrest {@link org.hamcrest.Matcher} to act as an
* jMock {@link org.jmock.core.Constraint}.
*/
public static Constraint adapt(Matcher<?> matcher) {
return new JMock1Adapter(matcher);
}
/**
* Convenience factory method that will adapt a
* Hamcrest {@link org.hamcrest.Matcher} to act as an
* jMock {@link org.jmock.core.Constraint}.
*/
public static Constraint adapt(Matcher<?> matcher) {
return new JMock1Adapter(matcher);
}

private final Matcher<?> hamcrestMatcher;
private final Matcher<?> hamcrestMatcher;

public JMock1Adapter(Matcher<?> matcher) {
this.hamcrestMatcher = matcher;
}
public JMock1Adapter(Matcher<?> matcher) {
this.hamcrestMatcher = matcher;
}

@Override
public boolean eval(Object o) {
return hamcrestMatcher.matches(o);
}
@Override
public boolean eval(Object o) {
return hamcrestMatcher.matches(o);
}

@Override
public StringBuffer describeTo(StringBuffer buffer) {
hamcrestMatcher.describeTo(new StringDescription(buffer));
return buffer;
}
@Override
public StringBuffer describeTo(StringBuffer buffer) {
hamcrestMatcher.describeTo(new StringDescription(buffer));
return buffer;
}
}
Loading