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

Perform Kotlin code analysis during the build #754

Merged
merged 19 commits into from
Oct 28, 2022

Conversation

yevhenii-nadtochii
Copy link
Contributor

@yevhenii-nadtochii yevhenii-nadtochii commented Oct 26, 2022

This PR moves Detekt code analyzing from GitHub workflow to Gradle detekt task. This task is bound to check by default, thus it will be executed with ./gradlew build.

It addresses config #412.

In particular, this changeset does the following:

  1. Drops detekt-analysis GitHub workflow.
  2. Pulls the latest config with implemented detekt-code-analysis script-plugin.
  3. Applies that plugin to base and testlib modules.

Please note, due to a bug in Gradle, plugins are applied with string ID instead of referencing to dependency-objects.

Detekt reported two finding during the build:

  1. Unused exception in catch block. I've renamed it to ignored.
  2. Too many functions in TruthExtensions.kt. I've suppressed this one with the baseline file.

@yevhenii-nadtochii yevhenii-nadtochii self-assigned this Oct 26, 2022
@codecov
Copy link

codecov bot commented Oct 26, 2022

Codecov Report

Merging #754 (14ef0af) into master (e6ec34b) will not change coverage.
The diff coverage is 0.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #754   +/-   ##
=========================================
  Coverage     71.82%   71.82%           
  Complexity     1328     1328           
=========================================
  Files           201      201           
  Lines          4887     4887           
  Branches        361      361           
=========================================
  Hits           3510     3510           
  Misses         1245     1245           
  Partials        132      132           

pom.xml Show resolved Hide resolved
@yevhenii-nadtochii yevhenii-nadtochii marked this pull request as ready for review October 26, 2022 14:44
@yevhenii-nadtochii
Copy link
Contributor Author

@alexander-yevsyukov @armiol Please take a look.

Detekt is set up here without buildSrc.

Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

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

Please see my comments and questions.


detekt {
buildUponDefaultConfig = true
baseline = file("config/quality/detekt-baseline.xml")
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if these files are not there?

I'm asking so that we can use script plugins (e.g. from build-logic).

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, let's now assume we have buildSrc (so that we don't introduce too many changes with build-logic).

Can we have these general things done there? Together with checking for the presence of configuration files, please.

@@ -0,0 +1,9 @@
naming:
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like settings that are applicable to all subprojects. So, they should probably go under ./config/quality. I mean be not under submodule, but under config of the project root.

[`buildSrc`] Perform Kotlin code analysis during the build
pom.xml Show resolved Hide resolved
@yevhenii-nadtochii yevhenii-nadtochii marked this pull request as draft October 27, 2022 14:44
@yevhenii-nadtochii yevhenii-nadtochii marked this pull request as ready for review October 28, 2022 10:45
@yevhenii-nadtochii
Copy link
Contributor Author

@armiol @alexander-yevsyukov PTAL.

@@ -26,7 +26,6 @@

package io.spine.internal.dependency

// https://pmd.github.io/
Copy link
Contributor

Choose a reason for hiding this comment

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

Please restore this. Newer config fixes this acceidental removal.

Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

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

LGTM, with one minor request.

@yevhenii-nadtochii yevhenii-nadtochii merged commit 87dd76d into master Oct 28, 2022
@yevhenii-nadtochii yevhenii-nadtochii deleted the detekt-as-gradle-task branch October 28, 2022 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants