[ 
https://issues.apache.org/jira/browse/MATH-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17350609#comment-17350609
 ] 

Alex Herbert commented on MATH-1576:
------------------------------------

For reference you can view the checkstyle reports by:

Updating {{src/main/resources/checkstyle-suppressions.xml}} to remove the 
suppression of everything.

Installing locally the artifacts just to allow the project multi-module 
dependencies to be present:
{noformat}
mvn install -DskipTests -Dcheckstyle.skip
{noformat}
I then updated the main pom.xml to change the checkstyle configuration:
{noformat}
<enableRulesSummary>true</enableRulesSummary>
{noformat}
This will produce a summary of which rules are broken and how many times.

Generate the cross-linked checkstyle reports using:
{noformat}
mvn jxr:jxr jxr:test-jxr checkstyle:checkstyle
{noformat}
The checkstyle reports are then in each module in 
{{target/site/checkstyle.html}} which you can open in a browser for local 
viewing.

The jxr plugin output (a html-based, cross referenced version of Java source 
code) will be correctly linked in the checkstyle report for the main code. Test 
code is built by jxr into {{target/site/xref-test}}. The link in the checkstyle 
report still uses {{target/site/xref}}. This seems to be a long standing 
checkstyle bug in the report goal. But if you click the link the url can be 
edited in the browser to change xref to xref-test and then jump to the 
offending code. It helps view what the report is detailing.

Looking at the report for the main cm legacy module it seems there are a lot of 
issues with indentation and a different opinion on what whitespace is allowed; 
these are rules that could be ignored for now. That would remove about over 
25,000 errors. Other errors are spread across the range of rules.

I suggest a way forward is to leave the checkstyle configuration in the parent 
pom as is. Then update the configuration in cm legacy to use a different 
checkstyle suppressions file to suppress warnings and/or a simplified 
checkstyle ruleset. All other modules that have been ported from cm legacy for 
development should be updated to the stricter rules. Currently the error count 
is:
{noformat}
[INFO] There are 222 errors ... commons-math-neuralnet/../... 
[INFO] There are 123 errors ... commons-math-transform/../... 
[INFO] There are 34766 errors ... commons-math-legacy/../... 
[INFO] There are 3 errors ... commons-math-examples/examples-sofm/../../... 
[INFO] There are 27 errors ... 
commons-math-examples/examples-sofm/chinese-rings/../../../... 
[INFO] There are 37 errors ... 
commons-math-examples/examples-sofm/tsp/../../../... 
{noformat}
Updating a module involves putting this in the child POM:
{code:xml}
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-checkstyle-plugin</artifactId>
  <configuration>
    
<configLocation>${math.parent.dir}/src/main/resources/checkstyle/checkstyle-legacy.xml</configLocation>
    
<suppressionsLocation>${math.parent.dir}/src/main/resources/checkstyle/checkstyle-suppressions-legacy.xml</suppressionsLocation>
  </configuration>
</plugin>
{code}
With corresponding files in the main parent resource folder copied for the 
checkstyle-legacy configuration. This prevented any errors from the cm legacy 
module when I tested it.

New modules will be easily updated to the new syntax due to the low number of 
errors. The old legacy module can be updated with less strict rules and then 
the remaining errors suppressed on a package basis. Packages can then be 
updated over time to pass the rules and the suppressions lifted.

I am will to put some time into fixing checkstyle for the new modules. I can 
then try and reduce the amount of errors for the old legacy modules with some 
rule tweaking and fixing the source when I have free time.

> Reinstate "checkstyle"
> ----------------------
>
>                 Key: MATH-1576
>                 URL: https://issues.apache.org/jira/browse/MATH-1576
>             Project: Commons Math
>          Issue Type: Sub-task
>            Reporter: Gilles Sadowski
>            Priority: Critical
>              Labels: checkstyle
>             Fix For: 4.0
>
>
> Modularization configuration was copied from Commons Numbers that used a 
> newer Checkstyle with a different syntax. The checks trigger more than 31000 
> errors in Commons Math; so all checks have been disabled. :(
> The syntax of the configuration that worked before modularization should be 
> adapted to the new syntax...



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to