Skip to content

Commit 439c8dc

Browse files
committed
Add Qodana GHA and fixes
1 parent 10c0457 commit 439c8dc

File tree

6 files changed

+56
-5
lines changed

6 files changed

+56
-5
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Qodana
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- slash-commands
9+
10+
jobs:
11+
qodana:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
- name: 'Qodana Scan'
18+
uses: JetBrains/qodana-action@v2024.1
19+
env:
20+
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}

api/src/main/java/com/javadiscord/jdi/core/api/AutoModerationRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import java.util.List;
44

5+
import com.javadiscord.jdi.core.api.builders.CreateAutoModerationRuleBuilder;
56
import com.javadiscord.jdi.core.api.builders.ModifyAutoModerationRuleBuilder;
67
import com.javadiscord.jdi.core.models.auto_moderation.AutoModerationRule;
7-
import com.javadiscord.jdi.core.request.builders.CreateAutoModerationRuleBuilder;
88
import com.javadiscord.jdi.internal.api.auto_moderation.*;
99

1010
public class AutoModerationRequest {

api/src/main/java/com/javadiscord/jdi/core/api/builders/CreateAutoModerationRuleBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.javadiscord.jdi.core.request.builders;
1+
package com.javadiscord.jdi.core.api.builders;
22

33
import java.util.List;
44
import java.util.Optional;

example/lj-discord-bot/src/main/java/com/javadiscord/bot/utils/chatgpt/ChatGPT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ public Optional<String[]> ask(String question) {
104104
openAiHttpException.statusCode
105105
)
106106
);
107-
} catch (RuntimeException runtimeException) {
107+
} catch (RuntimeException e) {
108108
logger.warn(
109-
"There was an error using the OpenAI API: " + runtimeException.getMessage()
109+
"There was an error using the OpenAI API: {}", e.getMessage()
110110
);
111111
}
112112
return Optional.empty();

example/lj-discord-bot/src/main/java/com/javadiscord/bot/utils/chatgpt/ChatGPTResponseParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ private ChatGPTResponseParser() {}
1515
public static String[] parse(String response) {
1616
String[] partedResponse = new String[] {response};
1717
if (response.length() > RESPONSE_LENGTH_LIMIT) {
18-
logger.debug("Response to parse:\n" + response);
18+
logger.debug("Response to parse:\n{}", response);
1919
partedResponse = partitionAiResponse(response);
2020
}
2121
return partedResponse;

qodana.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#-------------------------------------------------------------------------------#
2+
# Qodana analysis is configured by qodana.yaml file #
3+
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
4+
#-------------------------------------------------------------------------------#
5+
version: "1.0"
6+
7+
#Specify inspection profile for code analysis
8+
profile:
9+
name: qodana.starter
10+
11+
#Enable inspections
12+
#include:
13+
# - name: <SomeEnabledInspectionId>
14+
15+
#Disable inspections
16+
#exclude:
17+
# - name: <SomeDisabledInspectionId>
18+
# paths:
19+
# - <path/where/not/run/inspection>
20+
21+
projectJDK: 21 #(Applied in CI/CD pipeline)
22+
23+
#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
24+
#bootstrap: sh ./prepare-qodana.sh
25+
26+
#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
27+
#plugins:
28+
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)
29+
30+
#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
31+
linter: jetbrains/qodana-jvm:latest

0 commit comments

Comments
 (0)