Giter VIP home page Giter VIP logo

vanniktech / gradle-code-quality-tools-plugin Goto Github PK

View Code? Open in Web Editor NEW
345.0 8.0 26.0 1.03 MB

Gradle plugin that generates ErrorProne, Findbugs, Checkstyle, PMD, CPD, Lint, Detekt & Ktlint Tasks for every subproject.

Home Page: http://vanniktech.com

License: Apache License 2.0

Shell 1.36% Kotlin 98.64%
gradle-plugin checkstyle android lint findbugs pmd code-quality findbugs-plugin cpd detekt

gradle-code-quality-tools-plugin's People

Contributors

andrewpolovko avatar budnyjj avatar dependabot[bot] avatar grannath avatar keciciler avatar renovate[bot] avatar schalkms avatar vanniktech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gradle-code-quality-tools-plugin's Issues

Plugin added to `build.gradle`, expected new tasks?

I've added the plugin to my build.gradle file. Now I'm a bit at a loss on what to do next. From an other issue here I gathered that this plugin hooks into the check task. Also I expected some new tasks in ./gradlew tasks --all. But I see nothing particular.

How am I supposed to kick this off?

The output of ./gradlew tasks --all:

./gradlew tasks --all                                                                                                                                                                                                         0/0.61
:tasks

------------------------------------------------------------
All tasks runnable from root project
------------------------------------------------------------

Application tasks
-----------------
bootRun - Run the project with support for auto-detecting main class and reloading static resources

Build tasks
-----------
assemble - Assembles the outputs of this project.
bootRepackage - Repackage existing JAR and WAR archives so that they can be executed from the command line using 'java -jar'
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles main classes.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the main classes.
testClasses - Assembles test classes.

Build Setup tasks
-----------------
init - Initializes a new Gradle build. [incubating]
wrapper - Generates Gradle wrapper files. [incubating]

Documentation tasks
-------------------
javadoc - Generates Javadoc API documentation for the main source code.

Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'bslegacy'.
components - Displays the components produced by root project 'bslegacy'. [incubating]
dependencies - Displays all dependencies declared in root project 'bslegacy'.
dependencyInsight - Displays the insight into a specific dependency in root project 'bslegacy'.
dependentComponents - Displays the dependent components of components in root project 'bslegacy'. [incubating]
help - Displays a help message.
model - Displays the configuration model of root project 'bslegacy'. [incubating]
projects - Displays the sub-projects of root project 'bslegacy'.
properties - Displays the properties of root project 'bslegacy'.
tasks - Displays the tasks runnable from root project 'bslegacy'.

Verification tasks
------------------
check - Runs all checks.
test - Runs the unit tests.

Other tasks
-----------
compileJava - Compiles main Java source.
compileTestJava - Compiles test Java source.
dependencyManagement
findMainClass
processResources - Processes main resources.
processTestResources - Processes test resources.
stage

Rules
-----
Pattern: clean<TaskName>: Cleans the output files of a task.
Pattern: build<ConfigurationName>: Assembles the artifacts of a configuration.
Pattern: upload<ConfigurationName>: Assembles and uploads the artifacts belonging to a configuration.

BUILD SUCCESSFUL

Total time: 1.04 secs

The relevant portions of the builde.gradle file:

buildscript {
        ext {
                springBootVersion = '1.5.1.RELEASE'
        }
        repositories {
                mavenCentral()
                jcenter()
        }
        dependencies {
                classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
                classpath('com.vanniktech:gradle-code-quality-tools-plugin:0.4.0')
        }
}

apply plugin: 'com.vanniktech.code.quality.tools'

VariableMinLength not working as intended

Hello again, I opened an issue on the detekt project because I was having trouble with the VariableMinLength setting on detekt. I've been busy this days, but I got back on the project I had the issue on today, and couldn't reproduce either so there's that.

