Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #160: fix teamcity violations #159

Merged
merged 2 commits into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion checkstyle-sonar-plugin/config/intellij-idea-inspections.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2332,7 +2332,9 @@
<inspection_tool class="XsltTemplateInvocation" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="XsltUnusedDeclaration" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="XsltVariableShadowing" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="ZeroLengthArrayInitialization" enabled="true" level="WARNING" enabled_by_default="true" />
<!-- conflicting with ToArrayCallWithZeroLengthArrayArgument -->
<inspection_tool class="ZeroLengthArrayInitialization" enabled="false" level="WARNING"
enabled_by_default="true"/>
<inspection_tool class="dependsOnMethodTestNG" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="groupsTestNG" enabled="true" level="ERROR" enabled_by_default="true">
<option name="groups">
Expand Down
20 changes: 20 additions & 0 deletions checkstyle-sonar-plugin/config/pmd-main.xml
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>
73 changes: 73 additions & 0 deletions checkstyle-sonar-plugin/config/pmd-test.xml
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>
Loading