saveourtool / diktat

Strict coding standard for Kotlin and a custom set of rules for detecting code smells, code style issues and bugs
https://diktat.saveourtool.com
MIT License
537 stars 39 forks source link

Diktat rule configs #1686

Closed nulls closed 1 year ago

nulls commented 1 year ago

What's done:

It closes #1695

github-actions[bot] commented 1 year ago

JUnit Tests (macOS, EnricoMi/publish-unit-test-result-action@v2)

   162 files  ±0     162 suites  ±0   10m 23s :stopwatch: - 1m 35s 1 371 tests ±0  1 335 :heavy_check_mark: ±0  36 :zzz: ±0  0 :x: ±0  2 750 runs  ±0  2 714 :heavy_check_mark: ±0  36 :zzz: ±0  0 :x: ±0 

Results for commit 04294d8f. ± Comparison against base commit d7d39f00.

This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both. ``` com.saveourtool.diktat.util.DiktatRuleSetProviderTest ‑ check DiktatRuleSetProviderTest contain all rules() ``` ``` com.saveourtool.diktat.util.DiktatRuleSetFactoryImplTest ‑ check DiktatRuleSetFactoryImpl contain all rules() ```

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 1 year ago

JUnit Tests (Windows, EnricoMi/publish-unit-test-result-action@v2)

   162 files  ±0     162 suites  ±0   9m 40s :stopwatch: - 2m 2s 1 371 tests ±0  1 354 :heavy_check_mark: ±0  17 :zzz: ±0  0 :x: ±0  2 750 runs  ±0  2 733 :heavy_check_mark: ±0  17 :zzz: ±0  0 :x: ±0 

Results for commit 04294d8f. ± Comparison against base commit d7d39f00.

This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both. ``` com.saveourtool.diktat.util.DiktatRuleSetProviderTest ‑ check DiktatRuleSetProviderTest contain all rules() ``` ``` com.saveourtool.diktat.util.DiktatRuleSetFactoryImplTest ‑ check DiktatRuleSetFactoryImpl contain all rules() ```

:recycle: This comment has been updated with latest results.

codecov[bot] commented 1 year ago

Codecov Report

Merging #1686 (ec0c24c) into master (4f23c71) will decrease coverage by 0.37%. The diff coverage is 62.25%.

@@             Coverage Diff              @@
##             master    #1686      +/-   ##
============================================
- Coverage     78.72%   78.35%   -0.37%     
+ Complexity     2317     2312       -5     
============================================
  Files           124      124              
  Lines          8151     8142       -9     
  Branches       2062     2060       -2     
============================================
- Hits           6417     6380      -37     
- Misses          826      858      +32     
+ Partials        908      904       -4     
Impacted Files Coverage Δ
...c/main/kotlin/com/saveourtool/diktat/DiktatMain.kt 0.00% <0.00%> (ø)
...lin/com/saveourtool/diktat/cli/DiktatProperties.kt 0.00% <0.00%> (ø)
.../saveourtool/diktat/plugin/maven/DiktatBaseMojo.kt 0.00% <0.00%> (ø)
.../com/saveourtool/diktat/plugin/maven/DiktatMojo.kt 0.00% <ø> (ø)
...diktat/ruleset/rules/chapter2/kdoc/KdocComments.kt 89.95% <ø> (ø)
.../ruleset/rules/chapter3/files/FileStructureRule.kt 85.35% <ø> (ø)
...diktat/ruleset/rules/DiktatRuleSetProviderV3Spi.kt 0.00% <0.00%> (ø)
...diktat/ruleset/rules/DiktatRuleConfigReaderImpl.kt 60.00% <60.00%> (ø)
...iktat/common/config/reader/AbstractConfigReader.kt 75.00% <75.00%> (ø)
...ol/diktat/common/config/rules/RulesConfigReader.kt 34.14% <100.00%> (-5.14%) :arrow_down:
... and 2 more
orchestr7 commented 1 year ago

Unfortunately you will need to wait until I will finish all the work related to the renaming of packages.

But my real question is the following: is it possible to create a small runner of diktat without this huge change with existing code? You told me “everything is already done” in CliRunner and you can call API directly, but the only problem is that there is no chance to provide external configuration of diktat-analysis directly to runner (only possible with a file).

nulls commented 1 year ago

But my real question is the following: is it possible to create a small runner of diktat without this huge change with existing code?

I thought I've showed to you. Restored this main class: https://github.com/saveourtool/diktat/pull/1689

orchestr7 commented 1 year ago

But my real question is the following: is it possible to create a small runner of diktat without this huge change with existing code?

I thought I've showed to you. Restored this main class: #1689

I missed this comment and actually got pissed because of this a little bit. If you show that to me - how external people should know about our API and how to call our methods? 👿 Anyway - I have sent #1689 to our friends, thank you 😄

nulls commented 1 year ago

If you show that to me - how external people should know about our API and how to call our methods?

I've showed you that it doesn't work in the way that we wanted (configuration now supported only via a file), that why I continue with this PR