Skip to content
Permalink
Browse files

Issue #17: Run code quality tools: detekt, ktlint and codecov

Issue #2: Setup minimal CI environment for library

Closes #17: Run code quality tools: detekt, ktlint and codecov
Closes #2: Setup minimal CI environment for library

Configure taskcluster to run on each PR/push

Closes #2

Fix taskcluster file indentation

Switched to android-components docker image

Make parent directories as needed

cd into the repo after clone

Added detekt configuration files and fixed input path
  • Loading branch information...
fercarcedo authored and pocmo committed May 14, 2018
1 parent 600cddf commit cb4a3685f7ec3d79cf356fba7a95d04f5373c9f7
Showing with 522 additions and 1 deletion.
  1. +53 −0 .taskcluster.yml
  2. +33 −1 build.gradle
  3. +4 −0 codecov.yml
  4. +45 −0 config/detekt-baseline.xml
  5. +379 −0 config/detekt.yml
  6. +8 −0 fretboard/build.gradle
@@ -0,0 +1,53 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

version: 0
allowPullRequests: public
tasks:
###############################################################################
# Task: Pull requests and pushes
#
# Triggered whenever a pull request is opened or updated, or a push is being made
#
# - Build the library
# - Run unit tests
# - Run code quality tools
###############################################################################
- provisionerId: '{{ taskcluster.docker.provisionerId }}'
workerType: '{{ taskcluster.docker.workerType }}'
extra:
github:
events:
- pull_request.opened
- pull_request.edited
- pull_request.synchronize
- pull_request.reopened
- push
payload:
maxRunTime: 3600
deadline: "{{ '2 hours' | $fromNow }}"
image: 'mozillamobile/android-components:1.1'
command:
- /bin/bash
- '--login'
- '-cx'
- >-
mkdir -p /opt/fretboard
&& cd /opt/fretboard
&& git clone {{ event.head.repo.url }}
&& cd fretboard
&& git config advice.detachedHead false
&& git checkout {{event.head.sha}}
&& ./gradlew --no-daemon clean assemble test detektCheck ktlint lint jacocoTestReport
&& bash <(curl -s https://codecov.io/bash)
artifacts:
'public':
type: 'directory'
path: '/opt/fretboard/fretboard/build/reports'
expires: "{{ '1 week' | $fromNow }}"
metadata:
name: Fretboard - Build
description: Building Fretboard (via Gradle)
owner: '{{ event.head.user.email }}'
source: '{{ event.head.repo.url }}'
@@ -23,12 +23,29 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${project.ext.dependencies['kotlin']}"

classpath 'com.dicedmelon.gradle:jacoco-android:0.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

plugins {
// Repeating detekt version due to plugin DSL limitations
// See https://github.com/gradle/gradle/issues/1697
id "io.gitlab.arturbosch.detekt" version "1.0.0.RC7"
}

detekt {
version = "1.0.0.RC7"
defaultProfile {
input = "$projectDir/fretboard"
config = "$projectDir/config/detekt.yml"
filters = ".*test.*,.*/resources/.*,.*/tmp/.*"
output = "$projectDir/build/reports/detekt"
baseline = "$projectDir/config/detekt-baseline.xml"
}
}

allprojects {
repositories {
google()
@@ -39,3 +56,18 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}

configurations {
ktlint
}

dependencies {
ktlint "com.github.shyiko:ktlint:0.23.1"
}

task ktlint(type: JavaExec, group: "verification") {
description = "Check Kotlin code style."
classpath = configurations.ktlint
main = "com.github.shyiko.ktlint.Main"
args "**/*.kt"
}
@@ -0,0 +1,4 @@
coverage:
precision: 2
round: down
range: 60..80
@@ -0,0 +1,45 @@
<?xml version="1.0" ?>
<SmellBaseline>
<Blacklist timestamp="1521663963552"></Blacklist>
<Whitelist timestamp="1522961299960">
<ID>ComplexCondition:InlineAutocompleteEditText.kt$InlineAutocompleteEditText$settingAutoComplete || start &lt; 0 || start == selStart &amp;&amp; start == selEnd</ID>
<ID>ComplexCondition:InlineAutocompleteEditText.kt$InlineAutocompleteEditText.&lt;no name provided&gt;$composingStart &gt;= 0 &amp;&amp; composingEnd &gt;= 0 &amp;&amp; composingEnd - composingStart &gt; text.length &amp;&amp; removeAutocomplete(editable)</ID>
<ID>ComplexMethod:DownloadUtils.kt$DownloadUtils$ @JvmStatic fun guessFileName(contentDisposition: String?, url: String?, mimeType: String?): String</ID>
<ID>ComplexMethod:ErrorPages.kt$ErrorPages$ fun mapWebViewErrorCodeToErrorType(errorCode: Int): ErrorType</ID>
<ID>ComplexMethod:InlineAutocompleteEditText.kt$InlineAutocompleteEditText$ fun onAutocomplete(result: AutocompleteResult?)</ID>
<ID>ComplexMethod:InlineAutocompleteEditText.kt$InlineAutocompleteEditText$ override fun onCreateInputConnection(outAttrs: EditorInfo): InputConnection?</ID>
<ID>EmptyCatchBlock:DownloadUtils.kt$DownloadUtils${ }</ID>
<ID>LargeClass:InlineAutocompleteEditText.kt$InlineAutocompleteEditText : AppCompatEditText</ID>
<ID>MagicNumber:Bitmap.kt$100</ID>
<ID>MagicNumber:ColorUtils.kt$ColorUtils$0.114</ID>
<ID>MagicNumber:ColorUtils.kt$ColorUtils$0.299</ID>
<ID>MagicNumber:ColorUtils.kt$ColorUtils$0.587</ID>
<ID>MagicNumber:ColorUtils.kt$ColorUtils$186</ID>
<ID>MagicNumber:DownloadUtils.kt$DownloadUtils$16</ID>
<ID>MagicNumber:DownloadUtils.kt$DownloadUtils$3</ID>
<ID>MagicNumber:DownloadUtils.kt$DownloadUtils$4</ID>
<ID>MaxLineLength:SafeIntent.kt$mozilla.components.support.utils.SafeIntent.kt</ID>
<ID>MaxLineLength:WebURLFinder.kt$mozilla.components.support.utils.WebURLFinder.kt</ID>
<ID>NestedBlockDepth:DownloadUtils.kt$DownloadUtils$ @JvmStatic fun guessFileName(contentDisposition: String?, url: String?, mimeType: String?): String</ID>
<ID>ReturnCount:DownloadUtils.kt$DownloadUtils$private fun parseContentDisposition(contentDisposition: String): String?</ID>
<ID>ReturnCount:InlineAutocompleteEditText.kt$InlineAutocompleteEditText$ fun onAutocomplete(result: AutocompleteResult?)</ID>
<ID>ReturnCount:InlineAutocompleteEditText.kt$InlineAutocompleteEditText$fun (_: View, keyCode: Int, event: KeyEvent): Boolean</ID>
<ID>ReturnCount:SafeBundle.kt$SafeBundle$fun &lt;T : Parcelable&gt; getParcelable(name: String): T?</ID>
<ID>ReturnCount:SafeBundle.kt$SafeBundle$fun getString(name: String): String?</ID>
<ID>ReturnCount:SafeIntent.kt$SafeIntent$fun &lt;T : Parcelable&gt; getParcelableArrayListExtra(name: String): ArrayList&lt;T&gt;?</ID>
<ID>ReturnCount:SafeIntent.kt$SafeIntent$fun &lt;T : Parcelable&gt; getParcelableExtra(name: String): T?</ID>
<ID>ReturnCount:SafeIntent.kt$SafeIntent$fun getBooleanExtra(name: String, defaultValue: Boolean): Boolean</ID>
<ID>ReturnCount:SafeIntent.kt$SafeIntent$fun getBundleExtra(name: String): SafeBundle?</ID>
<ID>ReturnCount:SafeIntent.kt$SafeIntent$fun getCharSequenceExtra(name: String): CharSequence?</ID>
<ID>ReturnCount:SafeIntent.kt$SafeIntent$fun getIntExtra(name: String, defaultValue: Int): Int</ID>
<ID>ReturnCount:SafeIntent.kt$SafeIntent$fun getStringArrayListExtra(name: String): ArrayList&lt;String&gt;?</ID>
<ID>ReturnCount:SafeIntent.kt$SafeIntent$fun getStringExtra(name: String): String?</ID>
<ID>ReturnCount:SafeIntent.kt$SafeIntent$fun hasExtra(name: String): Boolean</ID>
<ID>TooGenericExceptionCaught:InlineAutocompleteEditText.kt$InlineAutocompleteEditText$ignored: NullPointerException</ID>
<ID>TooGenericExceptionCaught:SafeBundle.kt$SafeBundle$e: RuntimeException</ID>
<ID>TooGenericExceptionCaught:SafeIntent.kt$SafeIntent$e: RuntimeException</ID>
<ID>TooGenericExceptionCaught:WebURLFinder.kt$WebURLFinder.Companion$e: Exception</ID>
<ID>TooManyFunctions:InlineAutocompleteEditText.kt$InlineAutocompleteEditText : AppCompatEditText</ID>
<ID>TopLevelPropertyNaming:Char.kt$/** * A series of dots (typically three, such as "…") that usually indicates an intentional omission of * a word, sentence, or whole section from a text without altering its original meaning. */ val Char.Companion.ELLIPSIS: Char get() = '…'</ID>
</Whitelist>
</SmellBaseline>
Oops, something went wrong.

0 comments on commit cb4a368

Please sign in to comment.
You can’t perform that action at this time.