Skip to content

Commit d4fed8c

Browse files
committed
ci: decomission of CodeNarc
The following issue won't be fixed: Closes #508 Closes #539 Closes #994 Closes #1187 Part of #1669
1 parent 3706257 commit d4fed8c

27 files changed

+0
-274
lines changed

.github/workflows/static-analysis.yml

-32
Original file line numberDiff line numberDiff line change
@@ -146,38 +146,6 @@ jobs:
146146
- name: Run maven-enforcer-plugin
147147
run: ./src/main/scripts/execute-command.sh enforcer
148148

149-
run-codenarc:
150-
name: Run CodeNarc
151-
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on
152-
runs-on: ubuntu-20.04
153-
steps:
154-
- name: Clone source code
155-
uses: actions/[email protected] # https://github.com/actions/checkout
156-
with:
157-
# Whether to configure the token or SSH key with the local git config. Default: true
158-
persist-credentials: false
159-
- name: Install JDK
160-
uses: actions/[email protected] # https://github.com/actions/setup-java
161-
with:
162-
distribution: 'adopt' # https://github.com/actions/setup-java#supported-distributions
163-
java-version: '8' # https://github.com/actions/setup-java#supported-version-syntax
164-
- name: Restore existing cache
165-
uses: actions/[email protected] # https://github.com/actions/cache
166-
with:
167-
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#input-parameters-for-the-cache-action
168-
key: maven-repository-${{ hashFiles('pom.xml') }}
169-
path: ~/.m2/repository
170-
restore-keys: maven-repository-
171-
- name: Compile sources
172-
run: >-
173-
mvn \
174-
--batch-mode \
175-
-Denforcer.skip=true \
176-
-DskipMinify \
177-
compile
178-
- name: Run CodeNarc
179-
run: ./src/main/scripts/execute-command.sh codenarc
180-
181149
run-spotbugs:
182150
name: Run SpotBugs
183151
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on

pom.xml

-24
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,6 @@
571571
<cglib.version>2.2.2</cglib.version>
572572
<checkstyle.plugin.version>2.17</checkstyle.plugin.version>
573573
<clean.plugin.version>3.0.0</clean.plugin.version>
574-
<codenarc.plugin.version>0.22-1</codenarc.plugin.version>
575-
<codenarc.version>0.27.0</codenarc.version>
576574

577575
<!-- Redefine default value from spring-boot-dependencies -->
578576
<commons-lang3.version>3.14.0</commons-lang3.version>
@@ -1026,28 +1024,6 @@
10261024
</executions>
10271025
</plugin>
10281026

1029-
<!--
1030-
Usage:
1031-
./mvnw codenarc:codenarc (checks the sources and generates report in target/site/codenarc.html)
1032-
-->
1033-
<plugin>
1034-
<groupId>org.codehaus.mojo</groupId>
1035-
<artifactId>codenarc-maven-plugin</artifactId>
1036-
<version>${codenarc.plugin.version}</version>
1037-
<configuration>
1038-
<codeNarcVersion>${codenarc.version}</codeNarcVersion>
1039-
<groovyVersion>${groovy-old.version}</groovyVersion>
1040-
<sourceDirectory>src/test/groovy</sourceDirectory>
1041-
<!--
1042-
rulesets/enhanced.xml was excluded because of a lot of errors about failed
1043-
compilation: https://github.com/CodeNarc/CodeNarc/issues/123
1044-
-->
1045-
<rulesetfiles>
1046-
rulesets/basic.xml,rulesets/braces.xml,rulesets/concurrency.xml,rulesets/convention.xml,rulesets/design.xml,rulesets/dry.xml,rulesets/exceptions.xml,rulesets/formatting.xml,rulesets/generic.xml,rulesets/groovyism.xml,rulesets/imports.xml,rulesets/jdbc.xml,rulesets/logging.xml,rulesets/naming.xml,rulesets/security.xml,rulesets/serialization.xml,rulesets/unnecessary.xml,rulesets/unused.xml
1047-
</rulesetfiles>
1048-
</configuration>
1049-
</plugin>
1050-
10511027
<plugin>
10521028
<groupId>org.jacoco</groupId>
10531029
<artifactId>jacoco-maven-plugin</artifactId>

