Skip to content

Commit dab95f1

Browse files
committed
CheckStyle: configure SuppressWithNearbyCommentFilter to allow special comments before the line.
No code changes.
1 parent 275e4c5 commit dab95f1

File tree

12 files changed

+21
-18
lines changed

12 files changed

+21
-18
lines changed

src/main/config/checkstyle-suppressions.xml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55

66
<suppressions>
77

8-
<suppress checks="LineLength" files="AbstractPage.java" lines="44,45" />
9-
<suppress checks="LineLength" files="AbstractPageWithForm.java" lines="27,28,33" />
10-
<suppress checks="LineLength" files="Form.java" lines="31,32,37" />
11-
<suppress checks="LineLength" files="Url.java" lines="77,78,79" />
12-
<suppress checks="LineLength" files="ErrorController.java" lines="73" />
13-
<suppress checks="LineLength" files="SecurityConfig.java" lines="31,32,36" />
14-
<suppress checks="LineLength" files="JdbcSeriesDaoImpl.java" lines="123" />
15-
<suppress checks="LineLength" files="TestObjects.java" lines="52" />
16-
178
<!-- false positives due to Lombok usage -->
189
<suppress checks="HideUtilityClassConstructor" files="ru.mystamps.web.model" />
1910
<suppress checks="HideUtilityClassConstructor" files="ru.mystamps.web.entity" />

src/main/config/checkstyle.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@
7575
</module>
7676

7777
<module name="SuppressWithNearbyCommentFilter">
78-
<property name="commentFormat" value="NOCHECKSTYLE"/>
79-
<property name="checkFormat" value=".*"/>
80-
<property name="influenceFormat" value="0"/>
78+
<property name="commentFormat" value="CheckStyle: ignore (\w+) for next (\d+) line"/>
79+
<property name="checkFormat" value="$1"/>
80+
<property name="influenceFormat" value="$2"/>
8181
</module>
8282

8383
<!-- Allow to use @SuppressWarning annotation to suppress warnings -->
@@ -263,7 +263,7 @@
263263
-->
264264
<module name="UpperEll"/>
265265
<module name="TrailingComment">
266-
<property name="legalComment" value="TODO|XXX|NOPMD|NOCHECKSTYLE"/>
266+
<property name="legalComment" value="TODO|XXX|NOPMD"/>
267267
</module>
268268

269269
</module>

src/main/java/ru/mystamps/web/Url.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public final class Url {
7474
public static final String JQUERY_JS = "/public/jquery/jquery.min.js";
7575

7676
// see also pom.xml and ru.mystamps.web.config.MvcConfig#addResourceHandlers()
77+
// CheckStyle: ignore LineLength for next 3 lines
7778
public static final String BOOTSTRAP_CSS_CDN = "http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css";
7879
public static final String BOOTSTRAP_JS_CDN = "http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js";
7980
public static final String JQUERY_JS_CDN = "http://yandex.st/jquery/1.9.1/jquery.min.js";

src/main/java/ru/mystamps/web/config/ControllersConfig.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
import org.springframework.context.annotation.Bean;
2424
import org.springframework.context.annotation.Configuration;
2525

26-
import ru.mystamps.web.controller.*; // NOCHECKSTYLE: AvoidStarImportCheck, NOPMD: UnusedImports
26+
// CheckStyle: ignore AvoidStarImportCheck for next 1 line
27+
import ru.mystamps.web.controller.*; // NOPMD: UnusedImports
2728

2829
@Configuration
2930
public class ControllersConfig {

src/main/java/ru/mystamps/web/config/ServicesConfig.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
import org.springframework.core.env.Environment;
2626
import org.springframework.mail.javamail.JavaMailSender;
2727

28-
import ru.mystamps.web.dao.*; // NOCHECKSTYLE: AvoidStarImportCheck, NOPMD: UnusedImports
29-
import ru.mystamps.web.service.*; // NOCHECKSTYLE: AvoidStarImportCheck, NOPMD: UnusedImports
28+
// CheckStyle: ignore AvoidStarImportCheck for next 2 lines
29+
import ru.mystamps.web.dao.*; // NOPMD: UnusedImports
30+
import ru.mystamps.web.service.*; // NOPMD: UnusedImports
3031
import ru.mystamps.web.support.spring.security.SecurityConfig;
3132

3233
@Configuration

src/main/java/ru/mystamps/web/controller/ErrorController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ public void notFound(
6969
public void internalError(HttpServletRequest request) {
7070
// TODO: log to database (with *.status_code, *.message, *.servlet_name and user details)
7171

72-
String page = (String)request.getAttribute("javax.servlet.error.request_uri");
72+
// CheckStyle: ignore LineLength for next 1 line
7373
Class<?> exceptionType = (Class<?>)request.getAttribute("javax.servlet.error.exception_type");
7474
Exception exception = (Exception)request.getAttribute("javax.servlet.error.exception");
75+
String page = (String)request.getAttribute("javax.servlet.error.request_uri");
7576

7677
if (page != null && !Url.INTERNAL_ERROR_PAGE.equals(page)) {
7778
String msg = String.format(

src/main/java/ru/mystamps/web/dao/impl/JdbcSeriesDaoImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ public Iterable<SeriesInfoDto> findByCountryIdAsSeriesInfo(Integer countryId, St
120120
}
121121

122122
@Override
123+
// CheckStyle: ignore LineLength for next 1 line
123124
public Iterable<SeriesInfoDto> findByCollectionIdAsSeriesInfo(Integer collectionId, String lang) {
124125
Map<String, Object> params = new HashMap<>();
125126
params.put("collection_id", collectionId);

src/main/java/ru/mystamps/web/support/spring/security/SecurityConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@
2828
import org.springframework.security.authentication.AuthenticationProvider;
2929
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
3030
import org.springframework.security.authentication.event.AuthenticationFailureBadCredentialsEvent;
31+
// CheckStyle: ignore LineLength for next 2 lines
3132
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
3233
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
3334
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
3435
import org.springframework.security.config.annotation.web.builders.WebSecurity;
3536
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
37+
// CheckStyle: ignore LineLength for next 1 line
3638
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
3739
import org.springframework.security.core.userdetails.UserDetailsService;
3840
import org.springframework.security.crypto.password.PasswordEncoder;

src/test/java/ru/mystamps/web/service/TestObjects.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ final class TestObjects {
4949

5050
private static final String TEST_NAME = "Test Name";
5151
private static final String TEST_LOGIN = "test";
52+
// CheckStyle: ignore LineLength for next 1 line
5253
private static final String TEST_HASH = "$2a$10$Oo8A/oaKQYwt4Zi1RWGir.HHziCG267CJaqaNaNUtE/8ceysZn0za";
5354

5455
private TestObjects() {

src/test/java/ru/mystamps/web/tests/page/AbstractPage.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@
4040
@RequiredArgsConstructor(access = PROTECTED)
4141
public abstract class AbstractPage {
4242

43-
private static final String A_HREF_LOCATOR = "//a[@href=\"%s\"]";
43+
// CheckStyle: ignore LineLength for next 2 lines
4444
private static final String LOGOUT_BUTTON_LOCATOR = "//form[@id=\"LogoutForm\"]/input[@type=\"submit\"]";
4545
private static final String USER_BAR_ENTRIES_LOCATOR = "//*[@id=\"user_bar\"]//li/a | //*[@id=\"user_bar\"]//li//input[not(@type=\"hidden\")]";
46+
private static final String A_HREF_LOCATOR = "//a[@href=\"%s\"]";
4647

4748
protected final WebDriver driver;
4849
private final String pageUrl;

src/test/java/ru/mystamps/web/tests/page/AbstractPageWithForm.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
public abstract class AbstractPageWithForm extends AbstractPage {
3636

37+
// CheckStyle: ignore LineLength for next 1 line
3738
private static final String LABEL_LOCATOR = "//label[@for=\"%s\"]/span[@class=\"field-label\"]";
3839
private static final String FIELD_ERROR_LOCATOR = "//span[@id=\"%s.errors\"]";
3940
private static final String FIELD_REQUIRED_LOCATOR = "//span[@id=\"%s.required\"]";

src/test/java/ru/mystamps/web/tests/page/element/Form.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@
2828
public final class Form {
2929
private static final String FORM_LOCATOR = "//form";
3030
private static final String INPUT_FIELD_LOCATOR = "//input[@name=\"%s\"]";
31+
// CheckStyle: ignore LineLength for next 2 lines
3132
private static final String PASSWORD_FIELD_LOCATOR = "//input[@name=\"%s\"][@type=\"password\"]";
3233
private static final String CHECKBOX_FIELD_LOCATOR = "//input[@name=\"%s\"][@type=\"checkbox\"]";
3334
private static final String UPLOAD_FIELD_LOCATOR = "//input[@name=\"%s\"][@type=\"file\"]";
3435
private static final String SELECT_FIELD_LOCATOR = "//select[@name=\"%s\"]";
3536
private static final String TEXTAREA_FIELD_LOCATOR = "//textarea[@name=\"%s\"]";
3637
private static final String SUBMIT_BUTTON_LOCATOR = "//input[@type=\"submit\"]";
38+
// CheckStyle: ignore LineLength for next 1 line
3739
private static final String SUBMIT_WITH_VALUE_LOCATOR = "//input[@type=\"submit\"][@value=\"%s\"]";
3840

3941
@Getter private List<Field> fields;

0 commit comments

Comments
 (0)