Fixed uptime months calculation

This commit is contained in:
Erik C. Thauvin 2022-11-21 10:13:44 -08:00
parent a2646ceb9f
commit b6e1888e70
12 changed files with 32 additions and 24 deletions

2
.idea/kotlinc.xml generated
View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.7.20" />
<option name="version" value="1.7.21" />
</component>
</project>

5
.idea/misc.xml generated
View file

@ -4,5 +4,8 @@
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="18" project-jdk-type="JavaSDK" />
<component name="PDMPlugin">
<option name="skipTestSources" value="false" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="19" project-jdk-type="JavaSDK" />
</project>

View file

@ -1,14 +1,14 @@
plugins {
id 'application'
id 'com.github.ben-manes.versions' version '0.42.0'
id 'com.github.ben-manes.versions' version '0.44.0'
id 'idea'
id 'io.gitlab.arturbosch.detekt' version '1.21.0'
id 'io.gitlab.arturbosch.detekt' version '1.22.0'
id 'java'
id 'net.thauvin.erik.gradle.semver' version '1.0.4'
id 'org.jetbrains.kotlin.jvm' version '1.7.20'
id 'org.jetbrains.kotlin.kapt' version '1.7.20'
id 'org.jetbrains.kotlin.jvm' version '1.7.21'
id 'org.jetbrains.kotlin.kapt' version '1.7.21'
id 'org.jetbrains.kotlinx.kover' version '0.6.1'
id 'org.sonarqube' version '3.4.0.2513'
id 'org.sonarqube' version '3.5.0.2730'
id 'pmd'
}
@ -30,7 +30,7 @@ mainClassName = packageName + '.Mobibot'
ext.versions = [
log4j: '2.19.0',
pmd : '6.50.0',
pmd : '6.51.0',
]
repositories {
@ -55,7 +55,7 @@ dependencies {
implementation 'commons-net:commons-net:3.8.0'
// Google
implementation 'com.google.code.gson:gson:2.9.1'
implementation 'com.google.code.gson:gson:2.10'
implementation 'com.google.guava:guava:31.1-jre'
// Kotlin
@ -65,7 +65,7 @@ dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-cli:0.3.5'
// Logging
implementation 'org.slf4j:slf4j-api:2.0.3'
implementation 'org.slf4j:slf4j-api:2.0.4'
implementation "org.apache.logging.log4j:log4j-api:$versions.log4j"
implementation "org.apache.logging.log4j:log4j-core:$versions.log4j"
implementation "org.apache.logging.log4j:log4j-slf4j2-impl:$versions.log4j"
@ -76,7 +76,7 @@ dependencies {
implementation 'net.objecthunter:exp4j:0.4.8'
implementation 'org.json:json:20220924'
implementation 'org.jsoup:jsoup:1.15.3'
implementation 'org.twitter4j:twitter4j-core:4.1.0'
implementation 'org.twitter4j:twitter4j-core:4.1.2'
// Thauvin
implementation 'net.thauvin.erik:cryptoprice:1.0.0'

View file

@ -2,8 +2,8 @@
<SmellBaseline>
<ManuallySuppressedIssues></ManuallySuppressedIssues>
<CurrentIssues>
<ID>ComplexMethod:FeedsMgr.kt$FeedsMgr.Companion$@JvmStatic fun saveFeed(entries: Entries, currentFile: String = currentXml)</ID>
<ID>ComplexMethod:Weather2.kt$Weather2.Companion$@JvmStatic @Throws(ModuleException::class) fun getWeather(query: String, apiKey: String?): List&lt;Message&gt;</ID>
<ID>CyclomaticComplexMethod:FeedsMgr.kt$FeedsMgr.Companion$@JvmStatic fun saveFeed(entries: Entries, currentFile: String = currentXml)</ID>
<ID>CyclomaticComplexMethod:Weather2.kt$Weather2.Companion$@JvmStatic @Throws(ModuleException::class) fun getWeather(query: String, apiKey: String?): List&lt;Message&gt;</ID>
<ID>LongMethod:FeedsMgr.kt$FeedsMgr.Companion$@JvmStatic fun saveFeed(entries: Entries, currentFile: String = currentXml)</ID>
<ID>LongMethod:Mobibot.kt$Mobibot.Companion$@JvmStatic @Throws(Exception::class) fun main(args: Array&lt;String&gt;)</ID>
<ID>LongMethod:StockQuote.kt$StockQuote.Companion$@JvmStatic @Throws(ModuleException::class) fun getQuote(symbol: String, apiKey: String?): List&lt;Message&gt;</ID>

Binary file not shown.

View file

@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-rc-3-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

12
gradlew vendored
View file

@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@ -80,10 +80,10 @@ do
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac

1
gradlew.bat vendored
View file

@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

View file

@ -77,7 +77,7 @@ class Info(private val tell: Tell, private val seen: Seen) : AbstractCommand() {
append(years).append(" year".plural(years)).append(' ')
}
if (months > 0) {
append(weeks).append(" month".plural(months)).append(' ')
append(months).append(" month".plural(months)).append(' ')
}
if (weeks > 0) {
append(weeks).append(" week".plural(weeks)).append(' ')

View file

@ -49,7 +49,6 @@ class WolframAlpha : ThreadedModule() {
override val name = "WolframAlpha"
private fun getUnits(unit: String?): String {
println("--> $unit")
return if (unit?.lowercase() == METRIC) {
METRIC
} else {

View file

@ -43,7 +43,7 @@ class InfoTest {
assertThat(
547800300076L.toUptime(),
"upTime(full)"
).isEqualTo("17 years 2 months 2 weeks 1 day 6 hours 45 minutes")
).isEqualTo("17 years 4 months 2 weeks 1 day 6 hours 45 minutes")
assertThat(24300000L.toUptime(), "upTime(hours minutes)").isEqualTo("6 hours 45 minutes")
assertThat(110700000L.toUptime(), "upTime(days hours minutes)").isEqualTo("1 day 6 hours 45 minutes")
assertThat(

View file

@ -1,9 +1,9 @@
#Generated by the Semver Plugin for Gradle
#Wed Oct 12 20:28:52 PDT 2022
version.buildmeta=751
#Mon Nov 21 10:09:13 PST 2022
version.buildmeta=764
version.major=0
version.minor=8
version.patch=0
version.prerelease=rc
version.project=mobibot
version.semver=0.8.0-rc+751
version.semver=0.8.0-rc+764