Skip to content

Commit 9f0aeaf

Browse files
committed
chore: address sonar issues
1 parent 6bc7da5 commit 9f0aeaf

8 files changed

Lines changed: 28 additions & 1 deletion

File tree

application/src/main/java/org/togetherjava/tjbot/Application.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public static void main(final String[] args) {
8888
* Runs an instance of the bot, connecting to the given token and using the given database.
8989
*
9090
* @param config the configuration to run the bot with
91+
* @param secrets the secrets to run the bot with
9192
*/
9293
@SuppressWarnings("WeakerAccess")
9394
public static void runBot(Config config, Secrets secrets) {

application/src/main/java/org/togetherjava/tjbot/features/Features.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ private Features() {
105105
* @param jda the JDA instance commands will be registered at
106106
* @param database the database of the application, which features can use to persist data
107107
* @param config the configuration features should use
108+
* @param secrets the secrets features may need
108109
* @return a collection of all features
109110
*/
110111
public static Collection<Feature> createFeatures(JDA jda, Database database, Config config,

application/src/main/java/org/togetherjava/tjbot/features/filesharing/FileSharingMessageListener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ public final class FileSharingMessageListener extends MessageReceiverAdapter
5656
/**
5757
* Creates a new instance.
5858
*
59-
* @param config used to get api key and channel names.
59+
* @param config used to get channel names.
60+
* @param secrets used to get api key
6061
* @see org.togetherjava.tjbot.features.Features
6162
*/
6263
public FileSharingMessageListener(Config config, Secrets secrets) {

application/src/main/java/org/togetherjava/tjbot/features/github/GitHubReference.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public final class GitHubReference extends MessageReceiverAdapter {
8282
* a predicate for matching allowed channels for feature and acquires repositories.
8383
*
8484
* @param config The Config to get allowed channel pattern for feature.
85+
* @param secrets The Secrets to get the GitHub API key.
8586
*/
8687
public GitHubReference(Config config, Secrets secrets) {
8788
this.config = config;

application/src/main/java/org/togetherjava/tjbot/features/jshell/JShellEval.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class JShellEval {
3636
* Creates a JShell evaluation instance
3737
*
3838
* @param config the JShell configuration to use
39+
* @param baseUrl the base URL for the JSHell API
3940
* @param gistApiToken token of Gist api in case a JShell result is uploaded here
4041
*/
4142
public JShellEval(JShellConfig config, String baseUrl, String gistApiToken) {

application/src/main/java/org/togetherjava/tjbot/features/system/BotCore.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public final class BotCore extends ListenerAdapter implements CommandProvider {
9595
* @param jda the JDA instance that this command system will be used with
9696
* @param database the database that commands may use to persist data
9797
* @param config the configuration to use for this system
98+
* @param secrets the secrets to use for this system
9899
*/
99100
public BotCore(JDA jda, Database database, Config config, Secrets secrets) {
100101
this.config = config;

application/src/main/java/org/togetherjava/tjbot/secrets/Secrets.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
import java.nio.file.Path;
1010
import java.util.Objects;
1111

12+
/**
13+
* This class contains secrets such as API keys, tokens etc., used by the application.
14+
*/
1215
public class Secrets {
1316
private final String token;
1417
private final String githubApiKey;
@@ -35,6 +38,13 @@ private Secrets(@JsonProperty(value = "token", required = true) String token,
3538
this.jshellBaseUrl = Objects.requireNonNull(jshellBaseUrl);
3639
}
3740

41+
/**
42+
* Loads the configuration from the given file.
43+
*
44+
* @param path the location to secrets file
45+
* @return the loaded configuration
46+
* @throws IOException if the file could not be loaded
47+
*/
3848
public static Secrets load(Path path) throws IOException {
3949
return new ObjectMapper().registerModule(new JavaTimeModule())
4050
.readValue(path.toFile(), Secrets.class);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* This package contains the secrets of the application. It revolves around the class
3+
* {@link org.togetherjava.tjbot.secrets.Secrets}.
4+
*/
5+
@MethodsReturnNonnullByDefault
6+
@ParametersAreNonnullByDefault
7+
package org.togetherjava.tjbot.secrets;
8+
9+
import org.togetherjava.tjbot.annotations.MethodsReturnNonnullByDefault;
10+
11+
import javax.annotation.ParametersAreNonnullByDefault;

0 commit comments

Comments
 (0)