Added klint checks.

This commit is contained in:
Erik C. Thauvin 2018-06-30 23:27:34 -07:00
parent aed7e8434f
commit 7ef125db3b
3 changed files with 33 additions and 22 deletions

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View file

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Erik's Code Style" />
</state>
</component>

View file

@ -17,6 +17,7 @@ plugins {
id("com.github.ben-manes.versions") version "0.20.0"
id("com.jfrog.bintray") version "1.8.3"
id("org.jetbrains.dokka") version "0.9.17"
id("org.jlleitschuh.gradle.ktlint") version "4.1.0"
}
group = "net.thauvin.erik"
@ -26,7 +27,7 @@ description = "Pinboard Poster for Kotlin/Java"
val gitHub = "ethauvin/$name"
val mavenUrl = "https://github.com/$gitHub"
val deployDir = "deploy"
var isRelease = "release" in gradle.startParameter.taskNames
var isRelease = "release" in gradle.startParameter.taskNames
// Load local.properties
File("local.properties").apply {
@ -127,6 +128,9 @@ tasks {
}
}
val check by getting {
dependsOn("ktlintCheck")
}
val publicationName = "mavenJava"
publishing {
@ -212,6 +216,6 @@ tasks {
"release" {
description = "Publishes version ${project.version} to Bintray."
group = PublishingPlugin.PUBLISH_TASK_GROUP
dependsOn(bintrayUpload)
dependsOn("wrapper", bintrayUpload)
}
}

View file

@ -40,7 +40,7 @@ import java.io.StringReader
import java.net.URL
import java.nio.file.Files
import java.nio.file.Path
import java.util.*
import java.util.Properties
import java.util.logging.Level
import java.util.logging.Logger
import javax.xml.parsers.DocumentBuilderFactory
@ -129,22 +129,24 @@ open class PinboardPoster() {
* @param description The title of the bookmark.
* @param extended The description of the bookmark.
* @param tags A list of up to 100 tags.
* @param dt The creation time of the bookmark.
* @param replace Replace any existing bookmark with the specified URL. Default `true`.
* @param shared Make bookmark public. Default is `true`.
* @param dt The creation time of the bookmark.
* @param replace Replace any existing bookmark with the specified URL. Default `true`.
* @param shared Make bookmark public. Default is `true`.
* @param toRead Mark the bookmark as unread. Default is `false`.
*
* @return `true` if bookmark was successfully added.
*/
@JvmOverloads
fun addPin(url: String,
description: String,
extended: String = "",
tags: String = "",
dt: String = "",
replace: Boolean = true,
shared: Boolean = true,
toRead: Boolean = false): Boolean {
fun addPin(
url: String,
description: String,
extended: String = "",
tags: String = "",
dt: String = "",
replace: Boolean = true,
shared: Boolean = true,
toRead: Boolean = false
): Boolean {
if (validate()) {
if (!validateUrl(url)) {
logger.severe("Please specify a valid URL to pin.")
@ -152,14 +154,14 @@ open class PinboardPoster() {
logger.severe("Please specify a valid description.")
} else {
val params = listOf(
Pair("url", url),
Pair("description", description),
Pair("extended", extended),
Pair("tags", tags),
Pair("dt", dt),
Pair("replace", yesNo(replace)),
Pair("shared", yesNo(shared)),
Pair("toread", yesNo(toRead))
Pair("url", url),
Pair("description", description),
Pair("extended", extended),
Pair("tags", tags),
Pair("dt", dt),
Pair("replace", yesNo(replace)),
Pair("shared", yesNo(shared)),
Pair("toread", yesNo(toRead))
)
return executeMethod("posts/add", params)
}