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

Add Markdown report #4858

Merged
merged 10 commits into from Jun 14, 2022
Merged

Add Markdown report #4858

merged 10 commits into from Jun 14, 2022

Conversation

VitalyVPinchuk
Copy link
Contributor

@VitalyVPinchuk VitalyVPinchuk commented May 24, 2022

For #4826 (Add a Markdown report format)

The report is similar to HTML report and looks like this:

detekt

Metrics

  • 10,000 M1
  • 2 M2

Complexity Report

  • 2,222 lines of code (loc)
  • 20 source lines of code (sloc)
  • 10 logical lines of code (lloc)
  • 2 comment lines of code (cloc)
  • 10 cyclomatic complexity (mcc)
  • 10 cognitive complexity
  • 3 number of total code smells
  • 10% comment source ratio
  • 1,000 mcc per 1,000 lloc
  • 300 code smells per 1,000 lloc

Findings (3)

Section-1, id_a (2)

Description id_a
Documentation

  • src/main/com/sample/Sample1.kt:9:17
    Message finding 1
    
    6      val greeting: String = "Hello, World!"
    7  
    8      init {
    9          println(greetings)
    !                  ^ error
    10     }
    11     
    12     fun foo() {
    
  • src/main/com/sample/Sample2.kt:13:17
    Message finding 2
    
    10     }
    11     
    12     fun foo() {
    13         println(greetings)
    !!                 ^ error
    14         return this
    15     }
    16 }
    

Section-2, id_b (1)

Description id_b
Documentation

  • src/main/com/sample/Sample3.kt:14:16
    11     
    12     fun foo() {
    13         println(greetings)
    14         return this
    !!                ^ error
    15     }
    16 }
    

generated with detekt version 1.20.0 on 2022-05-25 14:25:27 UTC

@codecov
Copy link

codecov bot commented May 24, 2022

Codecov Report

Merging #4858 (93c1d89) into main (5baf1f6) will increase coverage by 0.11%.
The diff coverage is 97.84%.

@@             Coverage Diff              @@
##               main    #4858      +/-   ##
============================================
+ Coverage     84.83%   84.95%   +0.11%     
- Complexity     3511     3520       +9     
============================================
  Files           497      498       +1     
  Lines         11548    11642      +94     
  Branches       2138     2146       +8     
============================================
+ Hits           9797     9890      +93     
+ Misses          686      685       -1     
- Partials       1065     1067       +2     
Impacted Files Coverage Δ
...itlab/arturbosch/detekt/generator/DetektPrinter.kt 0.00% <ø> (ø)
...rbosch/detekt/generator/collection/DefaultValue.kt 88.23% <ø> (ø)
...tekt/generator/printer/RuleConfigurationPrinter.kt 100.00% <ø> (ø)
...arturbosch/detekt/generator/printer/RulePrinter.kt 100.00% <ø> (ø)
...sch/detekt/generator/printer/RuleSetPagePrinter.kt 75.00% <ø> (ø)
...t/generator/printer/defaultconfig/ConfigPrinter.kt 100.00% <ø> (ø)
...ator/printer/defaultconfig/RuleSetConfigPrinter.kt 88.00% <ø> (ø)
...src/main/kotlin/io/github/detekt/utils/Markdown.kt 30.30% <ø> (ø)
...ils/src/main/kotlin/io/github/detekt/utils/Yaml.kt 79.36% <ø> (ø)
...otlin/io/github/detekt/report/md/MdOutputReport.kt 97.82% <97.82%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5baf1f6...93c1d89. Read the comment docs.

@BraisGabin
Copy link
Collaborator

BraisGabin commented May 25, 2022

I like it! I have a suggestion:

# detekt
## Metrics
...
## Complexity
...
## Findings ($total)
### Rule1 ($total)
- Finding1.1
- Finding1.2
### Rule2 ($total)
- Finding2.1
- Finding2.2

What do you thinkg? Basically the change is to use a header for each rule instead of adding it in a list.

@VitalyVPinchuk
Copy link
Contributor Author

VitalyVPinchuk commented May 25, 2022

What do you thinkg? Basically the change is to use a header for each rule instead of adding it in a list.

Why not! It would be more compact, I'll fix that.

Use headings instead of list for 'Rules' section
settings.gradle.kts Show resolved Hide resolved
detekt-report-md/build.gradle.kts Outdated Show resolved Hide resolved
Move Markdown.kt, Yaml.kt and YamlSpec.kt from 'detekt-generator' to
'detekt-tooling' package.

Refactor 'detekt-generator' and 'detekt-report-md' so that they depend
on 'detekt-tooling'.
detekt-generator/build.gradle.kts Outdated Show resolved Hide resolved
settings.gradle.kts Show resolved Hide resolved
detekt-report-md/build.gradle.kts Outdated Show resolved Hide resolved
Co-authored-by: Brais Gabín <braisgabin@gmail.com>
# Conflicts:
#	detekt-generator/src/main/kotlin/io/gitlab/arturbosch/detekt/generator/printer/defaultconfig/RuleSetConfigPrinter.kt
#	detekt-tooling/src/main/kotlin/io/github/detekt/tooling/out/Yaml.kt
@BraisGabin
Copy link
Collaborator

BraisGabin commented Jun 5, 2022

It seems that it is failing on windows.

@VitalyVPinchuk
Copy link
Contributor Author

VitalyVPinchuk commented Jun 6, 2022

It seems that it is failing on windows.

Yep. But I really don't know why, there's no OS specific code in the PR.
Could it be just Gradle failure?
Sometimes on my mac I have to issue ./gradlew --stop

@cortinico cortinico added the notable changes Marker for notable changes in the changelog label Jun 14, 2022
@cortinico cortinico merged commit 5d49409 into detekt:main Jun 14, 2022
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build core notable changes Marker for notable changes in the changelog reports
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants