Skip to content

Respond to sonarcloud maint issues#155

Closed
kruton wants to merge 2 commits into
mainfrom
sonarcloud
Closed

Respond to sonarcloud maint issues#155
kruton wants to merge 2 commits into
mainfrom
sonarcloud

Conversation

@kruton
Copy link
Copy Markdown
Member

@kruton kruton commented May 21, 2026

No description provided.

kruton added 2 commits May 21, 2026 12:03
Extract constants, add comments about intent in empty methods, set
cognitive complexity limits for special files
Copilot AI review requested due to automatic review settings May 21, 2026 19:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR primarily addresses SonarCloud maintainability findings by reducing duplicated string literals in the SSH library and centralizing SonarCloud configuration at the root Gradle project, updating CI accordingly.

Changes:

  • Replace repeated string literals (error messages, algorithm names, identifiers) with named const val constants across sshlib.
  • Move SonarQube/SonarCloud configuration from :sshlib to the root project and update CI to run ./gradlew sonar.
  • Enable Kover in :protocol and aggregate coverage configuration at the root.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sshlib/src/main/kotlin/org/connectbot/sshlib/SshClient.kt Introduces constants for repeated messages/localhost usage to reduce duplication.
sshlib/src/main/kotlin/org/connectbot/sshlib/HostKeyVerifier.kt Replaces empty default methods with commented no-op bodies for clarity/tooling.
sshlib/src/main/kotlin/org/connectbot/sshlib/crypto/PrivateKeyReader.kt Extracts OpenSSH PEM boundary strings into constants.
sshlib/src/main/kotlin/org/connectbot/sshlib/crypto/PacketMac.kt Replaces empty destroy() with documented no-op body.
sshlib/src/main/kotlin/org/connectbot/sshlib/crypto/PacketCipher.kt Replaces empty destroy() with documented no-op body.
sshlib/src/main/kotlin/org/connectbot/sshlib/crypto/PacketAead.kt Replaces empty destroy() with documented no-op body.
sshlib/src/main/kotlin/org/connectbot/sshlib/crypto/KeyTypes.kt Extracts "ssh-ed25519" literal into a constant.
sshlib/src/main/kotlin/org/connectbot/sshlib/crypto/KeyEncryption.kt Extracts JCA cipher transformation strings into constants.
sshlib/src/main/kotlin/org/connectbot/sshlib/crypto/KeyDecryption.kt Extracts JCA cipher transformation strings into constants.
sshlib/src/main/kotlin/org/connectbot/sshlib/crypto/JavaMlKemProvider.kt Extracts reflective class/algorithm string literals into constants.
sshlib/src/main/kotlin/org/connectbot/sshlib/crypto/ed25519/Ed25519Provider.kt Adds file-level suppression and adjusts header/comment structure (currently problematic).
sshlib/src/main/kotlin/org/connectbot/sshlib/crypto/DiffieHellmanGroupExchange.kt Extracts repeated “group not set” exception text into a constant.
sshlib/src/main/kotlin/org/connectbot/sshlib/crypto/Algorithms.kt Extracts repeated hash/key-type literals into constants and reuses them in enums.
sshlib/src/main/kotlin/org/connectbot/sshlib/client/SshConnection.kt Extracts repeated protocol string literals into constants and simplifies host-bound handling.
sshlib/src/main/kotlin/org/connectbot/sshlib/AuthHandler.kt Replaces empty default hooks with commented no-op bodies for clarity/tooling.
sshlib/build.gradle.kts Removes SonarQube plugin/config from module (now centralized at root).
protocol/build.gradle.kts Adds Kover plugin to include protocol module in aggregated coverage.
build.gradle.kts Centralizes SonarCloud properties and configures aggregated Kover inputs.
.github/workflows/ci.yml Updates SonarCloud step to run root sonar task instead of :sshlib:sonar.
Comments suppressed due to low confidence (1)

sshlib/src/main/kotlin/org/connectbot/sshlib/crypto/ed25519/Ed25519Provider.kt:24

  • Ed25519Provider.kt now contains two full Apache 2.0 license headers back-to-back (one starting at line 1 and another starting at line 20) with conflicting copyright years. This duplication is likely unintentional and may confuse automated header checks (e.g., Spotless licenseHeader) and future maintainers. Keep a single header at the top (preferably matching the repository’s 2025-2026 pattern) and remove the redundant second block.
/*
 * ConnectBot SSH Library
 * Copyright 2025 Kenny Root
 *
 * Licensed under the Apache License, Version 2.0 (the "License");

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
64.9% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@kruton kruton closed this May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants