Skip to content

Commit

Permalink
Issue #12 - Add detekt and run it in automation.
Browse files Browse the repository at this point in the history
  • Loading branch information
pocmo committed Mar 21, 2018
1 parent f8ed2ef commit e1dc4df
Show file tree
Hide file tree
Showing 4 changed files with 435 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tasks:
&& touch local.properties
&& git config advice.detachedHead false
&& git checkout {{event.head.sha}}
&& ./gradlew --no-daemon clean assemble test
&& ./gradlew --no-daemon clean assemble test detektCheck
metadata:
name: Android Components - Pull Request
description: Building and testing Android components - triggered by a pull request.
Expand Down
16 changes: 16 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ buildscript {
}
}

plugins {
id("io.gitlab.arturbosch.detekt").version("1.0.0.RC6-4")
}

allprojects {
repositories {
google()
Expand All @@ -28,3 +32,15 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}

detekt {
// The version number is duplicated, please refer to plugins block for more details
version = "1.0.0.RC6-4"
profile("main") {
input = "$projectDir/components"
config = "$projectDir/config/detekt.yml"
filters = ".*test.*,.*/resources/.*,.*/tmp/.*"
output = "$projectDir/build/reports/detekt"
baseline = "$projectDir/config/detekt-baseline.xml"
}
}
37 changes: 37 additions & 0 deletions config/detekt-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" ?>
<SmellBaseline>
<Blacklist timestamp="1521663963552"></Blacklist>
<Whitelist timestamp="1521663963552">
<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>EmptyCatchBlock:DownloadUtils.kt$DownloadUtils${ }</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:ErrorPages.kt$.ErrorPages.kt</ID>
<ID>MaxLineLength:SafeIntent.kt$mozilla.components.utils.SafeIntent.kt</ID>
<ID>MaxLineLength:WebURLFinder.kt$mozilla.components.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: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:SafeBundle.kt$SafeBundle$e: RuntimeException</ID>
<ID>TooGenericExceptionCaught:SafeIntent.kt$SafeIntent$e: RuntimeException</ID>
<ID>TooGenericExceptionCaught:WebURLFinder.kt$WebURLFinder.Companion$e: Exception</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>
Loading

0 comments on commit e1dc4df

Please sign in to comment.