Skip to content

Commit

Permalink
Checkstyles ignores long lines if they have a URL
Browse files Browse the repository at this point in the history
  • Loading branch information
JimDeanSpivey committed Jan 28, 2016
1 parent aa16bc4 commit 231d4a1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
</module>
<module name="LineLength">
<property name="max" value="80"/>
<property name="ignorePattern" value="^import .*$"/>
<property name="ignorePattern" value="^import .*$|https?://[\w\d-]+\.[\w\d]+"/>
</module>
<module name="AnonInnerLength" />
<module name="MethodLength"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,18 @@ public void distinguishesValidCatchParameterNames() throws Exception {
);
}

/**
* Test if URLs are valid despite having a line length over 80.
* @throws Exception In case of error
*/
@Test
public void doesNotRejectUrlsInLongLines() throws Exception {
this.validateCheckstyle(
"UrlInLongLine.java", true,
Matchers.containsString(CheckstyleValidatorTest.NO_VIOLATIONS)
);
}

/**
* Convert file name to URL.
* @param file The file
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Hello.
*/
package foo.bar;

/**
* Very long lines.
* https://very-long.net/thisUrlIsVeryLong?AndItHasQueryParams=1&url%2encoding#withHashTags
* @author John Smith (john@example.com)
* @version $Id$
* @since 1.0
*/
public interface UrlInLongLine {
}

0 comments on commit 231d4a1

Please sign in to comment.