I've however been making some tests on my own and there is something weird going on with this. Now it's possible that I'm a complete idiot and there's something obvious that I'm missing but, I'm getting different results on my project and this test project with copy pasted settings. To illustrate why I think there's something weird going on, the project has variables of length < 10 but is passing gradle check with detekt reporting 0 smells., with this detekt.yml

autoCorrect: false
failFast: true

style:
  VariableMinLength:
    active: true
    minimumVariableNameLength: 10

naming:
  VariableMinLength:
    active: true
    minimumVariableNameLength: 10

Ktlint baseline support

Dependency issue

I am using Gradle 5.2.1

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'react-native'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find net.ltgt.gradle:gradle-errorprone-plugin:0.0.14.
     Searched in the following locations:
       - file:/Users/daniel/.m2/repository/net/ltgt/gradle/gradle-errorprone-plugin/0.0.14/gradle-errorprone-plugin-0.0.14.pom
       - file:/Users/daniel/.m2/repository/net/ltgt/gradle/gradle-errorprone-plugin/0.0.14/gradle-errorprone-plugin-0.0.14.jar
       - https://dl.google.com/dl/android/maven2/net/ltgt/gradle/gradle-errorprone-plugin/0.0.14/gradle-errorprone-plugin-0.0.14.pom
       - https://dl.google.com/dl/android/maven2/net/ltgt/gradle/gradle-errorprone-plugin/0.0.14/gradle-errorprone-plugin-0.0.14.jar
       - https://jcenter.bintray.com/net/ltgt/gradle/gradle-errorprone-plugin/0.0.14/gradle-errorprone-plugin-0.0.14.pom
       - https://jcenter.bintray.com/net/ltgt/gradle/gradle-errorprone-plugin/0.0.14/gradle-errorprone-plugin-0.0.14.jar
     Required by:
         project : > com.vanniktech:gradle-code-quality-tools-plugin:0.18.0

on debug/Release Checkstyle

On debug/release with Checkstyle deps you will see:

Warning:WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android.

Its probably nothing too major just doc-ing in case that turns out to be something

If it turns out to be something will figure out work-around and submit so that I can be included in the plugin readme.

Readme.md contains dead link to groovy javadoc +.idea folder for config xml's?

It's a small issue, but for beginners incomplete documentation may be confusing :
In the readme.md file, at chapter
https://github.com/vanniktech/gradle-code-quality-tools-plugin#configuration
contains following dead link : src/main/groovy/com/vanniktech/code/quality/tools/CodeQualityToolsPluginExtension.groovy

If I understand correctly,
apply plugin: "com.vanniktech.code.quality.tools"
and the config block just go in the main project's build.gradle ?

Also maybe some more explanation needed:
In android studio, the specific tool (findbugs etc) XML config files are usually under the .idea folder,
Does this plugin need to have it's own set under code_quality_tools folder,
because this folder is empty, except for detekt.yml ?

Could not create task of type 'Cpd'

Hey, I ran into an issue with cpd. It cannot create the cpd task and thus doesn't run when cpd isn't disabled. Is there a way to fix it?

Plugin version 0.19.0
Android plugin is '3.6.1'
Gradle is '6.2.2'

> Failed to apply plugin [class 'de.aaschmid.gradle.plugins.cpd.CpdPlugin']
   > Could not create task ':testlab:cpdCheck'.
      > Could not create task of type 'Cpd'.
         > Could not create an instance of type de.aaschmid.gradle.plugins.cpd.internal.CpdReportsImpl.
            > org.gradle.api.reporting.internal.TaskReportContainer.<init>(Ljava/lang/Class;Lorg/gradle/api/Task;)V

My build.gradle

...

apply plugin: "com.vanniktech.code.quality.tools"

...

