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

Замечания на уровне проекта + прогрессивный расчет #317

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

theshadowco
Copy link
Member

@theshadowco theshadowco commented Jan 12, 2024

  • Реализовано размещение замечаний по диагностикам со свойством canLocateOnProject на уровне проекта, а не файла

image

image

image

  • фиксы для новой версии bslls

closes #48

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced diagnostic capabilities for the project with improved handling of code issues.
    • Expanded syntax highlighting with new tokens for mathematical and string functions.
  • Bug Fixes

    • Adjusted issue creation logic to support both file and project inputs, ensuring more accurate issue reporting.
  • Refactor

    • Updated dependency to a newer release candidate version for better performance and stability.
    • Streamlined code with modern language features for improved readability and maintenance.
  • Style

    • Cleaned up unnecessary blank lines in test files for a tidier codebase.
  • Tests

    • Augmented test suites with additional constants and method calls to reflect new functionality and changes.

Copy link

coderabbitai bot commented Jan 12, 2024

Walkthrough

The project has made several changes, including updating a language server dependency, enhancing SonarQube integration, and improving syntax highlighting for a specific database language (SDBL). Changes in issue loading now support both files and projects, reflecting a more flexible analysis capability. Tests have been refined with modern Java features like var and unnecessary lines have been removed for cleaner code.

Changes

