Skip to content

Commit

Permalink
Add Qodana GHA and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
surajkumar committed May 29, 2024
1 parent 10c0457 commit 439c8dc
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 5 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/qodana_code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Qodana
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- slash-commands

jobs:
qodana:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 'Qodana Scan'
uses: JetBrains/[email protected]
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import java.util.List;

import com.javadiscord.jdi.core.api.builders.CreateAutoModerationRuleBuilder;
import com.javadiscord.jdi.core.api.builders.ModifyAutoModerationRuleBuilder;
import com.javadiscord.jdi.core.models.auto_moderation.AutoModerationRule;
import com.javadiscord.jdi.core.request.builders.CreateAutoModerationRuleBuilder;
import com.javadiscord.jdi.internal.api.auto_moderation.*;

public class AutoModerationRequest {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.javadiscord.jdi.core.request.builders;
package com.javadiscord.jdi.core.api.builders;

import java.util.List;
import java.util.Optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ public Optional<String[]> ask(String question) {
openAiHttpException.statusCode
)
);
} catch (RuntimeException runtimeException) {
} catch (RuntimeException e) {
logger.warn(
"There was an error using the OpenAI API: " + runtimeException.getMessage()
"There was an error using the OpenAI API: {}", e.getMessage()
);
}
return Optional.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ private ChatGPTResponseParser() {}
public static String[] parse(String response) {
String[] partedResponse = new String[] {response};
if (response.length() > RESPONSE_LENGTH_LIMIT) {
logger.debug("Response to parse:\n" + response);
logger.debug("Response to parse:\n{}", response);
partedResponse = partitionAiResponse(response);
}
return partedResponse;
Expand Down
31 changes: 31 additions & 0 deletions qodana.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#-------------------------------------------------------------------------------#
# Qodana analysis is configured by qodana.yaml file #
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
#-------------------------------------------------------------------------------#
version: "1.0"

#Specify inspection profile for code analysis
profile:
name: qodana.starter

#Enable inspections
#include:
# - name: <SomeEnabledInspectionId>

#Disable inspections
#exclude:
# - name: <SomeDisabledInspectionId>
# paths:
# - <path/where/not/run/inspection>

projectJDK: 21 #(Applied in CI/CD pipeline)

#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
#bootstrap: sh ./prepare-qodana.sh

#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
#plugins:
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)

#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
linter: jetbrains/qodana-jvm:latest

0 comments on commit 439c8dc

Please sign in to comment.