Skip to content

Commit 89a943c

Browse files
authored
Bxc 3811 adjust codeclimate thresholds 2 (#1520)
* add default codeclimate checks * modify checkstyle config, move LineLength module, add/remove properties * new maven-checkstyle-plugin version * enable checkstyle plugin * add checkstyle config file * disable checkstyle plugin * adjust thresholds * fix spelling * method-lines threshold to 150 * disabled similar-code and identical-code checks, add duplication plugin * increase java mass threshold in duplication plugin * enable similar-code and identical-code, java mass threshold to 45 in duplication plugin * enable duplication plugin * change duplication count_threshold to 4 * change duplication count_threshold to 5 * change comments, add default java mass_threshold to duplication
1 parent d111544 commit 89a943c

File tree

4 files changed

+68
-19
lines changed

4 files changed

+68
-19
lines changed

.codeclimate.yml

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,66 @@
11
version: "2"
2+
3+
checks:
4+
argument-count:
5+
enabled: true
6+
config:
7+
threshold: 7
8+
complex-logic:
9+
enabled: true
10+
config:
11+
threshold: 4
12+
file-lines:
13+
enabled: true
14+
config:
15+
threshold: 500
16+
method-complexity:
17+
enabled: true
18+
config:
19+
threshold: 25
20+
method-count:
21+
enabled: true
22+
config:
23+
threshold: 50
24+
method-lines:
25+
enabled: true
26+
config:
27+
threshold: 150
28+
nested-control-flow:
29+
enabled: true
30+
config:
31+
threshold: 4
32+
return-statements:
33+
enabled: true
34+
config:
35+
threshold: 4
36+
similar-code:
37+
enabled: true
38+
config:
39+
threshold: # language-specific defaults. an override will affect all languages.
40+
identical-code:
41+
enabled: true
42+
config:
43+
threshold: # language-specific defaults. an override will affect all languages.
44+
245
plugins:
3-
# checkstyle is disabled until we figure out
4-
# how to incorporate our file suppressions config.
46+
# there are 16,000+ errors/warnings when checkstyle is enabled
547
checkstyle:
648
enabled: false
7-
# config:
8-
# file: "common-utils/src/main/resources/checkstyle/checkstyle.xml"
49+
config:
50+
file: "common-utils/src/main/resources/checkstyle/checkstyle.xml"
951
sonar-java:
1052
enabled: true
1153
pmd:
1254
enabled: true
55+
# duplication plugin affects similar-code and identical-code
56+
duplication:
57+
enabled: true
58+
config:
59+
count_threshold: 5
60+
languages:
61+
java:
62+
mass_threshold: 40 # default threshold
63+
1364
exclude_patterns:
1465
- "static/js/lib/"
1566
- "static/js/admin/performance_visualizations/assets/"

common-utils/src/main/resources/checkstyle/checkstyle-suppressions.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE suppressions PUBLIC
3-
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
4-
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
3+
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
4+
"https://checkstyle.orgm/dtds/suppressions_1_2.dtd">
55
<suppressions>
66
<suppress checks=".*" files="/fcrepo/" />
77
<suppress checks=".*" files="/fcrepo-cdr-fesl/" />

common-utils/src/main/resources/checkstyle/checkstyle.xml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE module PUBLIC
3-
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
4-
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
3+
"-//Checkstyle//DTD Checkstyle Configuration 1.2//EN"
4+
"https://checkstyle.or/dtds/configuration_1_2.dtd">
55
<!-- Checkstyle configuration that checks the Fedora coding conventions from:
66
- the Fedora FcRepo4 Code Style Guide https://wiki.duraspace.org/display/FF/Code+Style+Guide
77
- some best practices Checkstyle is very configurable. Be sure to read the
@@ -18,20 +18,27 @@
1818
http://checkstyle.sourceforge.net/property_types.html
1919
-->
2020
<module name="Checker">
21+
<property name="severity" value="warning"/>
2122

2223
<!-- Suppress
2324
The fcrepo based suppression file disables JavaDoc checks in unit test and IT test files.
2425
It also disables indentation checking, e.g. 4 spaces for all java files
2526
-->
2627
<module name="SuppressionFilter">
27-
<property name="file" value="${checkstyle.suppressions.file}"/>
28+
<property name="file" value="common-utils/src/main/resources/checkstyle/checkstyle-suppressions.xml"/>
2829
</module>
2930

3031
<!-- Checks that there are no tab characters ('\t') in the source code. -->
3132
<module name="FileTabCharacter">
3233
<property name="eachLine" value="true" />
3334
<property name="fileExtensions" value="css,java,js,jsp,xml,xsl" />
3435
</module>
36+
37+
<!-- Checks for long lines. -->
38+
<module name="LineLength">
39+
<property name="fileExtensions" value="java"/>
40+
<property name="max" value="120"/>
41+
</module>
3542

3643
<!-- License Header module disabled in favor of license-maven-plugin -->
3744
<module name="TreeWalker">
@@ -45,11 +52,6 @@
4552
<!-- Check that finds import statements that use the * notation. -->
4653
<module name="AvoidStarImport" />
4754

48-
<!-- Checks for long lines. -->
49-
<module name="LineLength">
50-
<property name="max" value="120"/>
51-
</module>
52-
5355
<!-- Write Javadocs for public methods and classes. Keep it short and to
5456
the point /** * @author Joe Developer * @date MMM DD, YYYY */ public class
5557
MyClass -->
@@ -70,11 +72,7 @@
7072

7173
<!-- Relaxes syntax options for JavaDoc comments -->
7274
<module name="JavadocMethod">
73-
<property name="scope" value="public" />
74-
<!-- whether to allow documented exceptions that are not declared if they are a subclass of java.lang.RuntimeException -->
75-
<property name="allowUndeclaredRTE" value="true" />
7675
<property name="allowMissingParamTags" value="true" />
77-
<property name="allowMissingThrowsTags" value="true" />
7876
<property name="allowMissingReturnTag" value="true" />
7977
</module>
8078

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
<maven.surefire.version>2.22.1</maven.surefire.version>
139139
<compiler.plugin.version>3.8.0</compiler.plugin.version>
140140
<maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version>
141-
<maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version>
141+
<maven-checkstyle-plugin.version>3.2.1</maven-checkstyle-plugin.version>
142142
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
143143
<exec-maven-plugin.version>3.1.0</exec-maven-plugin.version>
144144
<maven-scm-provider-svnjava.version>2.1.2</maven-scm-provider-svnjava.version>

0 commit comments

Comments
 (0)