subprojects {
    codeQualityTools {
        failEarly = true
        htmlReports = true

        checkstyle {
            toolVersion = '8.30'
        }
        cpd {
            enabled = false
        }
        detekt {
            toolVersion = '1.6.0'
            config = "$rootProject.projectDir/.codequality/detekt.yml"
        }
        errorProne {
            toolVersion = '2.3.2'

        }
        kotlin {
            allWarningsAsErrors = true
        }
        ktlint {
            toolVersion = '0.36.0'
        }
        lint {
            abortOnError = true
            checkAllWarnings = true
            checkReleaseBuilds = false
            warningsAsErrors = true
        }
        pmd {
            toolVersion = '6.21.0'
        }
    }
}

Thank's in advance. Keep up the great work.

Could not find de.aaschmid:gradle-cpd-plugin:3.3.

A problem occurred configuring root project '****'.
> Could not resolve all files for configuration ':classpath'.
   > Could not find de.aaschmid:gradle-cpd-plugin:3.3.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/de/aaschmid/gradle-cpd-plugin/3.3/gradle-cpd-plugin-3.3.pom
       - https://repo.maven.apache.org/maven2/de/aaschmid/gradle-cpd-plugin/3.3/gradle-cpd-plugin-3.3.pom
       - https://jcenter.bintray.com/de/aaschmid/gradle-cpd-plugin/3.3/gradle-cpd-plugin-3.3.pom
     Required by:
         project : > com.vanniktech:gradle-code-quality-tools-plugin:0.23.0

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

cannot build with version 0.16.0 or higher on gradle 4.10

With Version 0.15.0 and gradle 4.10, everything works as expected.
When updating to 0.16.0 or 0.17.0 I am getting following output:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
   > org.gradle.api.tasks.TaskContainer.named(Ljava/lang/String;Ljava/lang/Class;Lorg/gradle/api/Action;)Lorg/gradle/api/tasks/TaskProvider;

The solution is quite easy, just update gradle. But it's nowhere mentioned.

Tested with gradle 5.2.1

checkstyle FAILED: Unable to create Root Module

> Task :ReactAndroid:checkstyle FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ReactAndroid:checkstyle'.
> Unable to create Root Module: config {/Users/daniel/code/react-native/code_quality_tools/checkstyle.xml}, classpath {null}.

Unable to add multiple checkstyle inclusion/exclusion patterns

Hi @vanniktech, thanks for the great plugin! I believe it will become very popular soon.
There some issues, however, that prevent us from use it in production. Here is one of them.

We found that there is no way to setup more then on exclusion patter for checkstyle configuration, because checkstyle exclude setting has a string type:
https://github.com/vanniktech/gradle-code-quality-tools-plugin/blob/master/src/main/groovy/com/vanniktech/code/quality/tools/CodeQualityToolsPluginExtension.groovy#L96

IMHO it would be great to replace it with a array-like structure to configure it in more flexible way.

Support AGP 3.2.1

I think one of the tools broke and ideally we'd spin up some instrumentation tests for the tool that broke - with others following afterwards.

Why the docs are not showing ?

I can see that you've added some docs to the ext variable.

* When set to true all enabled code quality tools will be configured in a way that even a single warning / error will fail the build process.
* @since 0.2.0
*/
var failEarly: Boolean = true

but when I request for the docs from IDE, it's not showing

image

Actually am trying to build a plugin. I am having similar issue. Do you know how to fix it?

https://stackoverflow.com/questions/61985548/how-to-add-docs-to-gradle-plugin-extension-variables

Applying the plugin produces error by default

Hi,

Applying the plugin produces an error by default because some dependencies are missing.
I think this is a bad user experience.
In my case I'm not building an android app so IMO the plugin should work.
Why should it fail because it wants to build android or kotlin and I'm not using either.
Less (automation or defaults) is more :) .

Thanks,

plugins {
   ....
    id "com.vanniktech.code.quality.tools" version "0.9.0"
}
Could not find com.android.tools.build:gradle:3.0.1.
Searched in the following locations:
    https://plugins.gradle.org/m2/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom
    https://plugins.gradle.org/m2/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar
