Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General Refactor #440

Merged
merged 7 commits into from
Feb 14, 2025
Merged

General Refactor #440

merged 7 commits into from
Feb 14, 2025

Conversation

DanielRendox
Copy link
Collaborator

Why is merge request needed

We are now focusing on refactoring the TestSpark codebase for improving its readability and maintainability. This PR introduces minor refactors through the entire codebase that don't fall into a category of a specific project module.

Description of changes made

  • Move class-level fields in TestSparkAction to actionPerformed. Because this may lead to resource leaks. Closes AnAction must not contain data fields according to documentation #242

  • Extract the TestSparkActionWindow class into a separate file for better modularity and maintainability. This separation improves code readability and simplifies the structure of TestSparkAction by isolating UI logic. It will also reduce potential git conflicts.

  • Add .intelliJPlatform folder to .gitignore because it's a local build folder and shouldn't be pushed anywhere. We have many git unresolved files displaying in IntelliJ and it's quite annoying.

  • Remove the irrelevant TODO in TestSparkActionWindow.kt
    If the psiHelper is not available, we'll get a NullPointerException automatically, so we don't need to throw anything manually. It's the responsibility of the caller class to make sure that the window is shown only when the dataContext returns some data and a psiHelper instance can be retrieved.

  • Refactor TestCompilerFactory to close issue Add the warning window that for Java we always need the javaHomeDirectoryPath in the TestCompilerFactory #324. Use the provided javaSDKHomePath or derive it from the project's instance. If can't derive throw an exception. At the moment we never pass javaSDKHomePath explicitly in the project so it shouldn't break anything either.

  • Resolve some IDE warnings. Remove redundant qualifier names in TestSparkAction.kt

  • I have checked that I am merging into correct branch

Because this may lead to resource leaks. Closes #242
Extract the TestSparkActionWindow class into a separate file for better modularity and maintainability. This separation improves code readability and simplifies the structure of TestSparkAction by isolating UI logic. It will also reduce potential git conflicts.
If the psiHelper is not available, we'll get a NullPointerException automatically, so we don't need to throw anything manually. It's the responsibility of the caller class to make sure that the window is shown only when the dataContext returns some data and a psiHelper instance can be retrieved.
Use the provided javaSDKHomePath or derive it from the project's instance. If can't derive throw an exception.
Copy link
Collaborator

@arksap2002 arksap2002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for this refactoring, looks good

@arksap2002 arksap2002 merged commit 3dbe4d8 into development Feb 14, 2025
3 checks passed
@arksap2002 arksap2002 deleted the danielrendox/refactor/general branch February 14, 2025 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AnAction must not contain data fields according to documentation
2 participants