diktat icon indicating copy to clipboard operation
diktat copied to clipboard

[Feature] Show number of findings

Open WebTiger89 opened this issue 3 years ago • 1 comments

It would be great if diktatCheck also prints the number of findings so if a change in config dile is done it is possible to observe the impact of the change. For example if you have a huge code base and you have a lot of findings for a specific rule and you chnages some properties in the config file for this rule it would be possible to check how many findings have been gone and if the config change was useful.

Great job so far <3

WebTiger89 avatar Jul 14 '22 10:07 WebTiger89

@WebTiger89, thank you for your feedback.

Could you please clarify your use-case?

Currently (versions 1.2.3 and 1.2.4-SNAPSHOT), the Maven plug-in clearly reports the number of errors upon failure, e.g.:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:22 min
[INFO] Finished at: 2022-08-10T19:04:01+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.cqfn.diktat:diktat-maven-plugin:1.2.3:check (diktat) on project diktat-rules: There are 8 lint errors -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

This is clearly visible from the console:

lint-errors-console

as well as from the IDE:

lint-errors-idea

Additionally, when using CLI, passing the -v/--verbose switch to ktlint enables reporting the number of errors, too:

$ ktlint --color -v -R diktat.jar --disabled_rules=standard '**/*.kt'

src/main/kotlin/com/example/C.kt:8:1: [WRONG_INDENTATION] only spaces are allowed for indentation and each indentation should equal to 4 spaces (tabs are not allowed): expected 12 but was 16 (diktat-ruleset:indentation)
19:16:59.549 [main] DEBUG com.pinterest.ktlint.internal.KtlintCommandLine - 1223ms / 1 file(s) / 1 error(s)

Also - may be we will show the number of warnings also in Benedi.kt, @0x6675636b796f75676974687562 ?

orchestr7 avatar Sep 13 '22 10:09 orchestr7

@akuleshov7, Benedi.kt already does that.

First, the Action displays the summary one-liner once it completes:

action-summary

Additionally, the detailed information is available from the Checks tab (both pull requests and commits):

checks-tab

— as well as the Security -> Code Scanning section:

security-tab

@WebTiger89, if the currently available functionality is insufficient for you for some reason, feel free to reopen and comment.