Skip to content

Commit cb0d680

Browse files
committed
ci: decomission of PMD
The following issue won't be fixed: Closes #195 Closes #261 Closes #1018 Closes #1250 Closes #1646 Part of #1669
1 parent 0248534 commit cb0d680

File tree

91 files changed

+23
-528
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+23
-528
lines changed

.github/workflows/static-analysis.yml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,6 @@ defaults:
1616

1717
jobs:
1818

19-
run-pmd:
20-
name: Run PMD
21-
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on
22-
runs-on: ubuntu-20.04
23-
steps:
24-
- name: Clone source code
25-
uses: actions/[email protected] # https://github.com/actions/checkout
26-
with:
27-
# Whether to configure the token or SSH key with the local git config. Default: true
28-
persist-credentials: false
29-
- name: Install JDK
30-
uses: actions/[email protected] # https://github.com/actions/setup-java
31-
with:
32-
distribution: 'adopt' # https://github.com/actions/setup-java#supported-distributions
33-
java-version: '8' # https://github.com/actions/setup-java#supported-version-syntax
34-
- name: Restore existing cache
35-
uses: actions/[email protected] # https://github.com/actions/cache
36-
with:
37-
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#input-parameters-for-the-cache-action
38-
key: maven-repository-${{ hashFiles('pom.xml') }}
39-
path: ~/.m2/repository
40-
restore-keys: maven-repository-
41-
- name: Run PMD
42-
run: ./src/main/scripts/execute-command.sh pmd
43-
4419
check-license:
4520
name: Check license in file headers
4621
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on

pom.xml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,6 @@
644644

645645
<native2ascii.plugin.version>2.0.1</native2ascii.plugin.version>
646646
<nodejs.version>v10.16.0</nodejs.version>
647-
<pmd.plugin.version>3.12.0</pmd.plugin.version>
648647

649648
<!-- Redefine default value from spring-boot-dependencies -->
650649
<postgresql.version>9.4.1212.jre7</postgresql.version>
@@ -912,20 +911,6 @@
912911
</configuration>
913912
</plugin>
914913

915-
<plugin>
916-
<groupId>org.apache.maven.plugins</groupId>
917-
<artifactId>maven-pmd-plugin</artifactId>
918-
<version>${pmd.plugin.version}</version>
919-
<configuration>
920-
<linkXRef>false</linkXRef>
921-
<verbose>true</verbose>
922-
<targetJdk>${java.version}</targetJdk>
923-
<rulesets>
924-
<ruleset>${basedir}/src/main/config/pmd.xml</ruleset>
925-
</rulesets>
926-
</configuration>
927-
</plugin>
928-
929914
<plugin>
930915
<groupId>org.apache.maven.plugins</groupId>
931916
<artifactId>maven-resources-plugin</artifactId>

src/main/config/pmd.xml

Lines changed: 0 additions & 323 deletions
This file was deleted.

src/main/java/ru/mystamps/web/common/JdbcUtils.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ private JdbcUtils() {
2828
}
2929

3030
// @see https://stackoverflow.com/q/2920364/checking-for-a-null-int-value-from-a-java-resultset
31-
@SuppressWarnings("PMD.PrematureDeclaration")
3231
public static Integer getInteger(ResultSet resultSet, String fieldName) throws SQLException {
3332
int value = resultSet.getInt(fieldName);
3433
if (resultSet.wasNull()) {
@@ -38,7 +37,6 @@ public static Integer getInteger(ResultSet resultSet, String fieldName) throws S
3837
return Integer.valueOf(value);
3938
}
4039

41-
@SuppressWarnings("PMD.PrematureDeclaration")
4240
public static Boolean getBoolean(ResultSet resultSet, String fieldName) throws SQLException {
4341
boolean value = resultSet.getBoolean(fieldName);
4442
if (resultSet.wasNull()) {
@@ -51,7 +49,6 @@ public static Boolean getBoolean(ResultSet resultSet, String fieldName) throws S
5149
/**
5250
* @author Sergey Chechenev
5351
*/
54-
@SuppressWarnings("PMD.PrematureDeclaration")
5552
public static Currency getCurrency(ResultSet resultSet, String fieldName) throws SQLException {
5653
String value = resultSet.getString(fieldName);
5754
if (resultSet.wasNull()) {

src/main/java/ru/mystamps/web/common/Pager.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
import java.util.Collections;
2626
import java.util.List;
2727

28-
// yes, I know that it's too complex :-(
29-
@SuppressWarnings("PMD.ModifiedCyclomaticComplexity")
3028
@ToString
3129
public class Pager {
3230
// be very careful when you're changing this value
@@ -41,15 +39,12 @@ public class Pager {
4139
private static final int FIRST_PAGE = 1;
4240

4341
// this field is shown in toString() and useful when debugging unit tests
44-
@SuppressWarnings("PMD.SingularField")
4542
private final int totalRecords;
4643

4744
// this field is shown in toString() and useful when debugging unit tests
48-
@SuppressWarnings("PMD.SingularField")
4945
private final int totalPages;
5046

5147
// this field is shown in toString() and useful when debugging unit tests
52-
@SuppressWarnings({ "PMD.SingularField", "PMD.UnusedPrivateField" })
5348
private final int recordsPerPage;
5449

5550
// this field is using in the view (hence its getter)
@@ -106,8 +101,6 @@ private static Integer findNext(int currentPage, int totalPages) {
106101
return Integer.valueOf(currentPage + 1);
107102
}
108103

109-
// I hope that we'll fix these one day
110-
@SuppressWarnings("PMD.NPathComplexity")
111104
private static List<Integer> createItems(
112105
int totalRecords,
113106
int recordsPerPage,

src/main/java/ru/mystamps/web/feature/account/AccountDb.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818
package ru.mystamps.web.feature.account;
1919

20-
@SuppressWarnings("PMD.CommentDefaultAccessModifier")
2120
final class AccountDb {
2221

2322
static final class UsersActivation {

src/main/java/ru/mystamps/web/feature/account/AccountUrl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
*
2727
* @author Slava Semushin
2828
*/
29-
@SuppressWarnings("PMD.CommentDefaultAccessModifier")
3029
public final class AccountUrl {
3130

3231
public static final String REGISTRATION_PAGE = "/account/register";

src/main/java/ru/mystamps/web/feature/account/AccountValidation.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@
2020
import ru.mystamps.web.feature.account.AccountDb.User;
2121
import ru.mystamps.web.feature.account.AccountDb.UsersActivation;
2222

23-
@SuppressWarnings("PMD.CommentDefaultAccessModifier")
2423
public final class AccountValidation {
2524

2625
public static final int LOGIN_MIN_LENGTH = 2;
2726
public static final int LOGIN_MAX_LENGTH = User.LOGIN_LENGTH;
2827
static final String LOGIN_REGEXP = "[-_\\.a-zA-Z0-9]+";
29-
@SuppressWarnings("PMD.LongVariable")
3028
static final String LOGIN_NO_REPEATING_CHARS_REGEXP = "(?!.+[-_.]{2,}).+";
3129

3230
static final int NAME_MAX_LENGTH = User.NAME_LENGTH;

src/main/java/ru/mystamps/web/feature/account/JdbcUsersActivationDao.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import java.util.List;
2828
import java.util.Map;
2929

30-
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
3130
public class JdbcUsersActivationDao implements UsersActivationDao {
3231

3332
private final NamedParameterJdbcTemplate jdbcTemplate;

src/main/java/ru/mystamps/web/feature/category/ApiCategoryService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
/**
3535
* Implementation that delegates calls to a category service.
3636
*/
37-
@SuppressWarnings("PMD.TooManyMethods")
3837
public class ApiCategoryService implements CategoryService {
3938

4039
private static final Logger LOG = LoggerFactory.getLogger(ApiCategoryService.class);

src/main/java/ru/mystamps/web/feature/category/CategoryDao.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import java.util.List;
2626
import java.util.Map;
2727

28-
@SuppressWarnings("PMD.TooManyMethods")
2928
public interface CategoryDao {
3029
Integer add(AddCategoryDbDto category);
3130
long countAll();

src/main/java/ru/mystamps/web/feature/category/CategoryDb.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818
package ru.mystamps.web.feature.category;
1919

20-
@SuppressWarnings("PMD.CommentDefaultAccessModifier")
2120
final class CategoryDb {
2221

2322
static final class Category {

src/main/java/ru/mystamps/web/feature/category/CategoryService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import java.util.List;
2626
import java.util.Map;
2727

28-
@SuppressWarnings("PMD.TooManyMethods")
2928
public interface CategoryService {
3029
String add(AddCategoryDto dto, Integer userId);
3130
List<Integer> findIdsByNames(List<String> names);

src/main/java/ru/mystamps/web/feature/category/CategoryServiceImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import java.util.Map;
3838
import java.util.stream.Collectors;
3939

40-
@SuppressWarnings("PMD.TooManyMethods")
4140
@RequiredArgsConstructor
4241
public class CategoryServiceImpl implements CategoryService {
4342

src/main/java/ru/mystamps/web/feature/category/CategoryUrl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
*
2727
* @author Slava Semushin
2828
*/
29-
@SuppressWarnings("PMD.CommentDefaultAccessModifier")
3029
public final class CategoryUrl {
3130

3231
public static final String SUGGEST_SERIES_CATEGORY = "/suggest/series_category";

src/main/java/ru/mystamps/web/feature/category/CategoryValidation.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@
1919

2020
import ru.mystamps.web.feature.category.CategoryDb.Category;
2121

22-
@SuppressWarnings("PMD.CommentDefaultAccessModifier")
2322
public final class CategoryValidation {
2423

2524
public static final int NAME_MIN_LENGTH = 3;
2625
public static final int NAME_MAX_LENGTH = Category.NAME_LENGTH;
2726
public static final String NAME_EN_REGEXP = "[- a-zA-Z]+";
2827
public static final String NAME_RU_REGEXP = "[- а-яёА-ЯЁ]+";
2928
static final String NAME_NO_HYPHEN_REGEXP = "[ \\p{L}]([- \\p{L}]+[ \\p{L}])*";
30-
@SuppressWarnings("PMD.LongVariable")
3129
static final String NAME_NO_REPEATING_HYPHENS_REGEXP = "(?!.+[-]{2,}).+";
3230

3331
private CategoryValidation() {

src/main/java/ru/mystamps/web/feature/category/JdbcCategoryDao.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import java.util.List;
3939
import java.util.Map;
4040

41-
@SuppressWarnings({ "PMD.AvoidDuplicateLiterals", "PMD.TooManyMethods", "PMD.TooManyFields" })
4241
public class JdbcCategoryDao implements CategoryDao {
4342

4443
private static final ResultSetExtractor<Map<String, Integer>> NAME_COUNTER_EXTRACTOR =
@@ -59,9 +58,7 @@ public class JdbcCategoryDao implements CategoryDao {
5958
private final String findCategoriesNamesWithSlugSql;
6059
private final String findAllForSitemapSql;
6160
private final String findLinkEntityBySlugSql;
62-
@SuppressWarnings("PMD.LongVariable")
6361
private final String findCategoriesWithParentNamesSql;
64-
@SuppressWarnings("PMD.LongVariable")
6562
private final String findFromLastCreatedSeriesByUserSql;
6663

6764
public JdbcCategoryDao(Environment env, NamedParameterJdbcTemplate jdbcTemplate) {

src/main/java/ru/mystamps/web/feature/category/TogglzWithFallbackCategoryService.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
* @see CategoryServiceImpl
4141
*/
4242
@RequiredArgsConstructor
43-
@SuppressWarnings("PMD.TooManyMethods")
4443
public class TogglzWithFallbackCategoryService implements CategoryService {
4544

4645
private static final Logger LOG =
@@ -185,7 +184,7 @@ private static <T> T executeOneOf(Callable<T> firstImpl, Callable<T> defaultImpl
185184
} catch (UnsupportedOperationException ignored) {
186185
// the method isn't yet implemented, fallback to the default implementation
187186

188-
} catch (RuntimeException e) { // NOPMD: AvoidCatchingGenericException; catch-all
187+
} catch (RuntimeException e) {
189188
LOG.warn(
190189
"Failed to call a category service. Fallback to default implementation",
191190
e
@@ -194,8 +193,8 @@ private static <T> T executeOneOf(Callable<T> firstImpl, Callable<T> defaultImpl
194193
}
195194
return defaultImpl.call();
196195

197-
} catch (Exception ex) { // NOPMD: AvoidCatchingGenericException; try to catch-all
198-
throw new RuntimeException(ex); // NOPMD: AvoidThrowingRawExceptionTypes
196+
} catch (Exception ex) {
197+
throw new RuntimeException(ex);
199198
}
200199
}
201200

src/main/java/ru/mystamps/web/feature/category/UniqueCategoryNameValidator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public void initialize(UniqueCategoryName annotation) {
3737
}
3838

3939
@Override
40-
@SuppressWarnings("PMD.SimplifyBooleanReturns")
4140
public boolean isValid(String value, ConstraintValidatorContext ctx) {
4241

4342
if (value == null) {

src/main/java/ru/mystamps/web/feature/collection/CollectionDao.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.util.List;
2525
import java.util.Map;
2626

27-
@SuppressWarnings("PMD.TooManyMethods")
2827
public interface CollectionDao {
2928
List<LinkEntityDto> findLastCreated(int quantity);
3029
List<SeriesInCollectionDto> findSeriesByCollectionId(Integer collectionId, String lang);

src/main/java/ru/mystamps/web/feature/collection/CollectionService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.util.List;
2525
import java.util.Map;
2626

27-
@SuppressWarnings("PMD.TooManyMethods")
2827
public interface CollectionService {
2928
void createCollection(Integer ownerId, String ownerLogin);
3029
void addToCollection(Integer userId, AddToCollectionDto dto);

src/main/java/ru/mystamps/web/feature/collection/CollectionServiceImpl.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@
3333
import java.util.Map;
3434

3535
@RequiredArgsConstructor
36-
@SuppressWarnings({
37-
"PMD.TooManyMethods",
38-
// complains on "Series id must be non null"
39-
"PMD.AvoidDuplicateLiterals"
40-
})
4136
public class CollectionServiceImpl implements CollectionService {
4237

4338
private final Logger log;

src/main/java/ru/mystamps/web/feature/collection/JdbcCollectionDao.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import java.util.List;
3939
import java.util.Map;
4040

41-
@SuppressWarnings({ "PMD.AvoidDuplicateLiterals", "PMD.TooManyMethods", "PMD.TooManyFields" })
4241
public class JdbcCollectionDao implements CollectionDao {
4342
private static final Logger LOG = LoggerFactory.getLogger(JdbcCollectionDao.class);
4443

@@ -269,7 +268,6 @@ public Integer addSeriesToUserCollection(AddToCollectionDbDto dto) {
269268
return holder.getKey().intValue();
270269
}
271270

272-
@SuppressWarnings("PMD.AvoidLiteralsInIfCondition")
273271
@Override
274272
public void removeSeriesFromUserCollection(Integer userId, Integer seriesInstanceId) {
275273
Map<String, Object> params = new HashMap<>();

src/main/java/ru/mystamps/web/feature/country/ApiCountryService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
/**
3434
* Implementation that delegates calls to a country service.
3535
*/
36-
@SuppressWarnings("PMD.TooManyMethods")
3736
public class ApiCountryService implements CountryService {
3837

3938
private static final Logger LOG = LoggerFactory.getLogger(ApiCountryService.class);

src/main/java/ru/mystamps/web/feature/country/CountryDao.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.util.List;
2525
import java.util.Map;
2626

27-
@SuppressWarnings("PMD.TooManyMethods")
2827
public interface CountryDao {
2928
Integer add(AddCountryDbDto country);
3029
long countAll();

src/main/java/ru/mystamps/web/feature/country/CountryDb.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818
package ru.mystamps.web.feature.country;
1919

20-
@SuppressWarnings("PMD.CommentDefaultAccessModifier")
2120
final class CountryDb {
2221

2322
static final class Country {

src/main/java/ru/mystamps/web/feature/country/CountryService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.util.List;
2525
import java.util.Map;
2626

27-
@SuppressWarnings("PMD.TooManyMethods")
2827
public interface CountryService {
2928
String add(AddCountryDto dto, Integer userId);
3029
List<Integer> findIdsByNames(List<String> names);

src/main/java/ru/mystamps/web/feature/country/CountryServiceImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import java.util.stream.Collectors;
3838

3939
@RequiredArgsConstructor
40-
@SuppressWarnings("PMD.TooManyMethods")
4140
public class CountryServiceImpl implements CountryService {
4241

4342
private final Logger log;

src/main/java/ru/mystamps/web/feature/country/CountryUrl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
*
2727
* @author Slava Semushin
2828
*/
29-
@SuppressWarnings("PMD.CommentDefaultAccessModifier")
3029
public final class CountryUrl {
3130

3231
public static final String SUGGEST_SERIES_COUNTRY = "/suggest/series_country";

src/main/java/ru/mystamps/web/feature/country/CountryValidation.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@
1919

2020
import ru.mystamps.web.feature.country.CountryDb.Country;
2121

22-
@SuppressWarnings("PMD.CommentDefaultAccessModifier")
2322
public final class CountryValidation {
2423

2524
public static final int NAME_MIN_LENGTH = 3;
2625
public static final int NAME_MAX_LENGTH = Country.NAME_LENGTH;
2726
public static final String NAME_EN_REGEXP = "[- a-zA-Z]+";
2827
public static final String NAME_RU_REGEXP = "[- а-яёА-ЯЁ]+";
2928
static final String NAME_NO_HYPHEN_REGEXP = "[ \\p{L}]([- \\p{L}]+[ \\p{L}])*";
30-
@SuppressWarnings("PMD.LongVariable")
3129
static final String NAME_NO_REPEATING_HYPHENS_REGEXP = "(?!.+[-]{2,}).+";
3230

3331
private CountryValidation() {

0 commit comments

Comments
 (0)