Original investigation of Daniil Yroslavtsev:
Check: http://checkstyle.sourceforge.net/config_misc.html#TrailingComment
It has so much problem to report valid code so I do believe that it is switched off in all companies configurations.
Other support for that Check: Trailing Comments .
But currently Trailing Comment check warns on the following valid cases:
1.
3.
4.
5
To fix false-positives we can update Trailing Commentary Sonar check to ignore: //NOSONAR, //SUPPRESS CHECKSTYLE, //NOPMD, // formatter:off, // formatter:on commentaries (with all their possible variants) and other 'valid' comments by regexp in it`s configuration.
But I think, that Checkstyle Trailing Comment check should be disabled for all projects as too many comment formats can be considered as 'valid' and result 'ignore' regexp will be too complex and unreadable.
Check: http://checkstyle.sourceforge.net/config_misc.html#TrailingComment
It has so much problem to report valid code so I do believe that it is switched off in all companies configurations.
Other support for that Check: Trailing Comments .
But currently Trailing Comment check warns on the following valid cases:
1.
A. } catch (Exception e) { // SUPPRESS CHECKSTYLE IllegalCatchExtendedCheck now it part of logic B. } catch (Exception e) { // NOPMD C. } catch (Exception e) { // NOSONAR2.
double emerging = 100 - regions.sumEstimate( "54138", // Not Applicable/Disclosed "19668", // United States "200005", // Canada ... );
ATTENTION: it is not false-positive, as all this magic numbers
should be moved to constants with proper names
3.
ReportValidationResult r = validationResult.get(i);
sb.append(
MessageFormat.format(" report_id={0} (co_id={1}), report_start$=''{2}'', report_end$=''{3}''"
+ ", period_start_date={4}, period_end_date={5}: "
+ "total percent on ''{6}'' is {7}% .... ",
safeToPlainString(r.reportId), // 0
safeToPlainString(r.companyId), // 1
formatTimestamp(r.reportStartDate), // 2
...
formatTimestamp(r.periodEndDate), // 7
...
)
4.
private static final Color[] COLORS = { new Color(255, 128, 128), // pink new Color(255, 255, 128), // yellow new Color(128, 255, 128), // green new Color(128, 255, 255), // cian new Color(255, 128, 192), // margent new Color(255, 128, 64), // brown new Color(0, 128, 128), // blue/gray new Color(128, 128, 255), // purple new Color(0, 128, 0), // dark green new Color(128, 128, 0), // greenish/grayish };
5
record[++columnIndex] = geoAreaEntry.getKey(); // _NAME record[++columnIndex] = "unknown"; // _REGION record[++columnIndex] = "0"; // _WEIGHT record[++columnIndex] = "1"; // _CONF
To fix false-positives we can update Trailing Commentary Sonar check to ignore: //NOSONAR, //SUPPRESS CHECKSTYLE, //NOPMD, // formatter:off, // formatter:on commentaries (with all their possible variants) and other 'valid' comments by regexp in it`s configuration.
But I think, that Checkstyle Trailing Comment check should be disabled for all projects as too many comment formats can be considered as 'valid' and result 'ignore' regexp will be too complex and unreadable.
No comments:
Post a Comment