Respond to sonarcloud maint issues#155
Closed
kruton wants to merge 2 commits into
Closed
Conversation
Extract constants, add comments about intent in empty methods, set cognitive complexity limits for special files
Contributor
There was a problem hiding this comment.
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 valconstants acrosssshlib. - Move SonarQube/SonarCloud configuration from
:sshlibto the root project and update CI to run./gradlew sonar. - Enable Kover in
:protocoland 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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


No description provided.