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

Run detekt with type resolution analysis on CI #3015

Merged
merged 6 commits into from
Aug 25, 2020
Merged

Conversation

arturbosch
Copy link
Member

No description provided.

@arturbosch arturbosch added the housekeeping Marker for housekeeping tasks and refactorings label Aug 25, 2020
@arturbosch arturbosch added this to the 1.12.0 milestone Aug 25, 2020
@@ -83,7 +83,7 @@ private class TestMultiRule(config: Config) : MultiRule() {
}
}

private abstract class AbstractRule(config: Config) : Rule(config) {
private open class AbstractRule(config: Config) : Rule(config) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 isn't this a false positive? I mean, we don't want any instance of AbstractRule so mark it as abstract seems like a good idea.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rule could additionally check if any inherited members used in it's members.
Or a simpler extends Something check for not requiring type resolution.

@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.psi.KtExpression
/**
* Rule to detect empty blocks of code.
*/
@Suppress("detekt.UnnecessaryAbstractClass") // we really do not want instances of this class
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should rethink this rule...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well the only real purpose of this class is to share some logic, which could be done via composition.
It's methods also do two things addFindingIfBlockExprIsEmpty check and add xD

java-version: 11

- name: Run analysis
run: ./gradlew detektMain detektTest --build-cache --parallel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can change now the pre merge workflow so it doesn't runs detekt each time, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do this than only in the pre-merge.yml so it is run locally.
But do we safe so much time? detekt without type resolution is fast.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, but yes. Just one CI job for quality is a nicer separation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the idea is that. if intellij doesn't remove a unused import I don't want all the checks in red.

@codecov
Copy link

codecov bot commented Aug 25, 2020

Codecov Report

Merging #3015 into master will decrease coverage by 0.37%.
The diff coverage is 48.88%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3015      +/-   ##
============================================
- Coverage     79.53%   79.15%   -0.38%     
- Complexity     2532     2543      +11     
============================================
  Files           431      434       +3     
  Lines          7637     7714      +77     
  Branches       1447     1465      +18     
============================================
+ Hits           6074     6106      +32     
- Misses          795      822      +27     
- Partials        768      786      +18     
Impacted Files Coverage Δ Complexity Δ
...ithub/detekt/custom/CustomChecksConfigValidator.kt 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...in/io/github/detekt/custom/CustomChecksProvider.kt 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...github/detekt/metrics/ComplexityReportGenerator.kt 85.18% <0.00%> (-7.41%) 9.00 <0.00> (ø)
.../gitlab/arturbosch/detekt/rules/empty/EmptyRule.kt 94.11% <ø> (ø) 12.00 <0.00> (ø)
...otlin/io/github/detekt/custom/SpekTestDiscovery.kt 64.81% <64.81%> (ø) 11.00 <11.00> (?)
...otlin/io/gitlab/arturbosch/detekt/core/Analyzer.kt 67.64% <66.66%> (ø) 6.00 <0.00> (ø)
...ch/detekt/api/internal/ValidatableConfiguration.kt 100.00% <100.00%> (ø) 0.00 <0.00> (ø)
...rbosch/detekt/rules/complexity/TooManyFunctions.kt 96.77% <100.00%> (ø) 25.00 <0.00> (ø)
... and 1 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 609e411...34a294f. Read the comment docs.

@arturbosch arturbosch merged commit e792286 into master Aug 25, 2020
@arturbosch arturbosch deleted the more-ci-tests branch August 25, 2020 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Marker for housekeeping tasks and refactorings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants