diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 6cdeb56e2..d5b5b3276 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -15,30 +15,6 @@ defaults: shell: bash jobs: - run-checkstyle: - name: Run CheckStyle - # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on - runs-on: ubuntu-20.04 - steps: - - name: Clone source code - uses: actions/checkout@v4.1.1 # https://github.com/actions/checkout - with: - # Whether to configure the token or SSH key with the local git config. Default: true - persist-credentials: false - - name: Install JDK - uses: actions/setup-java@v4.0.0 # https://github.com/actions/setup-java - with: - distribution: 'adopt' # https://github.com/actions/setup-java#supported-distributions - java-version: '8' # https://github.com/actions/setup-java#supported-version-syntax - - name: Restore existing cache - uses: actions/cache@v4.0.0 # https://github.com/actions/cache - with: - # https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#input-parameters-for-the-cache-action - key: maven-repository-${{ hashFiles('pom.xml') }} - path: ~/.m2/repository - restore-keys: maven-repository- - - name: Run CheckStyle - run: ./src/main/scripts/execute-command.sh checkstyle run-pmd: name: Run PMD diff --git a/pom.xml b/pom.xml index 8c83dd14c..183b06f03 100644 --- a/pom.xml +++ b/pom.xml @@ -569,7 +569,6 @@ 3.4.1 2.2.2 - 2.17 3.0.0 @@ -831,20 +830,6 @@ - - org.apache.maven.plugins - maven-checkstyle-plugin - ${checkstyle.plugin.version} - - false - true - true - false - ${basedir}/src/main/config/checkstyle.xml - ${basedir}/src/main/config/checkstyle-suppressions.xml - - - org.apache.maven.plugins maven-clean-plugin diff --git a/src/main/config/checkstyle-suppressions.xml b/src/main/config/checkstyle-suppressions.xml deleted file mode 100644 index a44c007cd..000000000 --- a/src/main/config/checkstyle-suppressions.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/src/main/config/checkstyle.xml b/src/main/config/checkstyle.xml deleted file mode 100644 index 6a0bce0f3..000000000 --- a/src/main/config/checkstyle.xml +++ /dev/null @@ -1,276 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/java/ru/mystamps/web/common/Pager.java b/src/main/java/ru/mystamps/web/common/Pager.java index caf2d5e6c..75c0083cc 100644 --- a/src/main/java/ru/mystamps/web/common/Pager.java +++ b/src/main/java/ru/mystamps/web/common/Pager.java @@ -145,14 +145,12 @@ private static List createItems( nextItemsCnt--; } - // CheckStyle: ignore LineLength for next 3 lines // we've added too much to the beginning } else if (prevItemsCnt > ITEMS_BEFORE_CURRENT && nextItemsCnt <= ITEMS_AFTER_CURRENT) { while (prevItemsCnt > ITEMS_BEFORE_CURRENT && (prevItemsCnt + nextItemsCnt + 1) > MAX_ITEMS) { prevItemsCnt--; } - // CheckStyle: ignore LineLength for next 3 lines // we've added too much to the end } else if (nextItemsCnt > ITEMS_AFTER_CURRENT && prevItemsCnt <= ITEMS_BEFORE_CURRENT) { while (nextItemsCnt > ITEMS_AFTER_CURRENT && (prevItemsCnt + nextItemsCnt + 1) > MAX_ITEMS) { diff --git a/src/main/java/ru/mystamps/web/config/MvcConfig.java b/src/main/java/ru/mystamps/web/config/MvcConfig.java index 6bbe24017..e1d2bc2b7 100755 --- a/src/main/java/ru/mystamps/web/config/MvcConfig.java +++ b/src/main/java/ru/mystamps/web/config/MvcConfig.java @@ -113,7 +113,6 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) { VersionResourceResolver resourceResolver = new VersionResourceResolver() .addFixedVersionStrategy(ResourceUrl.RESOURCES_VERSION, "/**"); - // CheckStyle: ignore MagicNumber for next 1 line CacheControl cacheControl = CacheControl.maxAge(Duration.ofDays(7)); registry.addResourceHandler("/static/**") @@ -168,7 +167,6 @@ public void addInterceptors(InterceptorRegistry registry) { } @Override - // CheckStyle: ignore LineLength for next 2 lines // LATER: remove deprecation and usage of setUseSuffixPatternMatch() during upgrade to Spring Framework 5.3 // See: https://docs.spring.io/spring-framework/docs/5.2.22.RELEASE/javadoc-api/org/springframework/web/servlet/config/annotation/PathMatchConfigurer.html#setUseSuffixPatternMatch-java.lang.Boolean- @SuppressWarnings("deprecation") diff --git a/src/main/java/ru/mystamps/web/feature/account/JdbcUsersActivationDao.java b/src/main/java/ru/mystamps/web/feature/account/JdbcUsersActivationDao.java index 043141138..0384bf367 100644 --- a/src/main/java/ru/mystamps/web/feature/account/JdbcUsersActivationDao.java +++ b/src/main/java/ru/mystamps/web/feature/account/JdbcUsersActivationDao.java @@ -38,7 +38,6 @@ public class JdbcUsersActivationDao implements UsersActivationDao { private final String removeByActivationKeySql; private final String addActivationKeySql; - @SuppressWarnings("checkstyle:linelength") public JdbcUsersActivationDao(Environment env, NamedParameterJdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; this.findByActivationKeySql = env.getRequiredProperty("users_activation.find_by_activation_key"); diff --git a/src/main/java/ru/mystamps/web/feature/category/CategoryServiceImpl.java b/src/main/java/ru/mystamps/web/feature/category/CategoryServiceImpl.java index 7a1135e6a..0d44b0be1 100644 --- a/src/main/java/ru/mystamps/web/feature/category/CategoryServiceImpl.java +++ b/src/main/java/ru/mystamps/web/feature/category/CategoryServiceImpl.java @@ -92,7 +92,6 @@ public List findIdsByNames(List names) { return categoryDao.findIdsByNames(lowerCasesNames); } - // CheckStyle: ignore LineLength for next 1 line // @todo #819 CategoryServiceImpl.findIdsWhenNameStartsWith(): add unit test for converting to lower case @Override @Transactional(readOnly = true) diff --git a/src/main/java/ru/mystamps/web/feature/category/JdbcCategoryDao.java b/src/main/java/ru/mystamps/web/feature/category/JdbcCategoryDao.java index 17a7d056b..7c7333678 100644 --- a/src/main/java/ru/mystamps/web/feature/category/JdbcCategoryDao.java +++ b/src/main/java/ru/mystamps/web/feature/category/JdbcCategoryDao.java @@ -64,7 +64,6 @@ public class JdbcCategoryDao implements CategoryDao { @SuppressWarnings("PMD.LongVariable") private final String findFromLastCreatedSeriesByUserSql; - @SuppressWarnings("checkstyle:linelength") public JdbcCategoryDao(Environment env, NamedParameterJdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; this.addCategorySql = env.getRequiredProperty("category.create"); diff --git a/src/main/java/ru/mystamps/web/feature/collection/JdbcCollectionDao.java b/src/main/java/ru/mystamps/web/feature/collection/JdbcCollectionDao.java index 3057eeb7b..fb2e90f9a 100644 --- a/src/main/java/ru/mystamps/web/feature/collection/JdbcCollectionDao.java +++ b/src/main/java/ru/mystamps/web/feature/collection/JdbcCollectionDao.java @@ -62,7 +62,6 @@ public class JdbcCollectionDao implements CollectionDao { private final String removeSeriesInstanceSql; private final String findCollectionInfoBySlugSql; - @SuppressWarnings("checkstyle:linelength") public JdbcCollectionDao(Environment env, NamedParameterJdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; this.findLastCreatedCollectionsSql = env.getRequiredProperty("collection.find_last_created"); @@ -259,7 +258,6 @@ public Integer addSeriesToUserCollection(AddToCollectionDbDto dto) { JdbcUtils.ID_KEY_COLUMN ); - // CheckStyle: ignore LineLength for next 3 lines Validate.validState( affected == 1, "Unexpected number of affected rows after adding series #%d to collection of user #%d: %d", @@ -280,7 +278,6 @@ public void removeSeriesFromUserCollection(Integer userId, Integer seriesInstanc int affected = jdbcTemplate.update(removeSeriesInstanceSql, params); if (affected != 1) { - // CheckStyle: ignore LineLength for next 2 lines LOG.warn( "Unexpected number of affected rows after removing series instance #{} from collection of user #{}: {}", seriesInstanceId, diff --git a/src/main/java/ru/mystamps/web/feature/country/CountryServiceImpl.java b/src/main/java/ru/mystamps/web/feature/country/CountryServiceImpl.java index 5c0e19ff0..8bdae53ba 100644 --- a/src/main/java/ru/mystamps/web/feature/country/CountryServiceImpl.java +++ b/src/main/java/ru/mystamps/web/feature/country/CountryServiceImpl.java @@ -92,7 +92,6 @@ public List findIdsByNames(List names) { return countryDao.findIdsByNames(lowerCasesNames); } - // CheckStyle: ignore LineLength for next 1 line // @todo #819 CountryServiceImpl.findIdsWhenNameStartsWith(): add unit test for converting to lower case @Override @Transactional(readOnly = true) diff --git a/src/main/java/ru/mystamps/web/feature/country/JdbcCountryDao.java b/src/main/java/ru/mystamps/web/feature/country/JdbcCountryDao.java index 3adb0f9ec..074ad5ad3 100644 --- a/src/main/java/ru/mystamps/web/feature/country/JdbcCountryDao.java +++ b/src/main/java/ru/mystamps/web/feature/country/JdbcCountryDao.java @@ -65,7 +65,6 @@ public class JdbcCountryDao implements CountryDao { @SuppressWarnings("PMD.LongVariable") private final String findLastCountryCreatedByUserSql; - @SuppressWarnings("checkstyle:linelength") public JdbcCountryDao(Environment env, NamedParameterJdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; this.addCountrySql = env.getRequiredProperty("country.create"); diff --git a/src/main/java/ru/mystamps/web/feature/image/FilesystemImagePersistenceStrategy.java b/src/main/java/ru/mystamps/web/feature/image/FilesystemImagePersistenceStrategy.java index d5c8ccadb..414b79ccc 100644 --- a/src/main/java/ru/mystamps/web/feature/image/FilesystemImagePersistenceStrategy.java +++ b/src/main/java/ru/mystamps/web/feature/image/FilesystemImagePersistenceStrategy.java @@ -51,7 +51,6 @@ public void init() { log.warn("Directory '{}' doesn't exist! Image uploading won't work", storageDir); } else if (!storageDir.canWrite()) { - // CheckStyle: ignore ParenPad for next 1 line log.warn( // NOPMD: GuardLogStatement (https://github.com/pmd/pmd/issues/957) // FIXME(java9): log also user: ProcessHandle.current().info().user() "Directory '{}' exists but isn't writable for the current user! " @@ -70,7 +69,6 @@ public void init() { } else if (!previewDir.canWrite()) { // FIXME(java9): log also user: ProcessHandle.current().info().user() - // CheckStyle: ignore ParenPad for next 1 line log.warn( // NOPMD: GuardLogStatement (https://github.com/pmd/pmd/issues/957) "Directory '{}' exists but isn't writable for the current user! " + "Image preview generation won't work", diff --git a/src/main/java/ru/mystamps/web/feature/participant/JdbcParticipantDao.java b/src/main/java/ru/mystamps/web/feature/participant/JdbcParticipantDao.java index 7ef133892..0e82eaa50 100644 --- a/src/main/java/ru/mystamps/web/feature/participant/JdbcParticipantDao.java +++ b/src/main/java/ru/mystamps/web/feature/participant/JdbcParticipantDao.java @@ -45,7 +45,6 @@ public class JdbcParticipantDao implements ParticipantDao { private final String findAllGroupsSql; private final String findGroupIdByNameSql; - @SuppressWarnings("checkstyle:linelength") public JdbcParticipantDao(Environment env, NamedParameterJdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; this.addParticipantSql = env.getRequiredProperty("transaction_participant.create"); diff --git a/src/main/java/ru/mystamps/web/feature/series/DownloadImageInterceptor.java b/src/main/java/ru/mystamps/web/feature/series/DownloadImageInterceptor.java index 142fbbc3e..ecbdca5b5 100644 --- a/src/main/java/ru/mystamps/web/feature/series/DownloadImageInterceptor.java +++ b/src/main/java/ru/mystamps/web/feature/series/DownloadImageInterceptor.java @@ -89,7 +89,6 @@ public boolean preHandle( if (!(request instanceof StandardMultipartHttpServletRequest)) { // It could mean that
tag doesn't have enctype="multipart/form-data" attribute. - // CheckStyle: ignore ParenPad for next 1 line LOG.warn( // NOPMD: GuardLogStatement (https://github.com/pmd/pmd/issues/957) "Unknown type of request ({}). " + "Downloading images from external servers won't work!", diff --git a/src/main/java/ru/mystamps/web/feature/series/HttpURLConnectionDownloaderService.java b/src/main/java/ru/mystamps/web/feature/series/HttpURLConnectionDownloaderService.java index a2d1d0175..6324984c4 100644 --- a/src/main/java/ru/mystamps/web/feature/series/HttpURLConnectionDownloaderService.java +++ b/src/main/java/ru/mystamps/web/feature/series/HttpURLConnectionDownloaderService.java @@ -117,7 +117,6 @@ public DownloadResult download(String fileUrl) { private static HttpURLConnection openConnection(URL url) throws IOException { URLConnection connection = url.openConnection(); if (!(connection instanceof HttpURLConnection)) { - // CheckStyle: ignore ParenPad for next 1 line LOG.warn( // NOPMD: GuardLogStatement (https://github.com/pmd/pmd/issues/957) "Couldn't open connection: " + "unknown type of connection class ({}). " diff --git a/src/main/java/ru/mystamps/web/feature/series/JdbcSeriesDao.java b/src/main/java/ru/mystamps/web/feature/series/JdbcSeriesDao.java index 259afaa0b..ff21e5329 100644 --- a/src/main/java/ru/mystamps/web/feature/series/JdbcSeriesDao.java +++ b/src/main/java/ru/mystamps/web/feature/series/JdbcSeriesDao.java @@ -67,7 +67,6 @@ public class JdbcSeriesDao implements SeriesDao { private final String addSolovyovPriceSql; private final String addZagorskiPriceSql; - @SuppressWarnings("checkstyle:linelength") public JdbcSeriesDao(Environment env, NamedParameterJdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; this.createSeriesSql = env.getRequiredProperty("series.create"); @@ -221,7 +220,6 @@ public List findLastAdded(int quantity, String lang) { return jdbcTemplate.query(findLastAddedSeriesSql, params, RowMappers::forSeriesLinkDto); } - // CheckStyle: ignore LineLength for next 2 lines @Override public SeriesFullInfoDto findByIdAsSeriesFullInfo(Integer seriesId, Integer userId, String lang) { Map params = new HashMap<>(); diff --git a/src/main/java/ru/mystamps/web/feature/series/SeriesController.java b/src/main/java/ru/mystamps/web/feature/series/SeriesController.java index d4b4e6787..5a671026a 100644 --- a/src/main/java/ru/mystamps/web/feature/series/SeriesController.java +++ b/src/main/java/ru/mystamps/web/feature/series/SeriesController.java @@ -297,7 +297,6 @@ public String showInfoBySlug( return "category/info"; } - @SuppressWarnings("checkstyle:parameternumber") @PostMapping(path = SeriesUrl.ADD_IMAGE_SERIES_PAGE, params = { "replaceImage", "imageUrl" }) public String replaceImageWithImageUrl( @Validated({ @@ -328,7 +327,6 @@ public String replaceImageWithImageUrl( ); } - @SuppressWarnings("checkstyle:parameternumber") @PostMapping(path = SeriesUrl.ADD_IMAGE_SERIES_PAGE, params = "imageUrl") public String processImageWithImageUrl( @Validated({ @@ -358,7 +356,6 @@ public String processImageWithImageUrl( ); } - @SuppressWarnings("checkstyle:parameternumber") @PostMapping( path = SeriesUrl.ADD_IMAGE_SERIES_PAGE, params = "!imageUrl", @@ -431,8 +428,6 @@ public String processImage( return redirectTo(SeriesUrl.INFO_SERIES_PAGE, series.getId()); } - // many method parameters are OK here - @SuppressWarnings("checkstyle:parameternumber") @PostMapping(path = SeriesUrl.INFO_SERIES_PAGE, params = "action=ADD") public String addToCollection( @Valid AddToCollectionForm form, @@ -483,7 +478,6 @@ public String addToCollection( return null; } - // CheckStyle: ignore LineLength for next 1 line Map commonAttrs = prepareCommonAttrsForSeriesInfo(series, currentUserId, authentication, lang); model.addAllAttributes(commonAttrs); @@ -538,7 +532,6 @@ public String removeFromCollection( return redirectTo(CollectionUrl.INFO_COLLECTION_PAGE, collectionSlug); } - @SuppressWarnings("checkstyle:parameternumber") @PostMapping(SeriesUrl.ADD_SERIES_ASK_PAGE) public String processAskForm( @Validated({ Default.class, AddSeriesSalesForm.UrlChecks.class }) AddSeriesSalesForm form, diff --git a/src/main/java/ru/mystamps/web/feature/series/SeriesDto.java b/src/main/java/ru/mystamps/web/feature/series/SeriesDto.java index 00ba4ab6b..a93dc8002 100644 --- a/src/main/java/ru/mystamps/web/feature/series/SeriesDto.java +++ b/src/main/java/ru/mystamps/web/feature/series/SeriesDto.java @@ -49,7 +49,7 @@ public class SeriesDto { @Getter private final List hiddenImageIds; - @SuppressWarnings({ "checkstyle:parameternumber", "PMD.ExcessiveParameterList" }) + @SuppressWarnings("PMD.ExcessiveParameterList") public SeriesDto( SeriesFullInfoDto info, List michelNumbers, diff --git a/src/main/java/ru/mystamps/web/feature/series/SeriesService.java b/src/main/java/ru/mystamps/web/feature/series/SeriesService.java index 151c5f6cb..b4ed2dd83 100644 --- a/src/main/java/ru/mystamps/web/feature/series/SeriesService.java +++ b/src/main/java/ru/mystamps/web/feature/series/SeriesService.java @@ -31,7 +31,6 @@ public interface SeriesService { Integer add(AddSeriesDto dto, Integer userId); - // CheckStyle: ignore LineLength for next 6 lines // @todo #1411 Configure MethodValidationPostProcessor to use messages from ValidationMessages.properties void addComment( Integer seriesId, diff --git a/src/main/java/ru/mystamps/web/feature/series/SeriesServiceImpl.java b/src/main/java/ru/mystamps/web/feature/series/SeriesServiceImpl.java index 690115a1f..677fc9f3d 100644 --- a/src/main/java/ru/mystamps/web/feature/series/SeriesServiceImpl.java +++ b/src/main/java/ru/mystamps/web/feature/series/SeriesServiceImpl.java @@ -168,7 +168,6 @@ public void addReleaseYear(Integer seriesId, Integer year, Integer userId) { @Override @Transactional @PreAuthorize(HasAuthority.CREATE_SERIES) - // CheckStyle: ignore LineLength for next 1 line public void addCatalogPrice(StampsCatalog catalog, Integer seriesId, BigDecimal price, Integer userId) { Validate.isTrue(seriesId != null, "Series id must be non null"); Validate.isTrue(price != null, "Price must be non null"); @@ -182,7 +181,6 @@ public void addCatalogPrice(StampsCatalog catalog, Integer seriesId, BigDecimal Date now = new Date(); dto.setUpdatedAt(now); - // CheckStyle: ignore MethodParamPad for next 5 lines switch (catalog) { case MICHEL: seriesDao.addMichelPrice (dto); break; case SCOTT: seriesDao.addScottPrice (dto); break; @@ -206,7 +204,6 @@ public void addCatalogPrice(StampsCatalog catalog, Integer seriesId, BigDecimal @Override @Transactional @PreAuthorize(HasAuthority.CREATE_SERIES) - // CheckStyle: ignore LineLength for next 1 line public void addCatalogNumbers(StampsCatalog catalog, Integer seriesId, String numbers, Integer userId) { Validate.isTrue(seriesId != null, "Series id must be non null"); Validate.isTrue(numbers != null, "Numbers must be non null"); @@ -214,7 +211,6 @@ public void addCatalogNumbers(StampsCatalog catalog, Integer seriesId, String nu seriesDao.markAsModified(seriesId, new Date(), userId); - // CheckStyle: ignore LineLength for next 7 lines switch (catalog) { case MICHEL: createCatalogNumbersAndAddToSeries(seriesId, michelCatalogService, numbers); break; case SCOTT: createCatalogNumbersAndAddToSeries(seriesId, scottCatalogService, numbers); break; diff --git a/src/main/java/ru/mystamps/web/feature/series/SeriesValidation.java b/src/main/java/ru/mystamps/web/feature/series/SeriesValidation.java index ef16ed94e..57d3d3bc9 100644 --- a/src/main/java/ru/mystamps/web/feature/series/SeriesValidation.java +++ b/src/main/java/ru/mystamps/web/feature/series/SeriesValidation.java @@ -29,7 +29,7 @@ public final class SeriesValidation { public static final int MAX_STAMPS_IN_SERIES = 150; public static final int MIN_RELEASE_YEAR = 1840; static final String CATALOG_NUMBERS_REGEXP = "[1-9][0-9]{0,3}(,[1-9][0-9]{0,3})*"; - @SuppressWarnings({ "PMD.LongVariable", "checkstyle:linelength" }) + @SuppressWarnings("PMD.LongVariable") static final String CATALOG_NUMBERS_AND_LETTERS_REGEXP = "[1-9][0-9]{0,3}[a-z]?(,[1-9][0-9]{0,3}[a-z]?)*"; static final int MAX_SERIES_COMMENT_LENGTH = Series.COMMENT_LENGTH; diff --git a/src/main/java/ru/mystamps/web/feature/series/importing/ImportSeriesSalesForm.java b/src/main/java/ru/mystamps/web/feature/series/importing/ImportSeriesSalesForm.java index 391b6c823..2c2df3308 100644 --- a/src/main/java/ru/mystamps/web/feature/series/importing/ImportSeriesSalesForm.java +++ b/src/main/java/ru/mystamps/web/feature/series/importing/ImportSeriesSalesForm.java @@ -44,7 +44,6 @@ public class ImportSeriesSalesForm implements AddSeriesSalesDto { @NotNull private Currency currency; - // CheckStyle: ignore LineLength for next 1 line // @todo #1230 /series/import/request/{id}: validate that both alt price/currency are present or absent private BigDecimal altPrice; private Currency altCurrency; diff --git a/src/main/java/ru/mystamps/web/feature/series/importing/JdbcSeriesImportDao.java b/src/main/java/ru/mystamps/web/feature/series/importing/JdbcSeriesImportDao.java index 5f9ee411f..ec711a815 100644 --- a/src/main/java/ru/mystamps/web/feature/series/importing/JdbcSeriesImportDao.java +++ b/src/main/java/ru/mystamps/web/feature/series/importing/JdbcSeriesImportDao.java @@ -52,7 +52,6 @@ public class JdbcSeriesImportDao implements SeriesImportDao { private final String findRequestInfoSql; private final String findAllSql; - @SuppressWarnings("checkstyle:linelength") public JdbcSeriesImportDao(Environment env, NamedParameterJdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; this.createSeriesImportRequestSql = env.getRequiredProperty("series_import_requests.create"); @@ -96,7 +95,6 @@ public Integer add(ImportSeriesDbDto importRequest) { return Integer.valueOf(holder.getKey().intValue()); } - // CheckStyle: ignore LineLength for next 2 lines @Override public void setSeriesIdAndChangeStatus(Integer seriesId, UpdateImportRequestStatusDbDto requestStatus) { Map params = new HashMap<>(); @@ -214,7 +212,6 @@ public void addParsedData(Integer requestId, AddSeriesParsedDataDbDto data) { } @Override - @SuppressWarnings("checkstyle:linelength") public void addParsedImageUrls(Integer requestId, List imageUrls) { if (imageUrls == null || imageUrls.isEmpty()) { return; diff --git a/src/main/java/ru/mystamps/web/feature/series/importing/SeriesImportConfig.java b/src/main/java/ru/mystamps/web/feature/series/importing/SeriesImportConfig.java index e3641fb59..0a4075e11 100644 --- a/src/main/java/ru/mystamps/web/feature/series/importing/SeriesImportConfig.java +++ b/src/main/java/ru/mystamps/web/feature/series/importing/SeriesImportConfig.java @@ -65,7 +65,6 @@ public SeriesImportController seriesImportController() { ); } - // CheckStyle: ignore LineLength for next 2 lines @Bean public FilterRegistrationBean importSeriesFormTrimmerFilter() { FilterRegistrationBean bean = @@ -76,7 +75,6 @@ public FilterRegistrationBean importSeriesFormTri // register with an order greater than UserMdcLoggingFilter to get a lowest precedence // and being executed after it - // CheckStyle: ignore MagicNumber for next 1 line bean.setOrder(Ordered.LOWEST_PRECEDENCE - 50); return bean; diff --git a/src/main/java/ru/mystamps/web/feature/series/importing/SeriesImportController.java b/src/main/java/ru/mystamps/web/feature/series/importing/SeriesImportController.java index dab06299b..b2ab9c1b3 100644 --- a/src/main/java/ru/mystamps/web/feature/series/importing/SeriesImportController.java +++ b/src/main/java/ru/mystamps/web/feature/series/importing/SeriesImportController.java @@ -70,7 +70,6 @@ protected void initRequestImportForm(WebDataBinder binder) { @InitBinder("importSeriesForm") protected void initImportSeriesForm(WebDataBinder binder) { - // CheckStyle: ignore LineLength for next 1 line binder.registerCustomEditor(String.class, "michelNumbers", new ExpandCatalogNumbersEditor()); binder.registerCustomEditor(String.class, "seller.name", new StringTrimmerEditor(true)); binder.registerCustomEditor(String.class, "seller.url", new StringTrimmerEditor(true)); @@ -201,7 +200,6 @@ public String showRequestAndImportSeriesForm( return "series/import/info"; } - @SuppressWarnings("checkstyle:parameternumber") @PostMapping(SeriesImportUrl.REQUEST_IMPORT_PAGE) public String processImportSeriesForm( @PathVariable("id") Integer requestId, diff --git a/src/main/java/ru/mystamps/web/feature/series/importing/SeriesImportServiceImpl.java b/src/main/java/ru/mystamps/web/feature/series/importing/SeriesImportServiceImpl.java index c14cc16d8..418613a3b 100644 --- a/src/main/java/ru/mystamps/web/feature/series/importing/SeriesImportServiceImpl.java +++ b/src/main/java/ru/mystamps/web/feature/series/importing/SeriesImportServiceImpl.java @@ -174,7 +174,6 @@ public String getDownloadedContent(Integer requestId) { return seriesImportDao.findRawContentByRequestId(requestId); } - // CheckStyle: ignore LineLength for next 3 lines @Override @Transactional public void saveParsedData(Integer requestId, SeriesExtractedInfo seriesInfo, List imageUrls) { diff --git a/src/main/java/ru/mystamps/web/feature/series/importing/SeriesInfoExtractorServiceImpl.java b/src/main/java/ru/mystamps/web/feature/series/importing/SeriesInfoExtractorServiceImpl.java index 02a11cacb..b4f04c6d2 100644 --- a/src/main/java/ru/mystamps/web/feature/series/importing/SeriesInfoExtractorServiceImpl.java +++ b/src/main/java/ru/mystamps/web/feature/series/importing/SeriesInfoExtractorServiceImpl.java @@ -56,12 +56,10 @@ public class SeriesInfoExtractorServiceImpl implements SeriesInfoExtractorServic // Regular expression matches release date of the stamps. // Year should be in range within 1840 and 2099 inclusive. - // CheckStyle: ignore LineLength for next 2 lines private static final Pattern RELEASE_DATE_REGEXP = Pattern.compile("((?[0-9]{2})\\.(?[0-9]{2})\\.)?(?18[4-9][0-9]|19[0-9]{2}|20[0-9]{2})(г(од|\\.)?|\\.)?"); // Regular expression matches number of the stamps in a series. - // CheckStyle: ignore LineLength for next 2 lines private static final Pattern NUMBER_OF_STAMPS_REGEXP = Pattern.compile( "(?[1-9][0-9]*)(-?(ти|ой|ух))?( ((без)?зубцов(ая|ы[ех])))?[ ]?(м(ар(ок|к[аи])|\\b)|(люкс[- ])?блок(а|ов)?|БЛ)", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE @@ -78,7 +76,6 @@ public class SeriesInfoExtractorServiceImpl implements SeriesInfoExtractorServic private static final Pattern BYN_CURRENCY_REGEXP = Pattern.compile("[0-9] бел\\. руб\\."); // Regular expression that matches Rubles (Russian currency). - // CheckStyle: ignore LineLength for next 1 line private static final Pattern RUB_CURRENCY_REGEXP = Pattern.compile("([0-9][ ]?р(уб|\\.)|RUB [0-9])"); // Regular expression that matches Euro. @@ -90,7 +87,6 @@ public class SeriesInfoExtractorServiceImpl implements SeriesInfoExtractorServic // Regular expression that matches US dollar. private static final Pattern USD_CURRENCY_REGEXP = Pattern.compile("([0-9]\\$|US\\$[0-9])"); - // CheckStyle: ignore LineLength for next 4 lines private static final Pattern VALID_CATEGORY_NAME_EN = Pattern.compile(CategoryValidation.NAME_EN_REGEXP); private static final Pattern VALID_CATEGORY_NAME_RU = Pattern.compile(CategoryValidation.NAME_RU_REGEXP); private static final Pattern VALID_COUNTRY_NAME_EN = Pattern.compile(CountryValidation.NAME_EN_REGEXP); @@ -355,7 +351,6 @@ public SeriesExtractedInfo extract(String pageUrl, RawParsedDataDto data) { /* default */ Integer extractSeller(String pageUrl, String name, String url) { if (StringUtils.isNotBlank(name) && StringUtils.isNotBlank(url)) { - // CheckStyle: ignore LineLength for next 1 line // @todo #695 SeriesInfoExtractorServiceImpl.extractSeller(): validate name/url (length etc) return extractSellerByNameAndUrl(name, url); } @@ -428,8 +423,7 @@ public SeriesExtractedInfo extract(String pageUrl, RawParsedDataDto data) { "PMD.AvoidInstantiatingObjectsInLoops", "PMD.AvoidReassigningParameters", "PMD.NPathComplexity", - "PMD.ModifiedCyclomaticComplexity", - "checkstyle:parameterassignment" + "PMD.ModifiedCyclomaticComplexity" }) /* default */ BigDecimal extractPrice(String fragment) { if (StringUtils.isBlank(fragment)) { diff --git a/src/main/java/ru/mystamps/web/feature/series/importing/event/DownloadingSucceededEventListener.java b/src/main/java/ru/mystamps/web/feature/series/importing/event/DownloadingSucceededEventListener.java index cf706725d..766782f4f 100644 --- a/src/main/java/ru/mystamps/web/feature/series/importing/event/DownloadingSucceededEventListener.java +++ b/src/main/java/ru/mystamps/web/feature/series/importing/event/DownloadingSucceededEventListener.java @@ -46,7 +46,6 @@ public class DownloadingSucceededEventListener implements ApplicationListener { - // CheckStyle: ignore LineLength for next 1 line private static final Logger LOG = LoggerFactory.getLogger(DownloadingSucceededEventListener.class); private final SeriesImportService seriesImportService; diff --git a/src/main/java/ru/mystamps/web/feature/series/importing/event/ImportRequestCreatedEventListener.java b/src/main/java/ru/mystamps/web/feature/series/importing/event/ImportRequestCreatedEventListener.java index 05c2d66f4..9c1915d66 100644 --- a/src/main/java/ru/mystamps/web/feature/series/importing/event/ImportRequestCreatedEventListener.java +++ b/src/main/java/ru/mystamps/web/feature/series/importing/event/ImportRequestCreatedEventListener.java @@ -39,7 +39,6 @@ public class ImportRequestCreatedEventListener implements ApplicationListener { - // CheckStyle: ignore LineLength for next 1 line private static final Logger LOG = LoggerFactory.getLogger(ImportRequestCreatedEventListener.class); private final DownloaderService downloaderService; @@ -55,7 +54,6 @@ public void onApplicationEvent(ImportRequestCreated event) { DownloadResult result = downloaderService.download(url); if (result.hasFailed()) { - // CheckStyle: ignore LineLength for next 1 line LOG.info("Request #{}: downloading of '{}' failed: {}", requestId, url, result.getCode()); seriesImportService.changeStatus( diff --git a/src/main/java/ru/mystamps/web/feature/series/importing/extractor/JdbcSiteParserDao.java b/src/main/java/ru/mystamps/web/feature/series/importing/extractor/JdbcSiteParserDao.java index 1f3118d38..a4bca8a03 100644 --- a/src/main/java/ru/mystamps/web/feature/series/importing/extractor/JdbcSiteParserDao.java +++ b/src/main/java/ru/mystamps/web/feature/series/importing/extractor/JdbcSiteParserDao.java @@ -38,7 +38,6 @@ public class JdbcSiteParserDao implements SiteParserDao { @SuppressWarnings("PMD.LongVariable") private final String findParametersWithParserNameSql; - @SuppressWarnings("checkstyle:linelength") public JdbcSiteParserDao(Environment env, NamedParameterJdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; this.findParserIdByMatchedUrlSql = env.getRequiredProperty("site_parser.find_like_matched_url"); diff --git a/src/main/java/ru/mystamps/web/feature/series/importing/sale/JdbcSeriesSalesImportDao.java b/src/main/java/ru/mystamps/web/feature/series/importing/sale/JdbcSeriesSalesImportDao.java index c39a4b391..929643925 100644 --- a/src/main/java/ru/mystamps/web/feature/series/importing/sale/JdbcSeriesSalesImportDao.java +++ b/src/main/java/ru/mystamps/web/feature/series/importing/sale/JdbcSeriesSalesImportDao.java @@ -32,7 +32,6 @@ public class JdbcSeriesSalesImportDao implements SeriesSalesImportDao { private final String addParsedDataSql; private final String findParsedDataSql; - @SuppressWarnings("checkstyle:linelength") public JdbcSeriesSalesImportDao(Environment env, NamedParameterJdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; this.addParsedDataSql = env.getRequiredProperty("series_sales_import.add_series_sales_parsed_data"); diff --git a/src/main/java/ru/mystamps/web/feature/series/importing/sale/SeriesSalesImportServiceImpl.java b/src/main/java/ru/mystamps/web/feature/series/importing/sale/SeriesSalesImportServiceImpl.java index 68a779254..f395f76ed 100644 --- a/src/main/java/ru/mystamps/web/feature/series/importing/sale/SeriesSalesImportServiceImpl.java +++ b/src/main/java/ru/mystamps/web/feature/series/importing/sale/SeriesSalesImportServiceImpl.java @@ -81,7 +81,6 @@ public SeriesSaleExtractedInfo downloadAndParse(String url) { info.getCondition() ); - // CheckStyle: ignore LineLength for next 1 line // @todo #995 SeriesInfoExtractorService: introduce a method for parsing only sales-related info SeriesExtractedInfo seriesInfo = extractorService.extract(url, data); diff --git a/src/main/java/ru/mystamps/web/feature/series/sale/JdbcSeriesSalesDao.java b/src/main/java/ru/mystamps/web/feature/series/sale/JdbcSeriesSalesDao.java index ea7ca5eb9..6135f781e 100644 --- a/src/main/java/ru/mystamps/web/feature/series/sale/JdbcSeriesSalesDao.java +++ b/src/main/java/ru/mystamps/web/feature/series/sale/JdbcSeriesSalesDao.java @@ -32,7 +32,6 @@ public class JdbcSeriesSalesDao implements SeriesSalesDao { private final String addSeriesSaleSql; private final String findSeriesSalesBySeriesIdSql; - @SuppressWarnings("checkstyle:linelength") public JdbcSeriesSalesDao(Environment env, NamedParameterJdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; this.addSeriesSaleSql = env.getRequiredProperty("series_sales.add"); diff --git a/src/main/java/ru/mystamps/web/feature/site/ErrorController.java b/src/main/java/ru/mystamps/web/feature/site/ErrorController.java index f3cb8ee1c..32ba3421c 100644 --- a/src/main/java/ru/mystamps/web/feature/site/ErrorController.java +++ b/src/main/java/ru/mystamps/web/feature/site/ErrorController.java @@ -42,7 +42,6 @@ public class ErrorController { public String notFound( HttpServletRequest request, @AuthenticationPrincipal CustomUserDetails currentUser, - // CheckStyle: ignore LineLength for next 1 line @RequestAttribute(name = RequestDispatcher.ERROR_REQUEST_URI, required = false) String page, @RequestHeader(name = HttpHeaders.REFERER, required = false) String referer, @RequestHeader(name = HttpHeaders.USER_AGENT, required = false) String agent) { @@ -59,7 +58,6 @@ public String notFound( @RequestMapping(SiteUrl.INTERNAL_ERROR_PAGE) public String internalError( - // CheckStyle: ignore LineLength for next 3 lines @RequestAttribute(name = RequestDispatcher.ERROR_EXCEPTION_TYPE, required = false) Class exceptionType, @RequestAttribute(name = RequestDispatcher.ERROR_EXCEPTION, required = false) Exception exception, @RequestAttribute(name = RequestDispatcher.ERROR_REQUEST_URI, required = false) String page) { diff --git a/src/main/java/ru/mystamps/web/feature/site/JdbcSuspiciousActivityDao.java b/src/main/java/ru/mystamps/web/feature/site/JdbcSuspiciousActivityDao.java index 5622c49ad..b9a411b67 100644 --- a/src/main/java/ru/mystamps/web/feature/site/JdbcSuspiciousActivityDao.java +++ b/src/main/java/ru/mystamps/web/feature/site/JdbcSuspiciousActivityDao.java @@ -35,7 +35,6 @@ public class JdbcSuspiciousActivityDao implements SuspiciousActivityDao { private final String countByTypeSinceSql; private final String findAllSql; - @SuppressWarnings("checkstyle:linelength") public JdbcSuspiciousActivityDao(Environment env, NamedParameterJdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; this.addSuspiciousActivitySql = env.getRequiredProperty("suspicious_activity.create"); diff --git a/src/main/java/ru/mystamps/web/feature/site/ResourceUrl.java b/src/main/java/ru/mystamps/web/feature/site/ResourceUrl.java index f111e517c..77b6cd396 100644 --- a/src/main/java/ru/mystamps/web/feature/site/ResourceUrl.java +++ b/src/main/java/ru/mystamps/web/feature/site/ResourceUrl.java @@ -34,7 +34,6 @@ public final class ResourceUrl { // MUST be updated when any of our resources were modified public static final String RESOURCES_VERSION = "v0.4.7.0"; - // CheckStyle: ignore LineLength for next 17 lines private static final String CATALOG_UTILS_JS = "/public/js/" + RESOURCES_VERSION + "/utils/CatalogUtils.min.js"; private static final String COLLECTION_INFO_JS = "/public/js/" + RESOURCES_VERSION + "/collection/info.min.js"; private static final String DATE_UTILS_JS = "/public/js/" + RESOURCES_VERSION + "/utils/DateUtils.min.js"; @@ -63,7 +62,6 @@ public final class ResourceUrl { private static final String REACT_DOM_JS = "16.8.6/umd/react-dom.production.min.js"; private static final String SELECTIZE_JS = "/0.13.3/js/standalone/selectize.min.js"; - // CheckStyle: ignore LineLength for next 2 lines private static final String SELECTIZE_CSS = "/public/selectize/0.13.3/css/selectize.bootstrap3.css"; private static final String SELECTIZE_CSS_CDN = "https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.13.3/css/selectize.bootstrap3.min.css"; @@ -103,7 +101,6 @@ public static void exposeWebjarResourcesToView(Map resources, bo put(resources, "https://yandex.st", "JQUERY_JS", JQUERY_JS); put(resources, "https://unpkg.com/react@", "REACT_JS", REACT_JS); put(resources, "https://unpkg.com/react-dom@", "REACT_DOM_JS", REACT_DOM_JS); - // CheckStyle: ignore LineLength for next 1 line put(resources, "https://cdnjs.cloudflare.com/ajax/libs/selectize.js", "SELECTIZE_JS", SELECTIZE_JS); put(resources, null, "SELECTIZE_CSS", SELECTIZE_CSS_CDN); return; diff --git a/src/main/java/ru/mystamps/web/feature/site/SiteServiceImpl.java b/src/main/java/ru/mystamps/web/feature/site/SiteServiceImpl.java index 3658bf107..aca17a23b 100644 --- a/src/main/java/ru/mystamps/web/feature/site/SiteServiceImpl.java +++ b/src/main/java/ru/mystamps/web/feature/site/SiteServiceImpl.java @@ -126,7 +126,7 @@ public void logAboutInvalidCsrfToken(HttpServletRequest request) { } // protected for using in unit tests - @SuppressWarnings({ "PMD.UseObjectForClearerAPI", "checkstyle:parameternumber" }) + @SuppressWarnings("PMD.UseObjectForClearerAPI") protected void logEvent( String type, String page, @@ -192,7 +192,6 @@ private String abbreviateUserAgent(String agent) { ); } - // CheckStyle: ignore LineLength for next 1 lines private String abbreviateIfLengthGreaterThan(String text, int maxLength, String fieldName) { if (text == null || text.length() <= maxLength) { return text; diff --git a/src/main/java/ru/mystamps/web/feature/site/SitemapController.java b/src/main/java/ru/mystamps/web/feature/site/SitemapController.java index fc9635f06..489aa4397 100644 --- a/src/main/java/ru/mystamps/web/feature/site/SitemapController.java +++ b/src/main/java/ru/mystamps/web/feature/site/SitemapController.java @@ -75,22 +75,18 @@ public void generateSitemapXml(HttpServletResponse response) { writer.print(INDEX_URL_ENTRY); for (SitemapInfoDto item : collectionService.findAllForSitemap()) { - // CheckStyle: ignore LineLength for next 1 line writer.print(createUrlEntry(dateFormatter, item, CollectionUrl.INFO_COLLECTION_PAGE, "{slug}")); } for (SitemapInfoDto item : seriesService.findAllForSitemap()) { - // CheckStyle: ignore LineLength for next 1 line writer.print(createUrlEntry(dateFormatter, item, SeriesUrl.INFO_SERIES_PAGE, "{id}")); } for (SitemapInfoDto item : categoryService.findAllForSitemap()) { - // CheckStyle: ignore LineLength for next 1 line writer.print(createUrlEntry(dateFormatter, item, SeriesUrl.INFO_CATEGORY_PAGE, "{slug}")); } for (SitemapInfoDto item : countryService.findAllForSitemap()) { - // CheckStyle: ignore LineLength for next 1 line writer.print(createUrlEntry(dateFormatter, item, SeriesUrl.INFO_COUNTRY_PAGE, "{slug}")); } diff --git a/src/main/java/ru/mystamps/web/support/beanvalidation/ImageFileValidator.java b/src/main/java/ru/mystamps/web/support/beanvalidation/ImageFileValidator.java index ea0bb4cf9..d612d8444 100644 --- a/src/main/java/ru/mystamps/web/support/beanvalidation/ImageFileValidator.java +++ b/src/main/java/ru/mystamps/web/support/beanvalidation/ImageFileValidator.java @@ -57,7 +57,6 @@ private static boolean isPng(byte[] bytes) { } private static byte[] readEightBytes(InputStream is) throws IOException { - // CheckStyle: ignore MagicNumber for next 1 line byte[] bytes = new byte[8]; int read = is.read(bytes, 0, bytes.length); if (read != bytes.length) { @@ -68,7 +67,6 @@ private static byte[] readEightBytes(InputStream is) throws IOException { } private static String formatBytes(byte[] bytes) { - // CheckStyle: ignore MagicNumber for next 4 lines return String.format( "%02x %02x %02x %02x %02x %02x %02x %02x", bytes[0], bytes[1], bytes[2], bytes[3], diff --git a/src/main/java/ru/mystamps/web/support/liquibase/LiquibaseSupport.java b/src/main/java/ru/mystamps/web/support/liquibase/LiquibaseSupport.java index 09302e994..a21fffd0b 100644 --- a/src/main/java/ru/mystamps/web/support/liquibase/LiquibaseSupport.java +++ b/src/main/java/ru/mystamps/web/support/liquibase/LiquibaseSupport.java @@ -81,13 +81,11 @@ public static void validate(ApplicationContext context) throws LiquibaseExceptio public static class LiquibaseOnlyStartup { } - // CheckStyle: ignore LineLength for next 2 lines // Partially copy&pasted from: // https://github.com/liquibase/liquibase/blob/v4.7.1/liquibase-core/src/main/java/liquibase/integration/spring/SpringLiquibase.java#L263-L276 // Reason: the original code executes "update" while we need to perform validation private static void performLiquibaseValidate(SpringLiquibase springLiquibase) throws LiquibaseException { - // CheckStyle: ignore LineLength for next 1 line try (Liquibase liquibase = createLiquibase(springLiquibase.getDataSource().getConnection(), springLiquibase)) { validate(liquibase, springLiquibase); } catch (SQLException ex) { @@ -95,7 +93,6 @@ private static void performLiquibaseValidate(SpringLiquibase springLiquibase) } } - // CheckStyle: ignore LineLength for next 2 lines // Partially copy&pasted from: // https://github.com/liquibase/liquibase/blob/v4.7.1/liquibase-core/src/main/java/liquibase/Liquibase.java#L2279-L2283 // Reason: the original method doesn't respect spring.liquibase.contexts @@ -115,7 +112,6 @@ private static void validate(Liquibase liquibase, SpringLiquibase springLiquibas } } - // CheckStyle: ignore LineLength for next 2 lines // Partially copy&pasted from: // https://github.com/liquibase/liquibase/blob/v4.7.1/liquibase-core/src/main/java/liquibase/integration/spring/SpringLiquibase.java#L320-L334 // Reason: the original method is protected @@ -130,7 +126,6 @@ private static Liquibase createLiquibase(Connection conn, SpringLiquibase spring ); } - // CheckStyle: ignore LineLength for next 2 lines // Partially copy&pasted from: // https://github.com/liquibase/liquibase/blob/v4.7.1/liquibase-core/src/main/java/liquibase/integration/spring/SpringLiquibase.java#L344-L380 // Reason: the original method is protected diff --git a/src/main/java/ru/mystamps/web/support/mailgun/ApiMailgunEmailSendingStrategy.java b/src/main/java/ru/mystamps/web/support/mailgun/ApiMailgunEmailSendingStrategy.java index 71b9b1e02..5ee23ed0e 100644 --- a/src/main/java/ru/mystamps/web/support/mailgun/ApiMailgunEmailSendingStrategy.java +++ b/src/main/java/ru/mystamps/web/support/mailgun/ApiMailgunEmailSendingStrategy.java @@ -35,7 +35,6 @@ import javax.mail.internet.InternetAddress; import java.io.UnsupportedEncodingException; -// CheckStyle: ignore LineLength for next 10 lines /** * Sending e-mails with Mailgun service (via HTTP API). * diff --git a/src/main/java/ru/mystamps/web/support/mailgun/MailgunEmailSendingStrategy.java b/src/main/java/ru/mystamps/web/support/mailgun/MailgunEmailSendingStrategy.java index 1311b14de..5777cfdf3 100644 --- a/src/main/java/ru/mystamps/web/support/mailgun/MailgunEmailSendingStrategy.java +++ b/src/main/java/ru/mystamps/web/support/mailgun/MailgunEmailSendingStrategy.java @@ -20,8 +20,6 @@ /** * Sending e-mails with Mailgun service. */ -// Links in javadoc are long -@SuppressWarnings("checkstyle:linelength") public interface MailgunEmailSendingStrategy { /** diff --git a/src/main/java/ru/mystamps/web/support/spring/boot/ApplicationBootstrap.java b/src/main/java/ru/mystamps/web/support/spring/boot/ApplicationBootstrap.java index 8854f65b5..e0fc7a8db 100755 --- a/src/main/java/ru/mystamps/web/support/spring/boot/ApplicationBootstrap.java +++ b/src/main/java/ru/mystamps/web/support/spring/boot/ApplicationBootstrap.java @@ -29,8 +29,7 @@ import ru.mystamps.web.support.liquibase.LiquibaseSupport; // PMD: "All methods are static" here because it's a program entry point. -// CheckStyle: I cannot declare the constructor as private because app won't start. -@SuppressWarnings({ "PMD.UseUtilityClass", "checkstyle:hideutilityclassconstructor" }) +@SuppressWarnings("PMD.UseUtilityClass") public class ApplicationBootstrap { public static void main(String... args) throws LiquibaseException { diff --git a/src/main/java/ru/mystamps/web/support/spring/mvc/BigDecimalConverter.java b/src/main/java/ru/mystamps/web/support/spring/mvc/BigDecimalConverter.java index e4e7e0a15..fbaa81a85 100644 --- a/src/main/java/ru/mystamps/web/support/spring/mvc/BigDecimalConverter.java +++ b/src/main/java/ru/mystamps/web/support/spring/mvc/BigDecimalConverter.java @@ -22,7 +22,6 @@ import java.math.BigDecimal; -// CheckStyle: ignore LineLength for next 2 lines /** * Converter for BigDecimal that correctly parse values with a comma separator (in addition to a point). */ diff --git a/src/main/java/ru/mystamps/web/support/spring/security/Authority.java b/src/main/java/ru/mystamps/web/support/spring/security/Authority.java index 12a9fc638..a9dd9c91c 100644 --- a/src/main/java/ru/mystamps/web/support/spring/security/Authority.java +++ b/src/main/java/ru/mystamps/web/support/spring/security/Authority.java @@ -20,7 +20,6 @@ import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; -@SuppressWarnings("checkstyle:linelength") public final class Authority { // Constants sorted in an ascending order. public static final GrantedAuthority ADD_COMMENTS_TO_SERIES = new SimpleGrantedAuthority(StringAuthority.ADD_COMMENTS_TO_SERIES); diff --git a/src/main/java/ru/mystamps/web/support/spring/security/CustomUserDetailsService.java b/src/main/java/ru/mystamps/web/support/spring/security/CustomUserDetailsService.java index 7b6699bc1..04759f970 100644 --- a/src/main/java/ru/mystamps/web/support/spring/security/CustomUserDetailsService.java +++ b/src/main/java/ru/mystamps/web/support/spring/security/CustomUserDetailsService.java @@ -42,7 +42,6 @@ public class CustomUserDetailsService implements UserDetailsService { private final UserService userService; - // CheckStyle: ignore LineLength for next 3 lines @Override @Transactional(readOnly = true) public org.springframework.security.core.userdetails.UserDetails loadUserByUsername(String login) { diff --git a/src/main/java/ru/mystamps/web/support/spring/security/HasAuthority.java b/src/main/java/ru/mystamps/web/support/spring/security/HasAuthority.java index 8f736333a..7ef309228 100644 --- a/src/main/java/ru/mystamps/web/support/spring/security/HasAuthority.java +++ b/src/main/java/ru/mystamps/web/support/spring/security/HasAuthority.java @@ -17,7 +17,7 @@ */ package ru.mystamps.web.support.spring.security; -@SuppressWarnings({ "checkstyle:linelength", "PMD.AvoidDuplicateLiterals" }) +@SuppressWarnings("PMD.AvoidDuplicateLiterals") public final class HasAuthority { // Constants sorted in an ascending order. public static final String ADD_COMMENTS_TO_SERIES = "hasAuthority('" + StringAuthority.ADD_COMMENTS_TO_SERIES + "')"; diff --git a/src/main/java/ru/mystamps/web/support/spring/security/SecurityConfig.java b/src/main/java/ru/mystamps/web/support/spring/security/SecurityConfig.java index c6d84df8a..2e30e81cd 100644 --- a/src/main/java/ru/mystamps/web/support/spring/security/SecurityConfig.java +++ b/src/main/java/ru/mystamps/web/support/spring/security/SecurityConfig.java @@ -33,12 +33,10 @@ import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.dao.DaoAuthenticationProvider; import org.springframework.security.authentication.event.AuthenticationFailureBadCredentialsEvent; -// CheckStyle: ignore LineLength for next 1 line import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -// CheckStyle: ignore LineLength for next 1 line import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; @@ -84,7 +82,7 @@ public void configure(WebSecurity web) throws Exception { } @Override - @SuppressWarnings({ "PMD.SignatureDeclareThrowsException", "checkstyle:linelength" }) + @SuppressWarnings("PMD.SignatureDeclareThrowsException") protected void configure(HttpSecurity http) throws Exception { Profiles prod = Profiles.of("prod"); boolean useSingleHost = !environment.acceptsProfiles(prod); @@ -232,7 +230,6 @@ public FilterRegistrationBean userMdcLoggingFilter() { new FilterRegistrationBean<>(new UserMdcLoggingFilter()); // the filters that need to include userId in their logs, should have the order grater than // Ordered.LOWEST_PRECEDENCE - 100 to get applied after us - // CheckStyle: ignore MagicNumber for next 1 line bean.setOrder(Ordered.LOWEST_PRECEDENCE - 100); return bean; } diff --git a/src/main/scripts/execute-command.sh b/src/main/scripts/execute-command.sh index b01199761..20f57f802 100755 --- a/src/main/scripts/execute-command.sh +++ b/src/main/scripts/execute-command.sh @@ -19,12 +19,6 @@ case ${1:-} in --batch-mode \ license:check ;; - 'checkstyle') - exec "$MVN" \ - --batch-mode \ - checkstyle:check \ - -Dcheckstyle.violationSeverity=warning - ;; 'enforcer') exec "$MVN" \ --batch-mode \ @@ -71,7 +65,6 @@ case ${1:-} in echo >&2 echo >&2 "Where is one of:" echo >&2 '- check-license' - echo >&2 '- checkstyle' echo >&2 '- enforcer' echo >&2 '- integration-tests' echo >&2 '- jest' diff --git a/src/test/java/ru/mystamps/web/feature/category/JdbcCategoryDaoTest.java b/src/test/java/ru/mystamps/web/feature/category/JdbcCategoryDaoTest.java index 989bef6f0..cc211be0e 100644 --- a/src/test/java/ru/mystamps/web/feature/category/JdbcCategoryDaoTest.java +++ b/src/test/java/ru/mystamps/web/feature/category/JdbcCategoryDaoTest.java @@ -67,7 +67,6 @@ public void getStatisticsOfWithEmptyCollection() { "/db/series-3-sport-qty7.sql" }, statements = { - // CheckStyle: ignore LineLength for next 1 line "INSERT INTO collections_series(collection_id, series_id, number_of_stamps, added_at) VALUES" + " (1, 1, 5, CURRENT_TIMESTAMP())" + ", (1, 2, 3, CURRENT_TIMESTAMP())" diff --git a/src/test/java/ru/mystamps/web/feature/country/JdbcCountryDaoTest.java b/src/test/java/ru/mystamps/web/feature/country/JdbcCountryDaoTest.java index 8179116b7..16defa115 100644 --- a/src/test/java/ru/mystamps/web/feature/country/JdbcCountryDaoTest.java +++ b/src/test/java/ru/mystamps/web/feature/country/JdbcCountryDaoTest.java @@ -68,7 +68,6 @@ public void countCountriesOfCollectionWithEmptyCollection() { "/db/series-6-france-qty6.sql" }, statements = { - // CheckStyle: ignore LineLength for next 1 line "INSERT INTO collections_series(collection_id, series_id, number_of_stamps, added_at) VALUES" + " (1, 4, 5, CURRENT_TIMESTAMP())" + ", (1, 5, 4, CURRENT_TIMESTAMP())" @@ -93,7 +92,6 @@ public void countCountriesOfCollectionWithMultipleSeriesFromEachCountry() { "/db/series-3-sport-qty7.sql" }, statements = { - // CheckStyle: ignore LineLength for next 1 line "INSERT INTO collections_series(collection_id, series_id, number_of_stamps, added_at) VALUES" + " (1, 2, 3, CURRENT_TIMESTAMP())" + ", (1, 3, 7, CURRENT_TIMESTAMP())" @@ -137,7 +135,6 @@ public void getStatisticsOfWithEmptyCollection() { "/db/series-6-france-qty6.sql" }, statements = { - // CheckStyle: ignore LineLength for next 1 line "INSERT INTO collections_series(collection_id, series_id, number_of_stamps, added_at) VALUES" + " (1, 4, 5, CURRENT_TIMESTAMP())" + ", (1, 5, 4, CURRENT_TIMESTAMP())" diff --git a/src/test/java/ru/mystamps/web/service/TestObjects.java b/src/test/java/ru/mystamps/web/service/TestObjects.java index 0c7dbd54a..db5067e2d 100644 --- a/src/test/java/ru/mystamps/web/service/TestObjects.java +++ b/src/test/java/ru/mystamps/web/service/TestObjects.java @@ -81,7 +81,6 @@ public final class TestObjects { private static final String TEST_ENTITY_NAME = TEST_NAME; private static final String TEST_ENTITY_SLUG = "test-slug"; - // CheckStyle: ignore LineLength for next 1 line private static final String TEST_HASH = "$2a$10$Oo8A/oaKQYwt4Zi1RWGir.HHziCG267CJaqaNaNUtE/8ceysZn0za"; private TestObjects() { @@ -140,7 +139,6 @@ public static SitemapInfoDto createSitemapInfoDto() { return new SitemapInfoDto(String.valueOf(Random.id()), Random.date()); } - @SuppressWarnings("checkstyle:magicnumber") public static SeriesInfoDto createSeriesInfoDto() { String category = Random.categoryName(); String country = Random.countryName();