File Pattern Change Summary
build.gradle.kts Updated bsl-language-server version from "0.22.0" to "0.23.0-rc.5" and added exclusions for specific dependencies.
src/main/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensor.java Added imports for Diagnostic and DiagnosticCode, introduced new sets, and modified methods for diagnostic handling.
src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java Added a new set SDBL_EDS and updated the getTypeOfTextSDBL method for syntax highlighting enhancements.
src/main/java/com/github/_1c_syntax/bsl/sonar/IssuesLoader.java Modified to accept Either<InputFile, InputProject> for issue creation, supporting a broader analysis scope.
src/main/java/com/github/_1c_syntax/bsl/sonar/language/BSLLanguageServerRuleDefinition.java Modified the logic for setting up the debt remediation function.
src/test/java/com/github/_1c_syntax/bsl/sonar/*Test.java Various adjustments including the use of var, addition of string constants, removal of unnecessary empty lines, and updates to imports and method calls for testing.

Assessment against linked issues

Objective Addressed Explanation
Progressive calculation of effort based on cognitive complexity (#48)

"In the code's burrow, deep and vast,
A version bump, not the first nor last.
🐇 Syntax blooms, and issues weave,
A rabbit's touch, on code's bright eve."

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

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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.

Copy link

@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: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 3cb89ce and 74beb14.
Files selected for processing (13)
  • build.gradle.kts (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensor.java (8 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/sonar/IssuesLoader.java (7 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/sonar/LanguageServerDiagnosticsLoaderSensor.java (2 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensorTest.java (3 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighterTest.java (5 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/sonar/BSLPluginTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/sonar/IssuesLoaderTest.java (6 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/sonar/ext_issues/QualityProfileTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/sonar/ext_issues/RuleDefinitionTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/sonar/language/BSLLanguageServerRuleDefinitionTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/sonar/language/BSLLanguageTest.java (1 hunks)
Files skipped from review due to trivial changes (5)
  • build.gradle.kts
  • src/test/java/com/github/_1c_syntax/bsl/sonar/BSLPluginTest.java
  • src/test/java/com/github/_1c_syntax/bsl/sonar/ext_issues/QualityProfileTest.java
  • src/test/java/com/github/_1c_syntax/bsl/sonar/ext_issues/RuleDefinitionTest.java
  • src/test/java/com/github/_1c_syntax/bsl/sonar/language/BSLLanguageTest.java
Additional comments: 24
src/test/java/com/github/_1c_syntax/bsl/sonar/language/BSLLanguageServerRuleDefinitionTest.java (1)
  • 63-66: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-63]

The test class BSLLanguageServerRuleDefinitionTest appears to be well-structured and follows Java best practices. The tests test_init and testCheckTagParameters are checking the initialization of rules and the tag parameters respectively. It's good to see that assertions are being made to ensure that the rules repository is not empty and that rules with parameters have the expected tag.

However, there is no change in this file that requires a specific comment. The file seems to be unchanged and is just provided for context.

src/main/java/com/github/_1c_syntax/bsl/sonar/LanguageServerDiagnosticsLoaderSensor.java (1)
  • 30-30: The import of org.eclipse.lsp4j.jsonrpc.messages.Either is correctly added to support the new functionality of creating issues at the project level.
src/test/java/com/github/_1c_syntax/bsl/sonar/IssuesLoaderTest.java (4)
  • 31-31: The import of org.eclipse.lsp4j.jsonrpc.messages.Either is correctly added to support the new functionality of creating issues at the project level.

  • 72-72: The change in the test_createExtIssue method to use Either.forLeft(inputFile) is consistent with the changes made in the LanguageServerDiagnosticsLoaderSensor.java file. This ensures that the tests are aligned with the new method signature.

  • 121-121: The change in the test_createIssue method to use Either.forLeft(inputFile) is consistent with the changes made in the LanguageServerDiagnosticsLoaderSensor.java file. This ensures that the tests are aligned with the new method signature.

  • 171-171: The addition of the issuesLoader.createIssue(Either.forRight(context.project()), diagnostic); line is a new test case to verify the creation of issues at the project level. This is a good addition to ensure that the new functionality is covered by tests.

src/main/java/com/github/_1c_syntax/bsl/sonar/IssuesLoader.java (5)
  • 35-35: The import of org.eclipse.lsp4j.jsonrpc.messages.Either is correctly added to support the new functionality of creating issues at the project level.

  • 46-46: The import of org.sonar.api.scanner.fs.InputProject is correctly added to support the new functionality of creating issues at the project level.

  • 157-157: The modification of the createIssue method to accept Either<InputFile, InputProject> instead of just InputFile is a significant change. This change is necessary to support the new feature of creating issues at the project level. It's important to ensure that all calls to this method have been updated to use the new signature.

Verification successful

---

The search with `rg` has successfully identified several calls to the `createIssue` method in both test and main source files. The calls are using the new signature that accepts an `Either<InputFile, InputProject>` argument, as evidenced by the usage of `Either.forLeft` and `Either.forRight` in the arguments. This confirms that the method's calls have been updated to match the new method signature, which supports the creation of issues at both the file and project levels.

Based on the provided output, the review comment regarding the necessity to ensure that all calls to the `createIssue` method have been updated to use the new signature is verified as correct. The calls in the `IssuesLoaderTest.java`, `LanguageServerDiagnosticsLoaderSensor.java`, and `BSLCoreSensor.java` reflect the updated usage.



</details>

<details>
<summary>Scripts Executed</summary>

The following scripts were executed for the analysis:



---

Script:
```shell
#!/bin/bash
# Search for calls to createIssue to ensure they are using the new signature.
ast-grep --lang java --pattern $'createIssue(Either.$_($_), $_)'

Length of output: 65



Script:

#!/bin/bash
# Search for calls to createIssue to ensure they are using the new signature.
# The previous pattern may have been too specific, so let's try a broader search.
ast-grep --lang java --pattern $'createIssue($_, $_)'

Length of output: 54



Script:

#!/bin/bash
# Use ripgrep to search for calls to createIssue in the codebase.
rg 'createIssue\('

Length of output: 1285

* 188-188: The `processDiagnostic` method has been updated to handle the new `Either` type for issue creation. This change is consistent with the new functionality of creating issues at the project level.
  • 229-229: The createExternalIssue method has been updated to handle the new Either<InputFile, InputProject> type for issue creation. This change is consistent with the new functionality of creating issues at the project level.
src/test/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensorTest.java (1)
  • 212-217: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-255]

The test class BSLCoreSensorTest appears to be well-structured and follows Java best practices. The tests cover various scenarios, including descriptor setup, execution with different configurations, and coverage metrics. It's good to see that assertions are being made to ensure that the sensor behaves as expected.

However, there is no change in this file that requires a specific comment. The file seems to be unchanged and is just provided for context.

src/main/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensor.java (5)
  • 30-30: The import of com.github._1c_syntax.bsl.languageserver.diagnostics.metadata.DiagnosticCode is correctly added to support the new functionality of creating issues at the project level.

  • 40-40: The import of org.eclipse.lsp4j.Diagnostic is correctly added to support the new functionality of creating issues at the project level.

  • 79-80: The addition of the diagnosticsOnProject set is a significant change. This set is used to store the diagnostic codes that can be located on the project level, which is a new feature introduced in this PR.

  • 188-194: The modification in the execute method to check if a diagnostic can be located on the project level and create an issue accordingly is a significant change. This change is necessary to support the new feature of creating issues at the project level. It's important to ensure that all diagnostics are correctly categorized and that issues are created at the appropriate level.

  • 348-350: The logic to add diagnostic codes to the diagnosticsOnProject set if they can be located on the project level is correctly implemented. This is necessary for the new feature of creating issues at the project level.

src/test/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighterTest.java (3)
  • 157-157: The use of var for local variable type inference is consistent with modern Java practices and enhances code readability by reducing verbosity where the type is obvious.

  • 385-408: New mathematical and string function tokens have been added to the functions set. This change seems to be in line with the PR's objective to enhance diagnostic capabilities and syntax highlighting.

  • 486-490: Introduction of a new set of string constants eds is consistent with the PR's objective to handle new tokens related to project-level diagnostics. Ensure that the usage of these constants is consistent throughout the codebase.

Verification successful

The search results indicate that the new string constants EDS_CUBE, EDS_TABLE, and EDS_CUBE_DIMTABLE are indeed used in both the test file BSLHighlighterTest.java and the main source file BSLHighlighter.java. This suggests that the constants are not only defined but also utilized within the codebase, which aligns with the reviewer's comment about ensuring consistent usage throughout the project.

Based on the provided output, it appears that the constants are used in a manner consistent with the PR's objectives, and there are no indications of inconsistent usage or errors related to these constants in the provided context.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the new EDS constants are used consistently in the codebase
rg --type java "EDS_CUBE|EDS_TABLE|EDS_CUBE_DIMTABLE"

Length of output: 613

src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java (4)
  • 68-68: The addition of the SDBL_EDS set is consistent with the changes in the test file and the PR's objectives to support new tokens for enhanced diagnostics.

  • 262-263: The getTypeOfTextSDBL method has been updated to handle the new SDBL_EDS set. This change is necessary for the correct syntax highlighting of the new tokens.

  • 531-554: New tokens related to mathematical and string functions have been added to the createSdblFunctions method. This addition is necessary for the correct syntax highlighting of these functions and aligns with the PR's objectives.

  • 639-644: The createSdblEDS method has been introduced to create a set of EDS-related tokens. This is a new addition and should be verified for consistent usage across the codebase.

Verification successful

The verification process has confirmed that the createSdblEDS method is used in BSLHighlighter.java to initialize a static final set named SDBL_EDS. Additionally, the SDBL_EDS set is utilized within a conditional statement in the same file, indicating that the new tokens are indeed being used in the codebase logic.

Based on the information gathered, the review comment about the introduction of the createSdblEDS method and its consistent usage across the codebase is accurate. The new EDS-related tokens are defined, a set is created using these tokens, and this set is subsequently used in the code logic.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the new EDS-related tokens are used consistently in the codebase
rg --type java "EDS_CUBE|EDS_TABLE|EDS_CUBE_DIMTABLE"

Length of output: 613



Script:

#!/bin/bash
# Check for references to the `createSdblEDS` method to ensure the new set is being utilized
rg --type java "createSdblEDS"

Length of output: 274



Script:

#!/bin/bash
# Check for usage of the `SDBL_EDS` set to ensure that the new tokens are being utilized in the codebase logic
rg --type java "SDBL_EDS"

Length of output: 268

@theshadowco theshadowco changed the title Замечания на уровне проекта Замечания на уровне проекта + прогрессивный расчет Jan 14, 2024
- динамическое увеличение времени на исправление от сложности
- фиксы для bslls 0.23
- фиксы зависимостей
@theshadowco theshadowco force-pushed the feature/supportEdtStorage branch from 74beb14 to 641777d Compare January 14, 2024 04:59
Copy link

@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 3cb89ce and 641777d.
Files selected for processing (13)
  • build.gradle.kts (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensor.java (8 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/sonar/IssuesLoader.java (6 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/sonar/language/BSLLanguageServerRuleDefinition.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensorTest.java (3 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighterTest.java (5 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/sonar/BSLPluginTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/sonar/IssuesLoaderTest.java (3 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/sonar/ext_issues/QualityProfileTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/sonar/ext_issues/RuleDefinitionTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/sonar/language/BSLLanguageServerRuleDefinitionTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/sonar/language/BSLLanguageTest.java (1 hunks)
Files skipped from review as they are similar to previous changes (12)
  • build.gradle.kts
  • src/main/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensor.java
  • src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java
  • src/main/java/com/github/_1c_syntax/bsl/sonar/IssuesLoader.java
  • src/test/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensorTest.java
  • src/test/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighterTest.java
  • src/test/java/com/github/_1c_syntax/bsl/sonar/BSLPluginTest.java
  • src/test/java/com/github/_1c_syntax/bsl/sonar/IssuesLoaderTest.java
  • src/test/java/com/github/_1c_syntax/bsl/sonar/ext_issues/QualityProfileTest.java
  • src/test/java/com/github/_1c_syntax/bsl/sonar/ext_issues/RuleDefinitionTest.java
  • src/test/java/com/github/_1c_syntax/bsl/sonar/language/BSLLanguageServerRuleDefinitionTest.java
  • src/test/java/com/github/_1c_syntax/bsl/sonar/language/BSLLanguageTest.java
Additional comments: 1
src/main/java/com/github/_1c_syntax/bsl/sonar/language/BSLLanguageServerRuleDefinition.java (1)
  • 141-154: The changes to the debt remediation function setup in the setUpNewRule method look correct. The conditional check based on diagnosticInfo.getExtraMinForComplexity() and the subsequent setting of either a linear function with an offset or a constant per issue function align with the PR objectives. Ensure that the getExtraMinForComplexity and getMinutesToFix methods return values in the expected format for this logic to work correctly.

Copy link

@theshadowco theshadowco merged commit e4fd883 into develop Jan 16, 2024
14 checks passed
@theshadowco theshadowco deleted the feature/supportEdtStorage branch January 16, 2024 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants