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

Обновление версии mdclasses и восстановление работы диагностики #3218

Merged
merged 2 commits into from
Dec 26, 2023

Conversation

theshadowco
Copy link
Member

@theshadowco theshadowco commented Dec 26, 2023

Описание

  • Новая версия MDCLASES
  • Восстановлена работа диагностики WrongDataPathForFormElementsDiagnostic

Связанные задачи

Closes #3215

Чеклист

Общие

  • Ветка PR обновлена из develop
  • Отладочные, закомментированные и прочие, не имеющие смысла участки кода удалены
  • Изменения покрыты тестами
  • Обязательные действия перед коммитом выполнены (запускал команду gradlew precommit)

Для диагностик

  • Описание диагностики заполнено для обоих языков (присутствуют файлы для обоих языков, для русского заполнено все подробно, перевод на английский можно опустить)

Дополнительно

Summary by CodeRabbit

  • Refactor

    • Updated dependency to enhance stability and performance.
    • Refactored diagnostic checks in form elements to improve accuracy.
  • Bug Fixes

    • Adjusted form elements' data path validation to align with updated data structures.

Copy link
Contributor

coderabbitai bot commented Dec 26, 2023

Walkthrough

The changes encompass updating a dependency version in the build configuration and modifying Java code to accommodate an updated API. Specifically, the WrongDataPathForFormElementsDiagnostic class has been refactored to adjust to changes in the mdclasses library, impacting the handling and access of form elements.

Changes

File Changes Summary
build.gradle.kts Updated mdclasses dependency from "0.12.0-rc.5" to "0.12.0".
.../diagnostics/WrongDataPathForFormElementsDiagnostic.java Refactored imports and methods to comply with the updated mdclasses API.

Assessment against linked issues

