Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,6 @@
## 1.0.9 - 2025-04-30
- bugfix, backward compatibility to JDK1.8 support to run in older IntelliJ IDEA version
- upload to pitest-gradle also, for pitest-gradle user, please uninstall pitest-gradle plugin and reinstall the new one manged in [testcraft](https://plugins.jetbrains.com/plugin/27221-testcraft-pro).

## 1.0.10 - 2025-05-06
- bugfix, git command execution in a separate thread to avoid UI blocking
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pluginName = TestCraft-Pro
pluginRepositoryUrl = https://github.com/jaksonlin/testcraft-pro
# SemVer format -> https://semver.org

pluginVersion = 1.0.9
pluginVersion = 1.0.10


# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.github.jaksonlin.testcraft.domain.annotations.AnnotationSchema;
import com.github.jaksonlin.testcraft.infrastructure.services.config.AnnotationConfigService;
import com.github.jaksonlin.testcraft.presentation.components.configuration.AnnotationSettingsComponent;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.jaksonlin.testcraft.application.settings;

import com.github.jaksonlin.testcraft.infrastructure.services.config.InvalidTestCaseConfigService;
import com.github.jaksonlin.testcraft.presentation.components.configuration.InvalidTestCaseSettingsComponent;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.options.Configurable;
import org.jetbrains.annotations.Nullable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.jaksonlin.testcraft.infrastructure.services.config.LLMConfigService;

import com.github.jaksonlin.testcraft.presentation.components.configuration.OllamaSettingsComponent;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.options.Configurable;
import org.jetbrains.annotations.Nls;
Expand Down Expand Up @@ -39,7 +40,7 @@
return false;
}
LLMConfigService.State state = llmConfigService.getState();
boolean modified = !settingsComponent.getHostText().equals(state.ollamaHost);

Check warning on line 43 in src/main/java/com/github/jaksonlin/testcraft/application/settings/OllamaSettingsConfigurable.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Nullability and data flow problems

Dereference of `state` may produce `NullPointerException`
modified |= !settingsComponent.getPortText().equals(String.valueOf(state.ollamaPort));
modified |= !settingsComponent.getModelText().equals(state.ollamaModel);
modified |= !settingsComponent.getMaxTokensText().equals(String.valueOf(state.maxTokens));
Expand All @@ -53,7 +54,7 @@
public void apply() {
try {
LLMConfigService.State state = llmConfigService.getState();
state.ollamaHost = settingsComponent.getHostText();

Check warning on line 57 in src/main/java/com/github/jaksonlin/testcraft/application/settings/OllamaSettingsConfigurable.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Nullability and data flow problems

Dereference of `state` may produce `NullPointerException`
state.ollamaPort = Integer.parseInt(settingsComponent.getPortText());
state.maxTokens = Integer.parseInt(settingsComponent.getMaxTokensText());
state.temperature = Float.parseFloat(settingsComponent.getTemperatureText());
Expand All @@ -72,7 +73,7 @@
public void reset() {
// Reset the settings component with the current state of the LLMService
LLMConfigService.State state = llmConfigService.getState();
settingsComponent.setHostText(state.ollamaHost);

Check warning on line 76 in src/main/java/com/github/jaksonlin/testcraft/application/settings/OllamaSettingsConfigurable.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Nullability and data flow problems

Dereference of `state` may produce `NullPointerException`
settingsComponent.setPortText(String.valueOf(state.ollamaPort));
settingsComponent.setModelText(state.ollamaModel);
settingsComponent.setMaxTokensText(String.valueOf(state.maxTokens));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.jaksonlin.testcraft.infrastructure.commands.pitest;

import com.github.jaksonlin.testcraft.domain.context.PitestContext;
import com.github.jaksonlin.testcraft.presentation.components.PitestOutputDialog;
import com.github.jaksonlin.testcraft.presentation.components.mutation.PitestOutputDialog;
import com.github.jaksonlin.testcraft.util.ProcessResult;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.github.jaksonlin.testcraft.infrastructure.commands.CommandCancellationException;
import com.github.jaksonlin.testcraft.domain.context.PitestContext;
import com.github.jaksonlin.testcraft.infrastructure.services.business.RunHistoryManagerService;
import com.github.jaksonlin.testcraft.presentation.components.PitestOutputDialog;
import com.github.jaksonlin.testcraft.presentation.components.mutation.PitestOutputDialog;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.project.Project;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.awt.*;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CountDownLatch;

Check warning on line 33 in src/main/java/com/github/jaksonlin/testcraft/infrastructure/commands/unittestannotations/GenerateAnnotationCommand.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import

Unused import `import java.util.concurrent.CountDownLatch;`
import java.util.stream.Collectors;

public class GenerateAnnotationCommand extends UnittestCaseCheckCommand {
Expand All @@ -48,9 +48,9 @@

@Override
public void execute() {
ProgressManager.getInstance().run(new Task.Backgroundable(getProject(), "Generating Annotations") {

Check warning on line 51 in src/main/java/com/github/jaksonlin/testcraft/infrastructure/commands/unittestannotations/GenerateAnnotationCommand.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Incorrect string capitalization

String 'Generating Annotations' is not properly capitalized. It should have sentence capitalization
@Override
public void run(ProgressIndicator indicator) {

Check warning on line 53 in src/main/java/com/github/jaksonlin/testcraft/infrastructure/commands/unittestannotations/GenerateAnnotationCommand.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

@NotNull/@Nullable problems

Not annotated parameter overrides @NotNull parameter
indicator.setIndeterminate(true);

PsiMethod[] methods = ReadAction.compute(() -> getContext().getPsiClass().getMethods());
Expand Down Expand Up @@ -152,30 +152,23 @@
}
}
if (selectedMethodCount > 0) {
CountDownLatch latch = new CountDownLatch(selectedMethodCount);
ProgressManager.getInstance().run(new Task.Backgroundable(getProject(), "Applying annotations") {
@Override
public void run(@NotNull ProgressIndicator indicator) {
indicator.setIndeterminate(true);
for (int i = 0; i < testMethods.size(); i++) {
if (selected[i]) {
int finalI = i;

Check warning on line 161 in src/main/java/com/github/jaksonlin/testcraft/infrastructure/commands/unittestannotations/GenerateAnnotationCommand.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Redundant local variable

Local variable `finalI` is redundant
ApplicationManager.getApplication().executeOnPooledThread(() -> {

try {
generateAnnotation(testMethods.get(finalI), getContext().getSchema());
} catch (Exception e) {
LOG.error("Failed to generate annotation", e);
} finally {
latch.countDown();
}
});

}
}
try {
latch.await();
} catch (InterruptedException e) {
LOG.error("Interrupted while waiting for latch", e);
}

}
});
}
Expand Down Expand Up @@ -208,7 +201,7 @@
{
addCheckboxTreeListener(new CheckboxTreeListener() {
@Override
public void nodeStateChanged(CheckedTreeNode node) {

Check warning on line 204 in src/main/java/com/github/jaksonlin/testcraft/infrastructure/commands/unittestannotations/GenerateAnnotationCommand.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

@NotNull/@Nullable problems

Not annotated parameter overrides @NotNull parameter
Object userObject = node.getUserObject();
if (userObject instanceof String) {
String methodName = (String) userObject;
Expand Down Expand Up @@ -249,7 +242,7 @@
});

WriteCommandAction.runWriteCommandAction(getProject(), () -> {
PsiDocumentManager.getInstance(getProject()).commitDocument(PsiDocumentManager.getInstance(getProject()).getDocument(psiMethod.getContainingFile()));

Check warning on line 245 in src/main/java/com/github/jaksonlin/testcraft/infrastructure/commands/unittestannotations/GenerateAnnotationCommand.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Nullability and data flow problems

Argument `PsiDocumentManager.getInstance(getProject()).getDocument(psiMethod.getContainingFile())` might be null

if (configService.isAutoImport()) {
addImportIfNeeded(psiMethod, schema.getAnnotationClassName());
Expand Down Expand Up @@ -314,7 +307,7 @@
annotationText.append("{");
if (value instanceof ArrayNode) {
ArrayNode arrayNode = (ArrayNode) value;
if (arrayNode != null) {

Check warning on line 310 in src/main/java/com/github/jaksonlin/testcraft/infrastructure/commands/unittestannotations/GenerateAnnotationCommand.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Constant values

Condition `arrayNode != null` is always `true`
for (int j = 0; j < arrayNode.size(); j++) {
String str = arrayNode.get(j).toString();
if (j > 0) annotationText.append(", ");
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

public interface IMutationMediator {
void processMutationResult(String mutationTargetClassFilePath, List<Mutation> mutationList);
void register(IMutationReportUI clientUI);
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.github.jaksonlin.testcraft.util.Mutation;
import com.github.jaksonlin.testcraft.util.Pair;

import javax.swing.*;

Check warning on line 8 in src/main/java/com/github/jaksonlin/testcraft/infrastructure/messaging/mediators/MutationMediatorImpl.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import

Unused import `import javax.swing.*;`
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand All @@ -14,17 +14,14 @@
import java.util.concurrent.Executors;

public class MutationMediatorImpl implements IMutationMediator {
protected IMutationReportUI clientUI;
private final ExecutorService executorService = Executors.newSingleThreadExecutor();
private final EventBusService eventBusService = EventBusService.getInstance();

@Override
public void processMutationResult(String mutationTargetClassFilePath, List<Mutation> mutations) {
executorService.submit(() -> {
Map<Integer, Pair<String, Boolean>> renderedFormat = convertResultToUIRenderFormat(mutations);
if (clientUI != null) {
eventBusService.post(new MutationEvent(MutationEvent.MUTATION_RESULT, new Pair<String, Map<Integer, Pair<String, Boolean>>>(mutationTargetClassFilePath, renderedFormat)));
}
eventBusService.post(new MutationEvent(MutationEvent.MUTATION_RESULT, new Pair<String, Map<Integer, Pair<String, Boolean>>>(mutationTargetClassFilePath, renderedFormat)));
});
}

Expand Down Expand Up @@ -65,8 +62,5 @@
return groupNumber + " " + mutation.getDescription() + " -> " + mutation.getStatus();
}

@Override
public void register(IMutationReportUI clientUI) {
this.clientUI = clientUI;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import com.github.jaksonlin.testcraft.domain.annotations.ValueProviderType;
import com.github.jaksonlin.testcraft.domain.context.CaseCheckContext;
import com.github.jaksonlin.testcraft.util.GitUtil;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.Service;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Computable;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import org.jetbrains.annotations.NotNull;
Expand All @@ -29,37 +31,39 @@

@Nullable
public Object provideValue(@NotNull ValueProvider provider, @NotNull CaseCheckContext context) {
ValueProviderType type = provider.getType();
if (type != null) {
switch (type) {
case GIT_AUTHOR:
return getGitAuthor();
case LAST_MODIFIER_AUTHOR:
return getLastModifierAuthor(context.getPsiMethod());
case LAST_MODIFIER_TIME:
return getLastModifierTime(context.getPsiMethod());
case CURRENT_DATE:
return getCurrentDate(provider.getFormat());
case METHOD_NAME_BASED:
return generateDescription(context.getPsiMethod());
case FIXED_VALUE:
return provider.getValue();
case CLASS_NAME:
return guessClassUnderTestClassName(context.getPsiClass());
case METHOD_NAME:
return guessMethodUnderTestMethodName(context.getPsiMethod());
case METHOD_SIGNATURE:
String signature = tryGetMethodUnderTestSignature(context.getPsiClass(), context.getPsiMethod());
return signature != null ? signature : "";
case FIRST_CREATOR_AUTHOR:
return getFirstCreatorAuthor(context.getPsiMethod());
case FIRST_CREATOR_TIME:
return getFirstCreatorTime(context.getPsiMethod());
default:
return null;
return ApplicationManager.getApplication().runReadAction((Computable<Object>)() -> {
ValueProviderType type = provider.getType();
if (type != null) {
switch (type) {
case GIT_AUTHOR:
return getGitAuthor();
case LAST_MODIFIER_AUTHOR:
return getLastModifierAuthor(context.getPsiMethod());
case LAST_MODIFIER_TIME:
return getLastModifierTime(context.getPsiMethod());
case CURRENT_DATE:
return getCurrentDate(provider.getFormat());
case METHOD_NAME_BASED:
return generateDescription(context.getPsiMethod());
case FIXED_VALUE:
return provider.getValue();
case CLASS_NAME:
return guessClassUnderTestClassName(context.getPsiClass());
case METHOD_NAME:
return guessMethodUnderTestMethodName(context.getPsiMethod());
case METHOD_SIGNATURE:
String signature = tryGetMethodUnderTestSignature(context.getPsiClass(), context.getPsiMethod());
return signature != null ? signature : "";
case FIRST_CREATOR_AUTHOR:
return getFirstCreatorAuthor(context.getPsiMethod());
case FIRST_CREATOR_TIME:
return getFirstCreatorTime(context.getPsiMethod());
default:
return null;
}
}
}
return null;
return null;
});
}

private String getGitAuthor() {
Expand All @@ -73,9 +77,9 @@

private String getLastModifierTime(@NotNull PsiMethod psiMethod) {
Long timestamp = GitUtil.getLastModifyInfo(project, psiMethod).getTimestamp();
timestamp = timestamp != null ? timestamp * 1000 : null;

Check warning on line 80 in src/main/java/com/github/jaksonlin/testcraft/infrastructure/services/business/AnnotationValueProviderService.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Constant values

Condition `timestamp != null` is always `true`
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return dateFormat.format(new Date(timestamp != null ? timestamp : System.currentTimeMillis()));

Check warning on line 82 in src/main/java/com/github/jaksonlin/testcraft/infrastructure/services/business/AnnotationValueProviderService.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Constant values

Condition `timestamp != null` is always `true`
}

private String getCurrentDate(@Nullable String format) {
Expand Down Expand Up @@ -161,7 +165,7 @@
StringBuilder sb = new StringBuilder();
Arrays.stream(psiMethod.getModifierList().getText().trim().split(" "))
.filter(s -> !s.isEmpty() && !s.startsWith("@"))
.collect(Collectors.joining(" ", sb, " "));

Check warning on line 168 in src/main/java/com/github/jaksonlin/testcraft/infrastructure/services/business/AnnotationValueProviderService.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Result of method call ignored

Result of `Stream.collect()` is ignored

if (!psiMethod.isConstructor()) {
sb.append(Objects.requireNonNull(psiMethod.getReturnType()).getPresentableText()).append(" ");
Expand Down Expand Up @@ -189,10 +193,10 @@
}

private String getFirstCreatorTime(@NotNull PsiMethod psiMethod) {
Long timestamp = GitUtil.getFirstCreatorInfo(project, psiMethod).getTimestamp();

Check warning on line 196 in src/main/java/com/github/jaksonlin/testcraft/infrastructure/services/business/AnnotationValueProviderService.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Nullability and data flow problems

Method invocation `getTimestamp` may produce `NullPointerException`
timestamp = timestamp != null ? timestamp * 1000 : null;

Check warning on line 197 in src/main/java/com/github/jaksonlin/testcraft/infrastructure/services/business/AnnotationValueProviderService.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Constant values

Condition `timestamp != null` is always `true`
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return dateFormat.format(new Date(timestamp != null ? timestamp : System.currentTimeMillis()));

Check warning on line 199 in src/main/java/com/github/jaksonlin/testcraft/infrastructure/services/business/AnnotationValueProviderService.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Constant values

Condition `timestamp != null` is always `true`
}

private static String capitalizeFirst(String str) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.jaksonlin.testcraft.application.settings;
package com.github.jaksonlin.testcraft.presentation.components.configuration;

import com.github.jaksonlin.testcraft.infrastructure.services.system.I18nService;
import com.intellij.json.JsonFileType;
Expand Down Expand Up @@ -96,7 +96,7 @@ public AnnotationSettingsComponent() {
c.gridx = 0;
c.gridy = 0;
c.weighty = 0.0;
JLabel importSettingsLabel = new JBLabel("<html><body><b>" + I18nService.getInstance().message("settings.annotation.import.title") + "</b></body></html>");
JLabel importSettingsLabel = new JBLabel("<html><b>" + I18nService.getInstance().message("settings.annotation.import.title") + "</b></html>");
contentPanel.add(importSettingsLabel, c);

// Package input
Expand All @@ -118,7 +118,7 @@ public AnnotationSettingsComponent() {
// Schema Configuration section
c.gridy = 4;
c.insets = new Insets(15, 5, 5, 5);
JLabel schemaLabel = new JBLabel("<html><body><b>" + I18nService.getInstance().message("settings.annotation.schema.title") + "</b></body></html>");
JLabel schemaLabel = new JBLabel("<html><b>" + I18nService.getInstance().message("settings.annotation.schema.title") + "</b></html>");
contentPanel.add(schemaLabel, c);

// Schema editor
Expand All @@ -142,7 +142,7 @@ public AnnotationSettingsComponent() {
JPanel helpPanel = new JPanel(new BorderLayout());
helpPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

JLabel helpText = new JBLabel("<html><body style='width: 600px'>" +
JLabel helpText = new JBLabel("<html>" +
"<h3>" + I18nService.getInstance().message("settings.annotation.schema.help.title") + "</h3>" +
"<p>" + I18nService.getInstance().message("settings.annotation.schema.help.intro") + "</p>" +

Expand All @@ -165,32 +165,10 @@ public AnnotationSettingsComponent() {
"<h4>" + I18nService.getInstance().message("settings.annotation.schema.help.valueProvider.title") + "</h4>" +
"<ul>" +
"<li>" + I18nService.getInstance().message("settings.annotation.schema.help.valueProvider.1") + "</li>" +
"<li>" + I18nService.getInstance().message("settings.annotation.schema.help.valueProvider.2") + "</li>" +
"<li>" + I18nService.getInstance().message("settings.annotation.schema.help.valueProvider.3") + "</li>" +
"</ul>" +

"<h4>" + I18nService.getInstance().message("settings.annotation.schema.help.example.title") + "</h4>" +
"<div style='background-color:rgb(46, 46, 46); padding: 10px; border-radius: 5px; font-family: monospace; white-space: pre; color: #e8e8e8; font-size: 10px;'>" +
EXAMPLE_JSON.replace("<", "&lt;").replace(">", "&gt;").replace("\n", "<br>").replace(" ", "&nbsp;") +
"</div>" +

"<h4>" + I18nService.getInstance().message("settings.annotation.schema.help.notes.title") + "</h4>" +
"<ul>" +
"<li>" + I18nService.getInstance().message("settings.annotation.schema.help.notes.1") + "</li>" +
"<li>" + I18nService.getInstance().message("settings.annotation.schema.help.notes.2") + "</li>" +
"<li>" + I18nService.getInstance().message("settings.annotation.schema.help.notes.3") + "</li>" +
"<li>" + I18nService.getInstance().message("settings.annotation.schema.help.notes.4") + "</li>" +
"<li>" + I18nService.getInstance().message("settings.annotation.schema.help.notes.5") + "</li>" +
"</ul>" +
"</body></html>");

// Create a scroll pane for the help text
JScrollPane scrollPane = new JScrollPane(helpText);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
"</html>");

helpPanel.add(scrollPane, BorderLayout.CENTER);
helpPanel.add(helpText, BorderLayout.CENTER);
contentPanel.add(helpPanel, c);

// Add content panel to main panel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.jaksonlin.testcraft.application.settings;
package com.github.jaksonlin.testcraft.presentation.components.configuration;

import com.github.jaksonlin.testcraft.infrastructure.services.system.I18nService;
import com.intellij.openapi.editor.EditorSettings;
Expand Down Expand Up @@ -90,7 +90,7 @@
EditorTextField editor = new EditorTextField() {
@Override
protected @NotNull EditorEx createEditor() {
EditorEx editor = (EditorEx) super.createEditor();

Check warning on line 93 in src/main/java/com/github/jaksonlin/testcraft/presentation/components/configuration/InvalidTestCaseSettingsComponent.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Redundant type cast

Casting `super.createEditor()` to `EditorEx` is redundant
editor.setVerticalScrollbarVisible(true);
editor.setHorizontalScrollbarVisible(true);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.jaksonlin.testcraft.application.settings;
package com.github.jaksonlin.testcraft.presentation.components.configuration;

import com.intellij.ui.components.JBLabel;
import com.intellij.ui.components.JBTextField;
Expand All @@ -12,8 +12,6 @@

import com.github.jaksonlin.testcraft.infrastructure.services.system.I18nService;

import com.github.jaksonlin.testcraft.infrastructure.services.system.I18nService;

public class OllamaSettingsComponent {
private final JPanel mainPanel;
private final JBTextField hostField = new JBTextField();
Expand All @@ -35,7 +33,7 @@

// Connection Settings Section
JPanel connectionPanel = createSectionPanel(I18nService.getInstance().message("llm.settings.connection.title"));
GridBagConstraints c = new GridBagConstraints();

Check warning on line 36 in src/main/java/com/github/jaksonlin/testcraft/presentation/components/configuration/OllamaSettingsComponent.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Write-only object

Write-only object
c.insets = JBUI.insets(5);
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.LINE_START;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.jaksonlin.testcraft.presentation.components;
package com.github.jaksonlin.testcraft.presentation.components.llmchat;

import com.github.jaksonlin.testcraft.infrastructure.messaging.events.ChatEvent;
import com.github.jaksonlin.testcraft.infrastructure.messaging.events.TypedEventObserver;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.jaksonlin.testcraft.presentation.components;
package com.github.jaksonlin.testcraft.presentation.components.llmchat;

import com.github.jaksonlin.testcraft.infrastructure.messaging.events.ChatEvent;
import com.github.jaksonlin.testcraft.infrastructure.messaging.events.LLMConfigEvent;
Expand All @@ -12,7 +12,7 @@
import org.commonmark.renderer.html.HtmlRenderer;
import com.intellij.ui.JBColor;
import java.awt.datatransfer.StringSelection;
import java.awt.Toolkit;

Check warning on line 15 in src/main/java/com/github/jaksonlin/testcraft/presentation/components/llmchat/LLMResponseComponent.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import

Unused import `import java.awt.Toolkit;`

import javax.swing.*;
import javax.swing.text.html.HTMLEditorKit;
Expand Down Expand Up @@ -64,7 +64,7 @@
private final TypedEventObserver<LLMConfigEvent> llmConfigObserver = new TypedEventObserver<LLMConfigEvent>(LLMConfigEvent.class) {
@Override
public void onTypedEvent(LLMConfigEvent event) {
switch (event.getEventType()) {

Check warning on line 67 in src/main/java/com/github/jaksonlin/testcraft/presentation/components/llmchat/LLMResponseComponent.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Minimum 'switch' branches

'switch' statement has too few case labels (1), and should probably be replaced with an 'if' statement
case LLMConfigEvent.CONFIG_CHANGE_COPY_AS_MARKDOWN:
copyAsMarkdown = (boolean) event.getPayload();
break;
Expand All @@ -76,7 +76,7 @@
private boolean copyAsMarkdown = false;

private final HTMLEditorKit htmlKit;
private final StyleSheet styleSheet;

Check warning on line 79 in src/main/java/com/github/jaksonlin/testcraft/presentation/components/llmchat/LLMResponseComponent.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Field can be local

Field can be converted to a local variable
private final JPanel masterPanel;
private final JPanel loadingPanel;
private final Timer loadingTimer;
Expand Down Expand Up @@ -292,7 +292,7 @@
}

private void updateOutputArea() {
String fullHtml = String.format(BASE_HTML_TEMPLATE, getCodeStyle(), chatHistory.toString());

Check warning on line 295 in src/main/java/com/github/jaksonlin/testcraft/presentation/components/llmchat/LLMResponseComponent.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unnecessary call to 'toString()'

Unnecessary `toString()` call
SwingUtilities.invokeLater(() -> {
try {
// Create a new document each time to avoid state issues
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.jaksonlin.testcraft.presentation.components;
package com.github.jaksonlin.testcraft.presentation.components.llmchat;

import com.github.jaksonlin.testcraft.domain.context.PitestContext;
import com.github.jaksonlin.testcraft.infrastructure.messaging.events.RunHistoryEvent;
Expand Down Expand Up @@ -49,13 +49,13 @@
private final TypedEventObserver<RunHistoryEvent> runHistoryEventObserver = new TypedEventObserver<RunHistoryEvent>(RunHistoryEvent.class) {
@Override
public void onTypedEvent(RunHistoryEvent event) {
switch (event.getEventType()) {

Check warning on line 52 in src/main/java/com/github/jaksonlin/testcraft/presentation/components/llmchat/LLMSuggestionUIComponent.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Minimum 'switch' branches

'switch' statement has too few case labels (1), and should probably be replaced with an 'if' statement
case RunHistoryEvent.RUN_HISTORY_LIST:
ApplicationManager.getApplication().invokeLater(() -> loadFileHistory(event.getPayload()));
break;
}
}
};;

Check warning on line 58 in src/main/java/com/github/jaksonlin/testcraft/presentation/components/llmchat/LLMSuggestionUIComponent.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unnecessary semicolon

Unnecessary semicolon `;`


private final ChatPanelComponent chatPanel = new ChatPanelComponent();
Expand All @@ -68,7 +68,7 @@
private final JComboBox<FileItem> fileSelector = new ComboBox<>(fileListModel);
private final JButton generateButton = new JButton(I18nService.getInstance().message("llm.generate.suggestions"));
private final JButton dryRunButton = new JButton(I18nService.getInstance().message("llm.check.prompt"));
private List<FileItem> allFileItems = new ArrayList<>();

Check warning on line 71 in src/main/java/com/github/jaksonlin/testcraft/presentation/components/llmchat/LLMSuggestionUIComponent.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Field may be 'final'

Field `allFileItems` may be 'final'

public LLMSuggestionUIComponent() {
setupUI();
Expand Down Expand Up @@ -152,7 +152,7 @@
return;
}

Map<String, PitestContext> history = (Map<String, PitestContext>) eventObj;

Check warning on line 155 in src/main/java/com/github/jaksonlin/testcraft/presentation/components/llmchat/LLMSuggestionUIComponent.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unchecked warning

Unchecked cast: 'java.lang.Object' to 'java.util.Map'
if (history.isEmpty()) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.jaksonlin.testcraft.presentation.components;
package com.github.jaksonlin.testcraft.presentation.components.mutation;


import com.github.jaksonlin.testcraft.presentation.viewmodels.MutationToolWindowViewModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.github.jaksonlin.testcraft.presentation.components;
package com.github.jaksonlin.testcraft.presentation.components.mutation;

import com.github.jaksonlin.testcraft.infrastructure.messaging.events.RunHistoryEvent;
import com.github.jaksonlin.testcraft.infrastructure.messaging.events.TypedEventObserver;
import com.github.jaksonlin.testcraft.infrastructure.services.system.EventBusService;
import com.github.jaksonlin.testcraft.infrastructure.services.system.I18nService;
import com.github.jaksonlin.testcraft.util.Pair;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -35,7 +34,7 @@
if (list.isEmpty()) {
initializeMutationTree(Collections.emptyList());
} else if (list.get(0) instanceof Pair) {
List<Pair<String, String>> nodeList = (List<Pair<String, String>>) list;

Check warning on line 37 in src/main/java/com/github/jaksonlin/testcraft/presentation/components/mutation/ObservableTree.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unchecked warning

Unchecked cast: 'java.util.List\>' to 'java.util.List\>'
initializeMutationTree(nodeList);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.jaksonlin.testcraft.presentation.components;
package com.github.jaksonlin.testcraft.presentation.components.mutation;

import com.github.jaksonlin.testcraft.infrastructure.services.system.I18nService;
import com.intellij.openapi.project.Project;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.jaksonlin.testcraft.presentation.components;
package com.github.jaksonlin.testcraft.presentation.components.premium;

import com.github.jaksonlin.testcraft.infrastructure.license.PremiumManager;

Expand All @@ -6,9 +6,9 @@


public class PremiumSettingsComponent {
private JPanel mainPanel;

Check warning on line 9 in src/main/java/com/github/jaksonlin/testcraft/presentation/components/premium/PremiumSettingsComponent.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Field may be 'final'

Field `mainPanel` may be 'final'
private JTextField licenseKeyField;

Check warning on line 10 in src/main/java/com/github/jaksonlin/testcraft/presentation/components/premium/PremiumSettingsComponent.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Field may be 'final'

Field `licenseKeyField` may be 'final'
private JButton activateButton;

Check warning on line 11 in src/main/java/com/github/jaksonlin/testcraft/presentation/components/premium/PremiumSettingsComponent.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Field can be local

Field can be converted to a local variable

Check warning on line 11 in src/main/java/com/github/jaksonlin/testcraft/presentation/components/premium/PremiumSettingsComponent.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Field may be 'final'

Field `activateButton` may be 'final'

public PremiumSettingsComponent() {
mainPanel = new JPanel();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.github.jaksonlin.testcraft.presentation.components.testannotation;

public class AnnotationClassSelectionComponent {
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.github.jaksonlin.testcraft.presentation.toolWindow;

import com.github.jaksonlin.testcraft.presentation.components.LLMSuggestionUIComponent;
import com.github.jaksonlin.testcraft.infrastructure.services.config.LLMConfigService;
import com.github.jaksonlin.testcraft.presentation.components.llmchat.LLMSuggestionUIComponent;
import com.github.jaksonlin.testcraft.infrastructure.services.business.RunHistoryManagerService;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.jaksonlin.testcraft.presentation.toolWindow;

import com.github.jaksonlin.testcraft.presentation.components.MutationToolWindowUIComponent;
import com.github.jaksonlin.testcraft.presentation.components.mutation.MutationToolWindowUIComponent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
Expand Down
Loading
Loading