Required by:
    project :core > com.vanniktech.code.quality.tools:com.vanniktech.code.quality.tools.gradle.plugin:0.9.0 > gradle.plugin.com.vanniktech:gradle-code-quality-tools-plugin:0.9.0

FindBugs is unable to find classes in a multiflavored project

Hi @vanniktech, thanks for the great plugin! I believe it will become very popular soon.
There some issues, however, that prevent us from use it in production. Here is one of them.

Our project has a number of ABI flavors, like "arm" and "x86".
We found that it's not possible to perform FindBugs check on it:

./gradlew findbugs
... assembles all flavours ...
:app:assemble
:app:findbugs FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:findbugs'.
> No classes configured for FindBugs analysis.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

That's because it searches for classes to analyze in hardcoded place:
https://github.com/vanniktech/gradle-code-quality-tools-plugin/blob/master/src/main/groovy/com/vanniktech/code/quality/tools/CodeQualityToolsPlugin.groovy#L158 , but in our project these classes are placed in
a build/intermediates/classes/arm/debug .

codeQualityTools block is ignored

The declaration:

codeQualityTools {
    boolean failEarly = true
    boolean xmlReports = false
    boolean htmlReports = true
    boolean textReports = false
    String[] ignoreProjects = []

   // More code
}

seems to be ignored. It has not a consequence, making customization just really hard. Please, could you help with this? @vanniktech

I have attempted to put in an Android project root/build.gradle and even root/module/build.gradle and still no effect. For example, if I shut off xml reports, and turn on html reports, I still see the xml reports generated.

Environment

  • Android Studio 3.4.1
  • Gradle plugin 5.0

Cannot execute plugin without detekt config file

The detekt tool and official plugin do not require a config file. If not configured, the default is used. This is impossible using this plugin.

Related, the official plugin can generate a default file. This is again not possible with this plugin.

At least, please allow executing the plugin with just defaults. At best, add a task to generate the default file as well.

Old tool dependencies

First of all, thank you so much for building this plugin, I really appreciate not having to do much to configure my project for a bunch of static analysis tooling.

The plugin dependencies that this tool provides are getting old at this point. Would it be possible for you to upgrade the dependencies and publish a new release?

Plugin does not hook into build life cycle

Added the plugin to my project and in the debug output it shows that Gradle finds it, downloads it and recognizes the plugin as an available tool in the project, but it doesn't automatically hook the plugin into the build life cycle.

I configured it to the build.gradle as your readme instructed. I'm running Java 8 and Gradle 2.12.

config naming inconsistencies

  findbugs {
    String excludeFilter = 'code_quality_tools/findbugs-filter.xml'
  }
  checkstyle {
    String configFile = 'code_quality_tools/checkstyle.xml'
  }
  pmd {
    String ruleSetFile = 'code_quality_tools/pmd.xml'
  }
  lint {
    File lintConfig = null
  }
  detekt {
    String config = 'code_quality_tools/detekt.yml'
  }

It's all the same with a different name. Even though they are probably called by the tool library like this.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Detected dependencies

github-actions
.github/workflows/build.yml
  • actions/checkout v3
  • gradle/wrapper-validation-action v1
  • gradle/gradle-build-action v2
  • actions/setup-java v3
.github/workflows/publish-release.yml
  • actions/checkout v3
  • actions/setup-java v3
  • gradle/gradle-build-action v2
.github/workflows/publish-snapshot.yml
  • actions/checkout v3
  • actions/setup-java v3
  • gradle/gradle-build-action v2
gradle
gradle.properties
build.gradle
  • org.jetbrains.kotlin:kotlin-gradle-plugin 1.6.21
  • com.vanniktech:gradle-code-quality-tools-plugin 0.22.0
  • com.vanniktech:gradle-maven-publish-plugin 0.22.0
  • de.aaschmid:gradle-cpd-plugin 3.3
  • com.android.tools.build:gradle 7.3.1
  • junit:junit 4.13.2
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 7.5.1

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.