Added klint checks.
This commit is contained in:
parent
aed7e8434f
commit
7ef125db3b
3 changed files with 33 additions and 22 deletions
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Erik's Code Style" />
|
||||||
|
</state>
|
||||||
|
</component>
|
|
@ -17,6 +17,7 @@ plugins {
|
||||||
id("com.github.ben-manes.versions") version "0.20.0"
|
id("com.github.ben-manes.versions") version "0.20.0"
|
||||||
id("com.jfrog.bintray") version "1.8.3"
|
id("com.jfrog.bintray") version "1.8.3"
|
||||||
id("org.jetbrains.dokka") version "0.9.17"
|
id("org.jetbrains.dokka") version "0.9.17"
|
||||||
|
id("org.jlleitschuh.gradle.ktlint") version "4.1.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "net.thauvin.erik"
|
group = "net.thauvin.erik"
|
||||||
|
@ -26,7 +27,7 @@ description = "Pinboard Poster for Kotlin/Java"
|
||||||
val gitHub = "ethauvin/$name"
|
val gitHub = "ethauvin/$name"
|
||||||
val mavenUrl = "https://github.com/$gitHub"
|
val mavenUrl = "https://github.com/$gitHub"
|
||||||
val deployDir = "deploy"
|
val deployDir = "deploy"
|
||||||
var isRelease = "release" in gradle.startParameter.taskNames
|
var isRelease = "release" in gradle.startParameter.taskNames
|
||||||
|
|
||||||
// Load local.properties
|
// Load local.properties
|
||||||
File("local.properties").apply {
|
File("local.properties").apply {
|
||||||
|
@ -127,6 +128,9 @@ tasks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val check by getting {
|
||||||
|
dependsOn("ktlintCheck")
|
||||||
|
}
|
||||||
|
|
||||||
val publicationName = "mavenJava"
|
val publicationName = "mavenJava"
|
||||||
publishing {
|
publishing {
|
||||||
|
@ -212,6 +216,6 @@ tasks {
|
||||||
"release" {
|
"release" {
|
||||||
description = "Publishes version ${project.version} to Bintray."
|
description = "Publishes version ${project.version} to Bintray."
|
||||||
group = PublishingPlugin.PUBLISH_TASK_GROUP
|
group = PublishingPlugin.PUBLISH_TASK_GROUP
|
||||||
dependsOn(bintrayUpload)
|
dependsOn("wrapper", bintrayUpload)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -40,7 +40,7 @@ import java.io.StringReader
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.util.*
|
import java.util.Properties
|
||||||
import java.util.logging.Level
|
import java.util.logging.Level
|
||||||
import java.util.logging.Logger
|
import java.util.logging.Logger
|
||||||
import javax.xml.parsers.DocumentBuilderFactory
|
import javax.xml.parsers.DocumentBuilderFactory
|
||||||
|
@ -129,22 +129,24 @@ open class PinboardPoster() {
|
||||||
* @param description The title of the bookmark.
|
* @param description The title of the bookmark.
|
||||||
* @param extended The description of the bookmark.
|
* @param extended The description of the bookmark.
|
||||||
* @param tags A list of up to 100 tags.
|
* @param tags A list of up to 100 tags.
|
||||||
* @param dt The creation time of the bookmark.
|
* @param dt The creation time of the bookmark.
|
||||||
* @param replace Replace any existing bookmark with the specified URL. Default `true`.
|
* @param replace Replace any existing bookmark with the specified URL. Default `true`.
|
||||||
* @param shared Make bookmark public. Default is `true`.
|
* @param shared Make bookmark public. Default is `true`.
|
||||||
* @param toRead Mark the bookmark as unread. Default is `false`.
|
* @param toRead Mark the bookmark as unread. Default is `false`.
|
||||||
*
|
*
|
||||||
* @return `true` if bookmark was successfully added.
|
* @return `true` if bookmark was successfully added.
|
||||||
*/
|
*/
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun addPin(url: String,
|
fun addPin(
|
||||||
description: String,
|
url: String,
|
||||||
extended: String = "",
|
description: String,
|
||||||
tags: String = "",
|
extended: String = "",
|
||||||
dt: String = "",
|
tags: String = "",
|
||||||
replace: Boolean = true,
|
dt: String = "",
|
||||||
shared: Boolean = true,
|
replace: Boolean = true,
|
||||||
toRead: Boolean = false): Boolean {
|
shared: Boolean = true,
|
||||||
|
toRead: Boolean = false
|
||||||
|
): Boolean {
|
||||||
if (validate()) {
|
if (validate()) {
|
||||||
if (!validateUrl(url)) {
|
if (!validateUrl(url)) {
|
||||||
logger.severe("Please specify a valid URL to pin.")
|
logger.severe("Please specify a valid URL to pin.")
|
||||||
|
@ -152,14 +154,14 @@ open class PinboardPoster() {
|
||||||
logger.severe("Please specify a valid description.")
|
logger.severe("Please specify a valid description.")
|
||||||
} else {
|
} else {
|
||||||
val params = listOf(
|
val params = listOf(
|
||||||
Pair("url", url),
|
Pair("url", url),
|
||||||
Pair("description", description),
|
Pair("description", description),
|
||||||
Pair("extended", extended),
|
Pair("extended", extended),
|
||||||
Pair("tags", tags),
|
Pair("tags", tags),
|
||||||
Pair("dt", dt),
|
Pair("dt", dt),
|
||||||
Pair("replace", yesNo(replace)),
|
Pair("replace", yesNo(replace)),
|
||||||
Pair("shared", yesNo(shared)),
|
Pair("shared", yesNo(shared)),
|
||||||
Pair("toread", yesNo(toRead))
|
Pair("toread", yesNo(toRead))
|
||||||
)
|
)
|
||||||
return executeMethod("posts/add", params)
|
return executeMethod("posts/add", params)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue