• This repository has been archived on 11/Feb/2022
  • Stars
    star
    408
  • Rank 101,993 (Top 3 %)
  • Language
    Groovy
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Easy setup of static analysis tools for Android and Java projects.

[DEPRECATED] Gradle static analysis plugin

⚠️ A fork of this project is maintained at https://github.com/GradleUp/static-analysis-plugin/ Please migrate by using com.gradleup.static-analysis plugin id instead.

Bintray

A Gradle plugin to easily apply the same setup of static analysis tools across different Android, Java or Kotlin projects.

Supports Task Configuration Avoidance so that you have zero overhead in build speeds when you use this plugin!

Description

Gradle supports many popular static analysis (Checkstyle, PMD, FindBugs, etc) via a set of built-in plugins. Using these plugins in an Android module will require an additional setup to compensate for the differences between the model adopted by the Android plugin compared to the the Java one.

The gradle-static-analysis-plugin aims to provide:

  • flexible, configurable penalty strategy for builds
  • easy, Android-friendly integration for all static analysis
  • convenient way of sharing same setup across different projects
  • healthy, versionable and configurable defaults

Supported tools

The plugin supports various static analysis tools for Java, Kotlin and Android projects:

Please note that the tools availability depends on the project the plugin is applied to. For more details please refer to the supported tools page.

Tools in-consideration

  • CPD (Duplicate Code Detection) #150
  • error-prone #151
  • Jetbrains IDEA Inspections #152

For all tools in consideration, please refer to issues.

Out-of-the-box support for Android projects

Android projects use a Gradle model that is not compatible with the Java one, supported by the built-in static analysis tools plugins. Applying gradle-static-analysis-plugin to your Android project will make sure all the necessary tasks are created and correctly configured without any additional hassle.

Add the plugin to your project

Apply the plugin from jCenter as a classpath dependency

buildscript {
    repositories {
       jcenter()
    }
    dependencies {
        classpath 'com.novoda:gradle-static-analysis-plugin:1.2'
    }
}

apply plugin: 'com.novoda.static-analysis'

or from the Gradle Plugins Repository:

plugins {
    id 'com.novoda.static-analysis' version '1.2'
}

Simple usage

A typical configuration for the plugin will look like:

staticAnalysis {
    penalty {
        maxErrors = 0
        maxWarnings = 0
    }
    checkstyle { }
    pmd { }
    findbugs { }
    spotbugs { }
    detekt { }
    lintOptions { }
}

This will enable all the tools with their default settings and create evaluateViolations task. Running ./gradlew evaluateViolations task will run all configured tools and print the reports to console. For more advanced configurations, please refer to the advanced usage and to the supported tools pages.

Sample app

There are two sample Android projects available, one consisting of a regular app - available here - and the other comprising a multi-module setup available here. Both sample projects showcase a setup featuring Checkstyle, FindBugs, SpotBugs, PMD, Lint, Ktlint and Detekt.

Snapshots

CI status Download from Bintray

Snapshot builds from develop are automatically deployed to a repository that is not synced with JCenter. To consume a snapshot build add an additional maven repo as follows:

repositories {
    maven {
        url 'https://dl.bintray.com/novoda-oss/snapshots/'
    }
}

You can find the latest snapshot version following this link.

Roadmap

This project is routinely used by many Novoda projects and by other external projects with no known critical issues.

Future improvements and new tool integrations can be found on the repository's issue tracker.

More Repositories

1

android-demos

Examples of Android applications
Java
1,984
star
2

bintray-release

A helper for releasing from gradle up to bintray
Groovy
1,857
star
3

bonfire-firebase-sample

An app to discuss your favourite emojis. This is a sample app built with Firebase.
Java
549
star
4

merlin

Observes network connection status & gives callbacks
Java
544
star
5

spikes

Where ideas & concepts are born & incubated
Java
543
star
6

download-manager

A library that handles long-running downloads, handling the network interactions and retrying downloads automatically after failures
Java
487
star
7

rxpresso

Easy Espresso UI testing for Android applications using RxJava.
Java
363
star
8

gradle-android-command-plugin

Handy commands for testing Android on CI
Groovy
358
star
9

sqlite-provider

Extended SQLite functionality for Android
Java
303
star
10

no-player

Simplified Player wrapper for MediaPlayer and ExoPlayer
Java
181
star
11

simple-chrome-custom-tabs

Easy integration of Chrome Custom Tabs into your project. Just connect it to your activity, and navigate to the external website styling your tab as you wish.
Java
129
star
12

notils

Never again need a .utils. package yur scurvy sea dogs!
Java
122
star
13

gradle-build-properties-plugin

Keep your secrets secret. External build properties support for your Gradle scripts.
Groovy
112
star
14

ios-demos

Examples of ios applications http://www.novoda.com/blog
Swift
95
star
15

accessibilitools

UI tools to help make your Android app accessible.
Java
81
star
16

dojos

This is where the Novoda team do all their hacking
Java
76
star
17

simple-easy-xml-parser

Simple XML Parsing into Domain Objects
Java
69
star
18

sqlite-analyzer

Code generation for Java/Android database access.
Java
64
star
19

spritz

Spritz is an Android library to seamlessly trigger a Lottie animation
Java
62
star
20

espresso-support

Includes custom rules for testing Views in isolation and running tests with Google TalkBack enabled.
Java
60
star
21

novoda

Common things for all Novoda's open source projects
Java
37
star
22

view-pager-adapter

A simple implementation of PagerAdapter that supports Views.
Java
29
star
23

aosp.changelog.to

Generates a change log between different aosp tags. Based on the wonderful work of @alsutton
HTML
15
star
24

droidcon-booth

Novoda will be showing you CI in action at our Droidcon London booth!
Java
14
star
25

landing-strip

Your simple sliding viewpager tab strip: a landing strip without the fluff!
Java
13
star
26

novoda.github.io

GitHub open source landing page
SCSS
11
star
27

dashboards

The dashboards we have running in our offices!
JavaScript
10
star
28

drop-cap

Custom DropCap view without Spans
Java
10
star
29

public-mvn-repo

Novoda Public Maven Central Repository
7
star
30

github-reports

Github reports for a given organisation
Java
5
star
31

ncu

Novoda Craft University
3
star
32

peepz

Java
3
star
33

eslint-config-novoda

JavaScript
3
star
34

storage-path-finder

Library to perform the heavy lifting when attempting to find internal / external paths for primary and secondary storage.
Java
3
star
35

multiplatform-playground

A repository to play and learn about different multi-platform technologies
TypeScript
2
star
36

dashboard-plugins

A collection of plugins for the dashboard
JavaScript
2
star
37

react-native-workshop

JavaScript
1
star
38

dreams

A REST API using Stable Diffusion for Text to Image inference
Shell
1
star
39

github-slack-action

Simple Github Action to post a message in Slack
Shell
1
star