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

Prepare rc8 #1011

Merged
merged 7 commits into from Jul 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -2,11 +2,13 @@

- Read [this article](https://chris.beams.io/posts/git-commit/) before writing commit messages
- Copy the file `commit-msg` to `.git/hooks`
- Use `gradle build -x dokka` to build the source but exclude documentation jar generating to save time.
Copy link
Member

Choose a reason for hiding this comment

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

(y)

- `gradle detektCheck` should not report any errors
- This repo uses tabs! Make sure your code is properly formatted.
- Use idea-code-style.xml for coding style .
- We use [Spek](https://github.com/spekframework/spek) for testing.
- Feel free to add your name to the contributors list at the end of the readme file when opening a pull request.
- The code in `detekt-api` and any rule in `detekt-rules` must be documented. We generate documentation for our website based on this modules.

### Specific code style rules we use

Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Expand Up @@ -19,8 +19,8 @@ buildscript {
}

plugins {
id("com.jfrog.bintray") version "1.8.0"
id("com.github.ben-manes.versions") version "0.17.0"
id("com.jfrog.bintray") version "1.8.4"
id("com.github.ben-manes.versions") version "0.20.0"
id("com.github.johnrengelman.shadow") version "2.0.4" apply false
id("org.sonarqube") version "2.6.2"
id("io.gitlab.arturbosch.detekt")
Expand Down Expand Up @@ -139,7 +139,7 @@ subprojects {
asNode().apply {
appendNode("description", "Static code analysis for Kotlin")
appendNode("name", "detekt")
appendNode("url", "https://github.com/arturbosch/detekt")
appendNode("url", "https://arturbosch.github.io/detekt")

val license = appendNode("licenses").appendNode("license")
license.appendNode("name", "The Apache Software License, Version 2.0")
Expand Down
104 changes: 101 additions & 3 deletions detekt-gradle-plugin/build.gradle.kts
@@ -1,3 +1,7 @@
import com.jfrog.bintray.gradle.BintrayExtension
import org.jetbrains.dokka.gradle.DokkaTask
import java.util.Date

buildscript {
repositories {
mavenCentral()
Expand All @@ -13,11 +17,17 @@ repositories {
plugins {
`java-gradle-plugin`
id("com.gradle.plugin-publish") version "0.9.10"
id("com.jfrog.bintray") version "1.8.4"
kotlin("jvm") version "1.2.41"
id("org.jetbrains.dokka") version "0.9.17"
}

apply {
plugin("maven-publish")
}

group = "io.gitlab.arturbosch"
version = "1.0.0.RC7-3"
group = "io.gitlab.arturbosch.detekt"
version = "1.0.0.RC8"

val spekVersion = "1.1.5"
val junitPlatformVersion = "1.2.0"
Expand Down Expand Up @@ -49,7 +59,7 @@ val test by tasks.getting(Test::class) {
}

pluginBundle {
website = "https://github.com/arturbosch/detekt"
website = "https://arturbosch.github.io/detekt"
vcsUrl = "https://github.com/arturbosch/detekt"
description = "Static code analysis for Kotlin"
tags = listOf("kotlin", "detekt", "code-analysis", "badsmells", "codesmells")
Expand All @@ -61,3 +71,91 @@ pluginBundle {
}
}
}

bintray {
user = System.getenv("BINTRAY_USER") ?: ""
Copy link
Member

Choose a reason for hiding this comment

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

I'm glad that you have automated the bintray publishing.

key = System.getenv("BINTRAY_API_KEY") ?: ""
val mavenCentralUser = System.getenv("MAVEN_CENTRAL_USER") ?: ""
val mavenCentralPassword = System.getenv("MAVEN_CENTRAL_PW") ?: ""

setPublications("DetektPublication")

pkg(delegateClosureOf<BintrayExtension.PackageConfig> {
repo = "code-analysis"
name = "detekt"
userOrg = "arturbosch"
setLicenses("Apache-2.0")
vcsUrl = "https://github.com/arturbosch/detekt"

version(delegateClosureOf<BintrayExtension.VersionConfig> {
name = project.version as? String
released = Date().toString()

gpg(delegateClosureOf<BintrayExtension.GpgConfig> {
sign = true
})

mavenCentralSync(delegateClosureOf<BintrayExtension.MavenCentralSyncConfig> {
sync = true
user = mavenCentralUser
password = mavenCentralPassword
close = "1"
})
})
})
}

tasks.withType(DokkaTask::class.java) {
// suppresses undocumented classes but not dokka warnings
// https://github.com/Kotlin/dokka/issues/229 && https://github.com/Kotlin/dokka/issues/319
reportUndocumented = false
outputFormat = "javadoc"
outputDirectory = "$buildDir/javadoc"
}

val sourcesJar by tasks.creating(Jar::class) {
dependsOn("classes")
classifier = "sources"
from(the<JavaPluginConvention>().sourceSets["main"].allSource)
}

val javadocJar by tasks.creating(Jar::class) {
dependsOn("dokka")
classifier = "javadoc"
from(buildDir.resolve("javadoc"))
}

artifacts {
add("archives", sourcesJar)
add("archives", javadocJar)
}

configure<PublishingExtension> {
publications.create<MavenPublication>("DetektPublication") {
from(components["java"])
artifact(sourcesJar)
artifact(javadocJar)
groupId = rootProject.group as? String
artifactId = rootProject.name
version = rootProject.version as? String
pom.withXml {
asNode().apply {
appendNode("description", "Static code analysis for Kotlin")
appendNode("name", "detekt")
appendNode("url", "https://github.com/arturbosch/detekt")

val license = appendNode("licenses").appendNode("license")
license.appendNode("name", "The Apache Software License, Version 2.0")
license.appendNode("url", "http://www.apache.org/licenses/LICENSE-2.0.txt")
license.appendNode("distribution", "repo")

val developer = appendNode("developers").appendNode("developer")
developer.appendNode("id", "Artur Bosch")
developer.appendNode("name", "Artur Bosch")
developer.appendNode("email", "arturbosch@gmx.de")

appendNode("scm").appendNode("url", "https://github.com/arturbosch/detekt")
}
}
}
}
@@ -1,14 +1,11 @@
package io.gitlab.arturbosch.detekt.sample.extensions

import io.gitlab.arturbosch.detekt.api.Rule
import io.gitlab.arturbosch.detekt.sample.extensions.rules.TooManyFunctions
import io.gitlab.arturbosch.detekt.test.RuleTest
import io.gitlab.arturbosch.detekt.test.lint
import org.assertj.core.api.Assertions.assertThat
import org.jetbrains.spek.api.dsl.describe
import org.jetbrains.spek.api.dsl.it
import org.jetbrains.spek.subject.SubjectSpek
import org.junit.jupiter.api.Test

/**
* @author Artur Bosch
Expand All @@ -26,17 +23,7 @@ class TooManyFunctionsSpec : SubjectSpek<TooManyFunctions>({
}
})

class TooManyFunctionsTest : RuleTest {

override val rule: Rule = TooManyFunctions()

@Test fun findOneFile() {
val findings = rule.lint(code)
assertThat(findings).hasSize(1)
}
}

val code: String =
const val code: String =
"""
class TooManyFunctions : Rule("TooManyFunctions") {

Expand Down
Expand Up @@ -52,7 +52,7 @@ val result = object : Detektion {
}
}

val code = """
const val code = """
package io.gitlab.arturbosch.detekt.sample

class Foo {}
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
@@ -1,5 +1,5 @@
detektVersion=1.0.0.RC7-3
usedDetektVersion=1.0.0.RC7-3
detektVersion=1.0.0.RC8
usedDetektVersion=1.0.0.RC8
ktlintVersion=0.24.0
kotlinVersion=1.2.51
spekVersion=1.1.5
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Expand Up @@ -15,7 +15,7 @@ pluginManagement {
resolutionStrategy {
eachPlugin {
if (requested.id.id == "io.gitlab.arturbosch.detekt") {
useModule("io.gitlab.arturbosch:detekt-gradle-plugin:1") // version ignored for composite build
useModule("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1") // version ignored for composite build
}
}
}
Expand Down