Objective Addressed Explanation
Restore the functionality of WrongDataPathForFormElementsDiagnostic after updates in MDClasses (#3215) The code changes reflect updates to method calls and imports to align with the new MDClasses API, which should restore the diagnostic's functionality.

Poem

The code changes dance like a merry tune,
As the Rabbit's touch makes everything attune.
With dependencies updated and code realigned,
The diagnostic sings, its purpose refined. 🌟

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging @coderabbitai in a comment. Examples:
    • @coderabbitai generate unit tests for this file
    • @coderabbitai modularize this function
  • You can tag @coderabbitai in a PR comment and ask questions about the PR and the codebase. Examples:
    • @coderabbitai gather interesting statistics about this repository and render them in a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai generate unit tests for the src/utils.ts file.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@ghost
Copy link

ghost commented Dec 26, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 0c544f4 and 4d1a5f1.
Files selected for processing (3)
  • build.gradle.kts (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/WrongDataPathForFormElementsDiagnostic.java (4 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/WrongDataPathForFormElementsDiagnosticTest.java (5 hunks)
Files skipped from review due to trivial changes (1)
  • build.gradle.kts
Additional comments: 7
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/WrongDataPathForFormElementsDiagnostic.java (4)
  • 32-32: The import statement for FormItem has been updated to reflect the new package structure. Ensure that all references to FormItem in the codebase are updated accordingly.
Verification successful

The search results confirm that the updated import statement for FormItem is only present in the WrongDataPathForFormElementsDiagnostic.java file. This suggests that the change in the package structure for FormItem is localized to this file, and no other files in the codebase are affected by this change.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that all instances of FormItem are imported from the new package.
rg --type java 'import com.github._1c_syntax.bsl.mdo.storage.form.FormItem'

Length of output: 248

* 66-67: The method `wrongDataPath` has been updated to use `getSegments()` which aligns with the changes in the MDClasses library. Confirm that `getSegments()` is the correct method in the updated API and that it is used properly here.
  • 86-87: The method checkAllFormsWithoutModules now uses getPlainChildren() instead of a stream-based approach. This change should be verified to ensure it correctly retrieves form items as intended by the updated MDClasses API.

  • 103-107: The checkForm method has been updated to use getPlainItems() instead of getPlainChildren(). This change should be verified to ensure that it aligns with the updated MDClasses API and that the method is used correctly to access form items.

src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/WrongDataPathForFormElementsDiagnosticTest.java (3)
  • 34-34: The import statement for Collections has been added. Verify that this import is used in the test code, and there are no unused imports.
Verification successful

The import of java.util.Collections is used in the test code for WrongDataPathForFormElementsDiagnosticTest.java to return an empty list from a mocked Form object. This confirms that the import is necessary and is being utilized as expected.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that Collections is used in the test code.
rg --type java 'Collections' -- 'src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/WrongDataPathForFormElementsDiagnosticTest.java'

Length of output: 256

* 66-66: The mocking behavior for `context.getConfiguration()` has been added. Ensure that the mocking is necessary and correctly implemented to reflect the behavior of the updated MDClasses API.
Verification successful

The shell script executed to verify the mocking of context.getConfiguration() in the WrongDataPathForFormElementsDiagnosticTest.java file did not produce any output. This could mean that the specific line of code does not exist in the file, or there might have been an issue with the search command.

To ensure we have accurate information, I will generate a new shell script to list the contents of the WrongDataPathForFormElementsDiagnosticTest.java file to confirm the presence of the mocking statement and to understand the context in which it is used.


The output from the cat command shows the contents of the WrongDataPathForFormElementsDiagnosticTest.java file. Within the testNoFormModule method, the mocking statement when(context.getConfiguration()).thenReturn(configuration); is indeed present. This confirms that the mocking behavior is part of the test setup and is used to configure the context with a specific configuration before running the test.

Given this information, the mocking behavior appears to be correctly implemented in the context of the test. It is used to set up the test environment to simulate the behavior of the context object as it would occur with the updated MDClasses API.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the mocking of context.getConfiguration() is necessary and correctly implemented.
rg --type java 'when(context.getConfiguration())' -- 'src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/WrongDataPathForFormElementsDiagnosticTest.java'

Length of output: 169



Script:

#!/bin/bash
# List the contents of WrongDataPathForFormElementsDiagnosticTest.java to confirm the presence of the mocking statement.
cat 'src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/WrongDataPathForFormElementsDiagnosticTest.java'

Length of output: 4640

* 101-110: The `fillConfigChildrenByFormsWithoutModule` method has been updated to use `getPlainChildren()` and mock the `getModules()` method. Verify that these changes are correct and align with the updated MDClasses API.
Verification successful

The search results confirm the usage of getPlainChildren() and getModules() methods in various parts of the codebase, including the WrongDataPathForFormElementsDiagnostic.java and its corresponding test file WrongDataPathForFormElementsDiagnosticTest.java. This indicates that the methods are indeed part of the codebase and are being used as described in the PR comment.

Given this information, the changes made in the WrongDataPathForFormElementsDiagnosticTest.java file, which involve using getPlainChildren() to filter and mock Form objects and then mocking the getModules() method to return an empty list, are consistent with the usage patterns found in the codebase. This suggests that the changes align with the updated MDClasses API and are implemented correctly in the context of the test.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that getPlainChildren() and the mocking of getModules() are correctly implemented.
ast-grep --lang java --pattern $'CF {
  $$$
  getPlainChildren() {
    $$$
  }
  $$$  
}'

Length of output: 435



Script:

#!/bin/bash
# Search for the 'getPlainChildren()' method in the Java files to verify its usage.
ast-grep --lang java --pattern $'class $_ {
  $$$
  getPlainChildren() {
    $$$
  }
  $$$  
}'

Length of output: 96



Script:

#!/bin/bash
# Search for the usage of 'getPlainChildren()' and 'getModules()' in the Java files.
rg "getPlainChildren\(\)" -t java
rg "getModules\(\)" -t java

Length of output: 3026

Copy link

github-actions bot commented Dec 26, 2023

Qodana Community for JVM

17 new problems were found

Inspection name Severity Problems
Statement with empty body 🔶 Warning 5
'@Serial' annotation could be used 🔶 Warning 4
Constant values 🔶 Warning 3
Mismatched query and update of collection 🔶 Warning 2
Class is exposed outside of its visibility scope 🔶 Warning 1
Nullability and data flow problems 🔶 Warning 1
Mismatched read and write of array 🔶 Warning 1

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at [email protected]

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 4d1a5f1 and 1092d74.
Files selected for processing (1)
  • build.gradle.kts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • build.gradle.kts

Copy link

@theshadowco theshadowco merged commit 33eb49d into develop Dec 26, 2023
33 checks passed
@theshadowco theshadowco deleted the feature/mdclasses_0.12.rc.6 branch December 26, 2023 09:59
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.

[MOD] WrongDataPathForFormElementsDiagnostic
1 participant