src/main/scripts/execute-command.sh

-9
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@ case ${1:-} in
3333
checkstyle:check \
3434
-Dcheckstyle.violationSeverity=warning
3535
;;
36-
'codenarc')
37-
exec "$MVN" \
38-
--batch-mode \
39-
codenarc:codenarc \
40-
-Dcodenarc.maxPriority1Violations=0 \
41-
-Dcodenarc.maxPriority2Violations=0 \
42-
-Dcodenarc.maxPriority3Violations=0
43-
;;
4436
'enforcer')
4537
exec "$MVN" \
4638
--batch-mode \
@@ -99,7 +91,6 @@ case ${1:-} in
9991
echo >&2 '- ansible-lint'
10092
echo >&2 '- check-license'
10193
echo >&2 '- checkstyle'
102-
echo >&2 '- codenarc'
10394
echo >&2 '- enforcer'
10495
echo >&2 '- integration-tests'
10596
echo >&2 '- jest'

src/test/groovy/ru/mystamps/web/common/LocaleUtilsTest.groovy

-3
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ package ru.mystamps.web.common
2020
import spock.lang.Specification
2121
import spock.lang.Unroll
2222

23-
@SuppressWarnings(['ClassJavadoc', 'MethodName', 'NoDef', 'NoTabCharacter', 'TrailingWhitespace'])
2423
class LocaleUtilsTest extends Specification {
2524

2625
//
2726
// Tests for getLanguageOrNull()
2827
//
2928

3029
@Unroll
31-
@SuppressWarnings('UnnecessaryBooleanExpression') // false positive
3230
def "getLanguageOrNull() should extract language '#language' from locale '#locale'"(Locale locale, String language) {
3331
when:
3432
String result = LocaleUtils.getLanguageOrNull(locale)
@@ -46,7 +44,6 @@ class LocaleUtilsTest extends Specification {
4644
//
4745

4846
@Unroll
49-
@SuppressWarnings(['LineLength', /* false positive: */ 'UnnecessaryBooleanExpression'])
5047
def "getLanguageOrDefault() should return '#expected' for #locale/#value"(Locale locale, String value, String expected) {
5148
when:
5249
String result = LocaleUtils.getLanguageOrDefault(locale, value)

src/test/groovy/ru/mystamps/web/common/PagerTest.groovy

-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ package ru.mystamps.web.common
2020
import spock.lang.Specification
2121
import spock.lang.Unroll
2222

23-
@SuppressWarnings(['ClassJavadoc', 'MethodName', 'NoDef', 'NoTabCharacter', 'TrailingWhitespace'])
2423
class PagerTest extends Specification {
2524

2625
//
@@ -195,7 +194,6 @@ class PagerTest extends Specification {
195194
//
196195

197196
@Unroll
198-
@SuppressWarnings('UnnecessaryBooleanExpression') // false positive
199197
def "getPrev() should return #prev for when page = #currentPage"(int currentPage, Integer prev) {
200198
when:
201199
Pager pager = new Pager(3, 1, currentPage)
@@ -213,7 +211,6 @@ class PagerTest extends Specification {
213211
//
214212

215213
@Unroll
216-
@SuppressWarnings('UnnecessaryBooleanExpression') // false positive
217214
def "getNext() should return #next for when page = #currentPage"(int currentPage, Integer next) {
218215
when:
219216
Pager pager = new Pager(3, 1, currentPage)

src/test/groovy/ru/mystamps/web/common/SlugUtilsTest.groovy

-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ package ru.mystamps.web.common
2020
import spock.lang.Specification
2121
import spock.lang.Unroll
2222

23-
@SuppressWarnings(['ClassJavadoc', 'MethodName', 'NoDef', 'NoTabCharacter', 'TrailingWhitespace'])
2423
class SlugUtilsTest extends Specification {
2524

2625
//
@@ -36,7 +35,6 @@ class SlugUtilsTest extends Specification {
3635
}
3736

3837
@Unroll
39-
@SuppressWarnings('UnnecessaryBooleanExpression') // false positive
4038
def "slugify() should transform text '#input' to '#output'"(String input, String output) {
4139
when:
4240
String result = SlugUtils.slugify(input)

src/test/groovy/ru/mystamps/web/feature/account/UserServiceImplTest.groovy

-13
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import ru.mystamps.web.tests.DateUtils
2525
import ru.mystamps.web.tests.Random
2626
import spock.lang.Specification
2727

28-
@SuppressWarnings(['ClassJavadoc', 'MethodName', 'NoDef', 'NoTabCharacter', 'TrailingWhitespace'])
2928
class UserServiceImplTest extends Specification {
3029

3130
private final UserDao userDao = Mock()
@@ -78,7 +77,6 @@ class UserServiceImplTest extends Specification {
7877
1 * userDao.add(_ as AddUserDbDto) >> Random.userId()
7978
}
8079

81-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
8280
def "registerUser() should delete registration request"() {
8381
given:
8482
String expectedActivationKey = activationForm.activationKey
@@ -114,7 +112,6 @@ class UserServiceImplTest extends Specification {
114112
0 * usersActivationService.remove(_ as String)
115113
}
116114

117-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
118115
def "registerUser() should pass name to dao"() {
119116
given:
120117
String expectedUserName = activationForm.name
@@ -127,7 +124,6 @@ class UserServiceImplTest extends Specification {
127124
}) >> Random.userId()
128125
}
129126

130-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
131127
def "registerUser() should pass login instead of name when name is null"() {
132128
given:
133129
String expectedUserLogin = activationForm.login
@@ -141,7 +137,6 @@ class UserServiceImplTest extends Specification {
141137
}) >> Random.userId()
142138
}
143139

144-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
145140
def "registerUser() should pass login instead of name when name is empty"() {
146141
given:
147142
String expectedUserLogin = activationForm.login
@@ -156,7 +151,6 @@ class UserServiceImplTest extends Specification {
156151
}) >> Random.userId()
157152
}
158153

159-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
160154
def "registerUser() should fill role field"() {
161155
when:
162156
service.registerUser(activationForm)
@@ -167,7 +161,6 @@ class UserServiceImplTest extends Specification {
167161
}) >> Random.userId()
168162
}
169163

170-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
171164
def "registerUser() should use email from registration request"() {
172165
given:
173166
UsersActivationDto activation = new UsersActivationDto('[email protected]', new Date())
@@ -182,7 +175,6 @@ class UserServiceImplTest extends Specification {
182175
}) >> Random.userId()
183176
}
184177

185-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
186178
def "registerUser() should use registration date from registration request"() {
187179
given:
188180
UsersActivationDto activation = new UsersActivationDto(TestObjects.TEST_EMAIL, new Date(86, 8, 12))
@@ -207,7 +199,6 @@ class UserServiceImplTest extends Specification {
207199
ex.message == 'Password must be non null'
208200
}
209201

210-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
211202
def "registerUser() should gets hash from encoder"() {
212203
given:
213204
String expectedHash = TestObjects.createAddUserDbDto().hash
@@ -245,7 +236,6 @@ class UserServiceImplTest extends Specification {
245236
ex.message == 'Login must be non null'
246237
}
247238

248-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
249239
def "registerUser() should pass login to dao"() {
250240
given:
251241
String expectedUserLogin = activationForm.login
@@ -258,7 +248,6 @@ class UserServiceImplTest extends Specification {
258248
}) >> Random.userId()
259249
}
260250

261-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
262251
def "registerUser() should assign activated at to current date"() {
263252
when:
264253
service.registerUser(activationForm)
@@ -269,7 +258,6 @@ class UserServiceImplTest extends Specification {
269258
}) >> Random.userId()
270259
}
271260

272-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
273261
def "registerUser() should create collection for user"() {
274262
given:
275263
Integer expectedId = 909
@@ -357,7 +345,6 @@ class UserServiceImplTest extends Specification {
357345
ex.message == 'Date must be non null'
358346
}
359347

360-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
361348
def "countRegisteredSince() should invoke dao, pass argument and return result from dao"() {
362349
given:
363350
Date expectedDate = new Date()

src/test/groovy/ru/mystamps/web/feature/account/UsersActivationServiceImplTest.groovy

-13
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import ru.mystamps.web.tests.DateUtils
2424
import spock.lang.Specification
2525
import spock.lang.Unroll
2626

27-
@SuppressWarnings(['ClassJavadoc', 'MethodName', 'NoDef', 'NoTabCharacter', 'TrailingWhitespace'])
2827
class UsersActivationServiceImplTest extends Specification {
2928

3029
private final UsersActivationDao usersActivationDao = Mock()
@@ -61,7 +60,6 @@ class UsersActivationServiceImplTest extends Specification {
6160
1 * usersActivationDao.add(_ as AddUsersActivationDbDto)
6261
}
6362

64-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
6563
def "add() should generate activation key"() {
6664
when:
6765
service.add(registrationForm, ANY_LOCALE)
@@ -73,7 +71,6 @@ class UsersActivationServiceImplTest extends Specification {
7371
})
7472
}
7573

76-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
7774
def "add() should generate unique activation key"() {
7875
given:
7976
List<String> passedArguments = []
@@ -107,7 +104,6 @@ class UsersActivationServiceImplTest extends Specification {
107104
ex.message == 'Email must be non null'
108105
}
109106

110-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
111107
def "add() should pass email to dao"() {
112108
given:
113109
String expectedEmail = '[email protected]'
@@ -122,11 +118,6 @@ class UsersActivationServiceImplTest extends Specification {
122118
}
123119

124120
@Unroll
125-
@SuppressWarnings([
126-
'ClosureAsLastMethodParameter',
127-
'UnnecessaryReturnKeyword',
128-
/* false positive: */ 'UnnecessaryBooleanExpression',
129-
])
130121
def "add() should pass language '#expectedLang' to dao"(Locale lang, String expectedLang) {
131122
when:
132123
service.add(registrationForm, lang)
@@ -141,7 +132,6 @@ class UsersActivationServiceImplTest extends Specification {
141132
Locale.FRENCH || 'fr'
142133
}
143134

144-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
145135
def "add() should assign created at to current date"() {
146136
when:
147137
service.add(registrationForm, ANY_LOCALE)
@@ -152,7 +142,6 @@ class UsersActivationServiceImplTest extends Specification {
152142
})
153143
}
154144

155-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
156145
def "add() should pass user's activation request to mail service"() {
157146
when:
158147
service.add(registrationForm, Locale.FRANCE)
@@ -206,7 +195,6 @@ class UsersActivationServiceImplTest extends Specification {
206195
ex.message == 'Date must be non null'
207196
}
208197

209-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
210198
def "countCreatedSince() should invoke dao, pass argument and return result from dao"() {
211199
given:
212200
Date expectedDate = new Date()
@@ -258,7 +246,6 @@ class UsersActivationServiceImplTest extends Specification {
258246
ex.message == 'Days must be greater than zero'
259247
}
260248

261-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
262249
def "findOlderThan() should invoke dao, pass changed date and return the result"() {
263250
given:
264251
int days = 4

src/test/groovy/ru/mystamps/web/feature/category/CategoryServiceImplTest.groovy

-10
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@ import static io.qala.datagen.RandomShortApi.positiveInteger
3333
import static io.qala.datagen.RandomValue.between
3434
import static io.qala.datagen.StringModifier.Impls.oneOf
3535

36-
@SuppressWarnings([
37-
'ClassJavadoc',
38-
'MethodName',
39-
'MisorderedStaticImports',
40-
'NoDef',
41-
'NoTabCharacter',
42-
'TrailingWhitespace',
43-
])
4436
class CategoryServiceImplTest extends Specification {
4537

4638
private final CategoryDao categoryDao = Mock()
@@ -109,7 +101,6 @@ class CategoryServiceImplTest extends Specification {
109101
ex.message == "Slug for string '-' must be non empty"
110102
}
111103

112-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
113104
def 'add() should pass slug to dao'() {
114105
given:
115106
String name = '-foo123 test_'
@@ -126,7 +117,6 @@ class CategoryServiceImplTest extends Specification {
126117
}) >> 40
127118
}
128119

129-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
130120
def 'add() should pass values to dao'() {
131121
given:
132122
Integer expectedUserId = 10

0 commit comments

Comments
 (0)