-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #161: upgraded pmd and fixed violations
- Loading branch information
Showing
4 changed files
with
231 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="PMD ruleset for Checkstyle" | ||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 | ||
http://pmd.sourceforge.net/ruleset_2_0_0.xsd"> | ||
<description> | ||
PMD ruleset for Checkstyle main code (copy from main repo) | ||
</description> | ||
<exclude-pattern>.*/src/test/.*</exclude-pattern> | ||
<rule ref="checkstyle-sonar-plugin/config/pmd.xml"> | ||
<!-- until https://github.com/checkstyle/sonar-checkstyle/issues/161 --> | ||
<exclude name="CommentRequired"/> | ||
<exclude name="AvoidCatchingGenericException"/> | ||
<exclude name="AvoidFileStream"/> | ||
<exclude name="ClassNamingConventions"/> | ||
<exclude name="TooManyMethods"/> | ||
</rule> | ||
|
||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="PMD ruleset for Checkstyle" | ||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 | ||
http://pmd.sourceforge.net/ruleset_2_0_0.xsd"> | ||
<description> | ||
PMD ruleset for Checkstyle tests (copy from main repo) | ||
</description> | ||
<exclude-pattern>.*/src/main/.*</exclude-pattern> | ||
|
||
<rule ref="checkstyle-sonar-plugin/config/pmd.xml"> | ||
<!--We do throws Exception, as any exception that in not caught in test should fail | ||
a test that is expected behavior and we like it as it follow fail-fast and helps | ||
to avoid extra catch blocks--> | ||
<exclude name="SignatureDeclareThrowsException"/> | ||
<!--it madness to move all string values to common variables, | ||
it will be hard to read test code--> | ||
<exclude name="AvoidDuplicateLiterals"/> | ||
<!--we do not need javadoc on test code--> | ||
<exclude name="CommentRequired"/> | ||
<!--we like static imports in UTs as them minimize the code and we know that most of | ||
such methods are from UT+moks frameworks--> | ||
<exclude name="TooManyStaticImports"/> | ||
<!--we try to keep all testing for class in one place/class/file to ease navigation | ||
between target class and it's test--> | ||
<exclude name="TooManyMethods"/> | ||
<!--we have too much UTs for each main class, it is better to keep all tests in one | ||
file to ease navigation and search for tes--> | ||
<exclude name="CouplingBetweenObjects"/> | ||
<!--we have too much UTs for each main class, it is better to keep all tests in one | ||
file to ease navigation and search for test--> | ||
<exclude name="ExcessiveImports"/> | ||
<!--checkstyle do not use IP in configuration, so all values in tests are ok to use, | ||
they just another test string data--> | ||
<exclude name="AvoidUsingHardCodedIP"/> | ||
<!--UTests are required to be public by design--> | ||
<exclude name="ExcessivePublicCount"/> | ||
<!--we have too much UTs for each main class, it is better to keep all tests in one | ||
file to ease navigation and search for test--> | ||
<exclude name="ExcessiveClassLength"/> | ||
<!--we want to avoid wide throws signature, it is just test--> | ||
<exclude name="AvoidCatchingGenericException"/> | ||
<!--we do not want invest extra time to make logic ideal in test method, may be later...--> | ||
<exclude name="NPathComplexity"/> | ||
<!--conflicts with checkstyle rule--> | ||
<exclude name="JUnitUseExpected"/> | ||
<!--will be addressed in https://github.com/checkstyle/checkstyle/projects/5--> | ||
<exclude name="NonThreadSafeSingleton"/> | ||
<!-- too much false positives --> | ||
<exclude name="JUnitAssertionsShouldIncludeMessage"/> | ||
<!-- verify from another library is used --> | ||
<exclude name="JUnitTestsShouldIncludeAssert"/> | ||
<!-- until https://github.com/checkstyle/sonar-checkstyle/issues/161 --> | ||
<exclude name="AvoidFileStream"/> | ||
</rule> | ||
|
||
<rule ref="category/java/design.xml/NcssCount"> | ||
<properties> | ||
<!-- We want to keep it all in one place. --> | ||
<property name="classReportLevel" value="1000"/> | ||
<!-- A big enough value to satisfy the most cases. --> | ||
<property name="methodReportLevel" value="100"/> | ||
</properties> | ||
</rule> | ||
|
||
<rule ref="category/java/bestpractices.xml/JUnitTestContainsTooManyAsserts"> | ||
<properties> | ||
<property name="maximumAsserts" value="15"/> | ||
</properties> | ||
</rule> | ||
|
||
</ruleset> |
Oops, something went wrong.