-
Notifications
You must be signed in to change notification settings - Fork 5
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
Generate report that have violations from each Check in config #21
Comments
Before generate report on open source project, I make small example test on each check mentioned above to better understand every check and also know some checks' violation line information is at where it violates rules, but some are at the first line of whole. check whose violation line information is at where it was changed and violates rules:
these will be exactly captured by this version's patch-filter, no ignore. check whose violation line information is at the first line of whole file:
Considering that these violations are only one in one file, so we can exactly captured them through when we know the AuditEvents are created these checks, only using special two
although RegexpMultiline's violation line information is at where it was changed and violates rules, but a situation will happen: cat config.xml
cat test.java void method() {
System.out. // line 2
printf("Example"); // line3
System.out.
print("Example");
} /var/tmp $ RUN_LOCALE="-Duser.language=en -Duser.country=US"
but if we we change cat test.java void method() {
System.out. // line 2
print("Example"); // line3
System.out.
print("Example");
} /var/tmp $ RUN_LOCALE="-Duser.language=en -Duser.country=US"
|
@HuGanghui the two cases where violations are ignored because no changes in code for those lines are fine for now. Those cases will be covered by |
it is completely ok that some Check's violation will not be suppressed we will review them put all of them to inputs and think how to do suppression later on. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I make new commit by myself on guava, then test on it for but no violations in report, but should have, you can know from https://huganghui.github.io/OrderedProperties-FileTabCharacter/DiffReport/guava-ddbd27f/guava-patch-bcc7d34-ddbd27f.txt, that I add two file one java file, one properties to guava-ddbd27f commit, so in guava-ddbd27f-diff the files number should be 3162, but The fact is that both commit-diff report's total file number is 3160, I am confused with it. attention: this report does not use patch-filter |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@HuGanghui the problem why Please read few times:
Here's the diff which made
|
@rdiachenko when I do these tests, I using patch-filter in checkstyle checkstyle/checkstyle#8318 that has extended AutomaticBean in SuppressionPatchFilter, that why only files in path are reported violations in diff report, which prove that patch file is set and has effect. And also I change it in patch-filter project and run the example in #21 (comment) again, it is the same result. So I think the reason is not this one. |
@rdiachenko @romani please review this report: https://huganghui.github.io/Check-diff-report/DiffReport/ this report contains most of Checks mentioned in #21 (comment) and I finally find the reason of problem mentioned in #21 (comment) and #21 (comment), the fact is that https://github.com/checkstyle/contribution/blob/ebfe884d4ed6de955515396a45e3fc2f78ab0ec9/checkstyle-tester/projects-to-test-on.properties#L33 https://github.com/checkstyle/contribution/blob/ebfe884d4ed6de955515396a45e3fc2f78ab0ec9/checkstyle-tester/launch.groovy#L134-L142 In launch.groovy if the project such as guava, it has a fix commitID: v28.2, then eveytime we run launch.groovy, it will auto checkout to this commit, so it cause that I create a new file in a new commit, but in diff report not display this file, because launch.groovy auto checkout to commit v28.2. This detail is easy to overlook...sorry. so when I remove the |v28.2||, the problem disappers. |
I don't understand this, please clarify.
|
@rdiachenko sorry, it's ok now, report: https://huganghui.github.io/Check-diff-report/DiffReport/ |
@rdiachenko What I want to express is that when running diff.groovy, patch-filters/src/main/java/com/github/checkstyle/generatepatchfile/GeneratePatchFile.java Lines 308 to 322 in 84a8c20
launch.groovy(be called in diff.groovy to generate single violation report) will check And the solution is to remove |
I got it, thanks. And this is not a problem. Why would you need to do checkout manually? You should update |
We need more violations and cover rest of the checks. The patch you used in the report is very simple - all lines were added. We need commits with a lot of code changes where multiple lines were added/updated. Please finish #50 asap, it will allow to specify hashes of big commits and build report for them only. |
yes, I understand, it's ok to update projects-to-test-on.properties, but one situation is that when using patch-filters/src/main/java/com/github/checkstyle/generatepatchfile/GeneratePatchFile.java Lines 173 to 179 in 0eee80d
it help us to checkout automatically when more one diff report need to be created. but If specify a commit hash on
HEAD branch can be specified before run |
@HuGanghui ok, I see. I haven't use |
Here is a new diff report with three commits: https://huganghui.github.io/patch-filter-50/DiffReport2/ |
What's this? Why did you add your file manually? This is not a way to go. Please checkout https://github.com/checkstyle/eclipse-cs, it should have a lot of violations. Find commit hashes and build a report for them. You need to get violations for all checks. Please list here those checks you could not find violations for and a link to the report witch contains violations for the rest of checks. |
yes, I add a commit created by myself, this is just for test.
ok, I will do it. |
eclipse-cs diff reports about the first 5 commits, link is here: https://huganghui.github.io/eclipse-cs-checker/DiffReport/ in first 5 commits, only
need .properties files, but as mentioned in #31 (comment), diff reports can only display violations on .java files. So these two checks are special. cat patchConfig.xml <?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name = "Checker">
<property name="charset" value="UTF-8"/>
<!-- do not change severity to 'error', as that will hide errors caused by exceptions -->
<property name="severity" value="warning"/>
<!-- haltOnException is required for exception fixes and reporting of all exceptions -->
<property name="haltOnException" value="false"/>
<!-- BeforeExecutionFileFilters is required for sources of java9 -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$" />
</module>
<module name="com.puppycrawl.tools.checkstyle.filters.SuppressionPatchFilter">
<property name="file" value="${checkstyle.patchfilter.patch}"/>
</module>
<!--<module name="Header">-->
<!--<property name="headerFile" value="${checkstyle.header.file}"/>-->
<!--<property name="fileExtensions" value="java"/>-->
<!--<property name="id" value="header"/>-->
<!--</module>-->
<!--<module name="RegexpHeader">-->
<!--<property name="headerFile" value="${checkstyle.regexp.header.file}"/>-->
<!--<property name="fileExtensions" value="java"/>-->
<!--</module>-->
<!-- Javadoc Comments -->
<module name="JavadocPackage">
<property name="allowLegacy" value="false"/>
</module>
<!-- Miscellaneous -->
<module name="NewlineAtEndOfFile"/>
<module name="UniqueProperties"/>
<module name="OrderedProperties" />
<!-- Regexp -->
<module name="RegexpMultiline"/>
<module name="RegexpMultiline">
<property name="format" value="\r?\n[\t ]*\r?\n[\t ]*\r?\n"/>
<property name="fileExtensions" value="java,xml,properties"/>
<property name="message" value="Unnecessary consecutive lines"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="/\*\*\W+\* +\p{javaLowerCase}"/>
<property name="fileExtensions" value="java"/>
<property name="message"
value="First sentence in a comment should start with a capital letter"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="^\s*$" />
<property name="matchAcrossLines" value="true" />
<property name="message" value="Empty file is not allowed" />
</module>
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
</module>
<module name="RegexpSingleline">
<property name="format" value="/\*\* +\p{javaLowerCase}"/>
<property name="fileExtensions" value="java"/>
<property name="message"
value="First sentence in a comment should start with a capital letter"/>
</module>
<module name="RegexpSingleline">
<property name="format"
value="^(?!(\s*,?\s*<a href="[^"]+">|.*http)).{101,}$"/>
<property name="fileExtensions" value="xml, vm"/>
<property name="message" value="Line should not be longer than 100 symbols"/>
</module>
<!--
Links to .dtd files should start with "/", "http://" or "https://",
otherwise they will be broken after archiving the documentation.
See https://github.com/checkstyle/checkstyle/issues/7340 for details.
-->
<module name="RegexpSingleline">
<property name="id" value="noPackageCommentWithOtherVisibility"/>
<property name="format" value="/\*\s+package\s+\*/\s+(private|protected|public)"/>
<property name="fileExtensions" value="java"/>
<property name="message"
value="Package comment marker should not be used if other visibility is defined"/>
</module>
<module name="RegexpOnFilename" />
<module name="RegexpOnFilename">
<property name="folderPattern" value="[\\/]src[\\/]\w+[\\/]java[\\/]"/>
<property name="fileNamePattern" value="\.java$"/>
<property name="match" value="false"/>
<message key="regexp.filepath.mismatch"
value="Only java files should be located in the ''src/*/java'' folders."/>
</module>
<!-- Size Violations -->
<module name="FileLength">
<property name="fileExtensions" value="java"/>
</module>
<module name="LineLength">
<property name="max" value="80"/>
</module>
<!-- Whitespace -->
<module name="FileTabCharacter">
<property name="eachLine" value="false"/>
</module>
<!-- Example of filter -->
<!--
<module name="SeverityMatchFilter">
<property name="severity" value="warning"/>
<property name="acceptOnMatch" value="false"/>
</module>
-->
<!-- as we run on regression even on non-compiled files we need to skip exceptions on them -->
<module name="SuppressionSingleFilter">
<property name="message" value="Exception occurred while parsing"/>
<property name="checks" value="Checker"/>
</module>
</module>
|
eclipse-cs diff reports about the first 5 commits, with all checks in here: https://github.com/checkstyle/checkstyle/blob/ec4d06712ab203d31d73c5c6d5c46067f3a6d5b3/config/checkstyle_checks.xml, link is here: https://huganghui.github.io/eclipse-cs-checker/DiffReport-with-all-checks/ current version of patch-filter can correctly deal with all checks whose violation line information is at where it was changed and violates rules, no matter belong to as for checks whose violation line information is not at where it was changed and violates rules, no matter belong to and as mentioned in #21 (comment),
Considering that these violations are the only in one file if occur, so we can exactly captured them through when we know the AuditEvents are created these checks, only using isFileNameMatching condition in patch-filter not need isLineMatching condition. And
represents checks whose violation line information may happen many times in one file. it should be covered by context strategy. Of course, both two kind checks (it only has one violation in one file, and it can have many violations in one file.) I think can be solve by |
Please reread issue description. By all checks I meant those which are listed in the description only. We don't need TreeWalker checks for now. Could you please do what I asked:
|
a new diff report with all checks except OrderedProperties and UniqueProperties: https://huganghui.github.io/patch-filter-21/DiffReport/
|
@HuGanghui please add few more commits in the report where you have deletions/changes/additions. |
@rdiachenko it means creating some commits by myself and add them to this report or finding other commits in t https://github.com/checkstyle/eclipse-cs |
@HuGanghui find additional other commits with deletions/additions, don't add your own commits. |
diff report with additional commits: https://huganghui.github.io/patch-filter-21/DiffReportWithFour/ |
@HuGanghui is the |
@rdiachenko yes, it is updated. here is patchConfig.xml that I use: <?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name = "Checker">
<property name="charset" value="UTF-8"/>
<!-- do not change severity to 'error', as that will hide errors caused by exceptions -->
<property name="severity" value="warning"/>
<!-- haltOnException is required for exception fixes and reporting of all exceptions -->
<property name="haltOnException" value="false"/>
<!-- BeforeExecutionFileFilters is required for sources of java9 -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$" />
</module>
<module name="com.puppycrawl.tools.checkstyle.filters.SuppressionPatchFilter">
<property name="file" value="${checkstyle.patchfilter.patch}"/>
</module>
<!--<module name="Header">-->
<!--<property name="headerFile" value="${checkstyle.header.file}"/>-->
<!--<property name="fileExtensions" value="java"/>-->
<!--<property name="id" value="header"/>-->
<!--</module>-->
<!--<module name="RegexpHeader">-->
<!--<property name="headerFile" value="${checkstyle.regexp.header.file}"/>-->
<!--<property name="fileExtensions" value="java"/>-->
<!--</module>-->
<!-- Javadoc Comments -->
<module name="JavadocPackage">
<property name="allowLegacy" value="false"/>
</module>
<!-- Miscellaneous -->
<module name="NewlineAtEndOfFile"/>
<module name="UniqueProperties"/>
<module name="OrderedProperties" />
<!-- Regexp -->
<module name="RegexpMultiline"/>
<module name="RegexpMultiline">
<property name="format" value="\r?\n[\t ]*\r?\n[\t ]*\r?\n"/>
<property name="fileExtensions" value="java,xml,properties"/>
<property name="message" value="Unnecessary consecutive lines"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="/\*\*\W+\* +\p{javaLowerCase}"/>
<property name="fileExtensions" value="java"/>
<property name="message"
value="First sentence in a comment should start with a capital letter"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="^\s*$" />
<property name="matchAcrossLines" value="true" />
<property name="message" value="Empty file is not allowed" />
</module>
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
</module>
<module name="RegexpSingleline">
<property name="format" value="/\*\* +\p{javaLowerCase}"/>
<property name="fileExtensions" value="java"/>
<property name="message"
value="First sentence in a comment should start with a capital letter"/>
</module>
<module name="RegexpSingleline">
<property name="format"
value="^(?!(\s*,?\s*<a href="[^"]+">|.*http)).{101,}$"/>
<property name="fileExtensions" value="xml, vm"/>
<property name="message" value="Line should not be longer than 100 symbols"/>
</module>
<!--
Links to .dtd files should start with "/", "http://" or "https://",
otherwise they will be broken after archiving the documentation.
See https://github.com/checkstyle/checkstyle/issues/7340 for details.
-->
<module name="RegexpSingleline">
<property name="id" value="noPackageCommentWithOtherVisibility"/>
<property name="format" value="/\*\s+package\s+\*/\s+(private|protected|public)"/>
<property name="fileExtensions" value="java"/>
<property name="message"
value="Package comment marker should not be used if other visibility is defined"/>
</module>
<module name="RegexpOnFilename" />
<module name="RegexpOnFilename">
<property name="folderPattern" value="[\\/]src[\\/]\w+[\\/]java[\\/]"/>
<property name="fileNamePattern" value="\.java$"/>
<property name="match" value="false"/>
<message key="regexp.filepath.mismatch"
value="Only java files should be located in the ''src/*/java'' folders."/>
</module>
<!-- Size Violations -->
<module name="FileLength">
<property name="fileExtensions" value="java"/>
<property name="max" value="400"/>
</module>
<module name="LineLength">
<property name="max" value="80"/>
</module>
<!-- Whitespace -->
<module name="FileTabCharacter">
<property name="eachLine" value="false"/>
</module>
<module name="RegexpOnFilename">
<property name="fileNamePattern" value="\.java$"/>
</module>
<module name="RegexpSingleline">
<property name="format" value="Test"/>
</module>
<module name="RegexpMultiline">
<property name="matchAcrossLines" value="true"/>
<property name="format" value="jupiter\.api"/>
</module>
<module name="OrderedProperties">
<!--<property name="fileExtensions" value=".java"/>-->
</module>
<module name="UniqueProperties">
<!--<property name="fileExtensions" value=".java"/>-->
</module>
<module name="NewlineAtEndOfFile"/>
<!-- Example of filter -->
<!--
<module name="SeverityMatchFilter">
<property name="severity" value="warning"/>
<property name="acceptOnMatch" value="false"/>
</module>
-->
<!-- as we run on regression even on non-compiled files we need to skip exceptions on them -->
<module name="SuppressionSingleFilter">
<property name="message" value="Exception occurred while parsing"/>
<property name="checks" value="Checker"/>
</module>
</module>
|
@HuGanghui how can you explain this then? I compared patchConfig.xml from master with the one above you provided in the comment:
|
@rdiachenko actually when I do diff report, I add some checks to make it easier to have violations according to
but I do not add these checks in to master branch, Is necessary to add them in to it? If right, I will do it. Sorry for the confusion. |
@HuGanghui now, could you try to answer your question rereading initial comment:
So, what is the problem having one config in the master and another config on your local? |
yes, it is updated.
no, you should use patchConfig.xml that I mentioned in #21 (comment).
Because I usually need to modify some checks' settings to get violations, and I think master/PR always contains patchConfig.xml's change is not very good, so I choose to update config when generate diff reports, but not add them to git commits. |
You can actually check properties files too with maven-checkstyle-plugin. Please see #31 (comment). |
@HuGanghui , also can you please reduce lines limit for FileLength check, because in the report there is only one violation from this check? And please remove fileExtensions property from it to check all files and have more violations. |
I closing this issue for now, as we have enough work in UTs for now. |
We need pack of violations from each Check , we can modify Checks settings in config to be more aggressive and prone to violations.
We can take any range of commits to catch violations.
We can take any other opensource project for testing.
Checks:
FileTabCharacter
LineLength
FileLength
RegexpOnFilename
RegexpSingleline
RegexpMultiline
OrderedProperties
UniqueProperties
NewlineAtEndOfFile
The text was updated successfully, but these errors were encountered: