From 8e92ab430d116caacd330ec8e6d48a5960175c5f Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Fri, 30 Dec 2022 20:14:10 -0800 Subject: [PATCH] Minor cleanup --- lib/build.gradle.kts | 11 +- lib/pom.xml | 100 +++++++++--------- .../net/thauvin/erik/urlencoder/UrlEncoder.kt | 4 +- 3 files changed, 59 insertions(+), 56 deletions(-) diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index 87553fb..2ab1f25 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -16,12 +16,12 @@ plugins { id("signing") } -description = "URL parameters encoding and decoding" +description = "Encode and decode URL parameters" group = "net.thauvin.erik" version = "0.9-SNAPSHOT" val deployDir = "deploy" -val gitHub = "ethauvin/$name" +val gitHub = "ethauvin/${rootProject.name}" val mavenUrl = "https://github.com/$gitHub" val publicationName = "mavenJava" @@ -42,7 +42,8 @@ java { sonarqube { properties { - property("sonar.projectKey", "ethauvin_$name") + property("sonar.projectName", rootProject.name) + property("sonar.projectKey", "ethauvin_${rootProject.name}") property("sonar.organization", "ethauvin-github") property("sonar.host.url", "https://sonarcloud.io") property("sonar.sourceEncoding", "UTF-8") @@ -142,8 +143,8 @@ publishing { } } scm { - connection.set("scm:git:git://github.com/$gitHub.git") - developerConnection.set("scm:git:git@github.com:$gitHub.git") + connection.set("scm:git://github.com/$gitHub.git") + developerConnection.set("scm:git@github.com:$gitHub.git") url.set(mavenUrl) } issueManagement { diff --git a/lib/pom.xml b/lib/pom.xml index de47058..753ffa4 100644 --- a/lib/pom.xml +++ b/lib/pom.xml @@ -1,51 +1,53 @@ - - - - - - - 4.0.0 - net.thauvin.erik - urlencoder - 0.9-SNAPSHOT - urlencoder - URL parameters encoding and decoding - https://github.com/ethauvin/lib - - - The Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - - gbevin - Geert Bevin - gbevin@uwyn.com - - - ethauvin - Erik C. Thauvin - erik@thauvin.net - https://erik.thauvin.net/ - - - - scm:git:git://github.com/ethauvin/lib.git - scm:git:git@github.com:ethauvin/lib.git - https://github.com/ethauvin/lib - - - GitHub - https://github.com/ethauvin/lib/issues - - - - org.jetbrains.kotlin - kotlin-stdlib-jdk8 - 1.8.0 - compile - - + + + + + + + 4.0.0 + net.thauvin.erik + urlencoder + 0.9-SNAPSHOT + urlencoder + Encode and decode URL parameters + https://github.com/ethauvin/urlencoder + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + gbevin + Geert Bevin + gbevin@uwyn.com + + + ethauvin + Erik C. Thauvin + erik@thauvin.net + https://erik.thauvin.net/ + + + + scm:git://github.com/ethauvin/urlencoder.git + scm:git@github.com:ethauvin/urlencoder.git + https://github.com/ethauvin/urlencoder + + + GitHub + https://github.com/ethauvin/urlencoder/issues + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + 1.8.0 + compile + + diff --git a/lib/src/main/kotlin/net/thauvin/erik/urlencoder/UrlEncoder.kt b/lib/src/main/kotlin/net/thauvin/erik/urlencoder/UrlEncoder.kt index 32fb483..63220e5 100644 --- a/lib/src/main/kotlin/net/thauvin/erik/urlencoder/UrlEncoder.kt +++ b/lib/src/main/kotlin/net/thauvin/erik/urlencoder/UrlEncoder.kt @@ -50,7 +50,7 @@ object UrlEncoder { // see https://www.rfc-editor.org/rfc/rfc3986#page-13 private fun Char.isUnreserved(): Boolean { - return if (this > '~') false else unreservedChars.get(this.code) + return this <= '~' && unreservedChars.get(code) } private fun StringBuilder.appendEncodedDigit(digit: Int) { @@ -122,7 +122,7 @@ object UrlEncoder { /** * Transforms a provided [String] object into a new string, containing only valid URL characters in the UTF-8 - * encoding. Letters, numbers, unreserved ("_-!.~'()*") and allowed characters are left intact. + * encoding. Letters, numbers, unreserved (`_-!.~'()*`) and allowed characters are left intact. */ @JvmStatic fun encode(source: String, vararg allow: Char): String {