-
Notifications
You must be signed in to change notification settings - Fork 106
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
Наценка за сложность #3228
Наценка за сложность #3228
Conversation
-- по умолчанию включил для конгнитивной и цикломатической сложностей - небольшие исправления
Обзор измененийДобавлены изменения, позволяющие указывать надбавку за сложность при расчете времени на исправление диагностики. Также произошла рефакторизация кода, включая использование современных возможностей языка, и обновление тестов для поддержки новых изменений. Изменения
Оценка соответствия связанным задачам
Стих
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this 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
Files selected for processing (9)
- docs/contributing/DiagnosticStructure.md (2 hunks)
- src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CognitiveComplexityDiagnostic.java (2 hunks)
- src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CyclomaticComplexityDiagnostic.java (1 hunks)
- src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DiagnosticStorage.java (2 hunks)
- src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TransferringParametersBetweenClientAndServerDiagnostic.java (3 hunks)
- src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfo.java (1 hunks)
- src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticMetadata.java (1 hunks)
- src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CyclomaticComplexityDiagnosticTest.java (2 hunks)
- src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfoTest.java (1 hunks)
Additional comments: 12
src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CyclomaticComplexityDiagnosticTest.java (1)
- 40-40: Добавлена новая проверка для
extraMinForComplexity
вdiagnosticInstance.getInfo()
. Это соответствует ожидаемому изменению, учитывая добавление нового параметра в диагностику.src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticMetadata.java (1)
- 86-90: Добавлен новый параметр аннотации
extraMinForComplexity
для указания дополнительного времени на исправление из-за сложности. Это изменение соответствует целям PR.src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CyclomaticComplexityDiagnostic.java (1)
- 49-50: Добавлено значение
extraMinForComplexity
равное 1 в классCyclomaticComplexityDiagnostic
. Это изменение соответствует описанию PR и добавленной аннотации вDiagnosticMetadata
.src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CognitiveComplexityDiagnostic.java (1)
- 49-50: Добавлено значение
extraMinForComplexity
равное 1 в классCognitiveComplexityDiagnostic
. Это изменение соответствует добавленной аннотации вDiagnosticMetadata
и логике PR.src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DiagnosticStorage.java (1)
- 212-215: Использование сопоставления с образцом с
instanceof
в методеaddDiagnostic
улучшает читаемость и соответствует современным практикам Java.src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TransferringParametersBetweenClientAndServerDiagnostic.java (2)
109-113: Рефакторинг сигнатур методов для размещения параметров на нескольких строках улучшает читаемость кода.
164-164: Замена
Collectors.toUnmodifiableList()
наtoList()
соответствует изменениям в Java 16 и улучшает читаемость.src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfo.java (1)
- 201-206: Добавлен новый метод
getExtraMinForComplexity()
для получения значения изdiagnosticMetadata
. Это изменение соответствует добавленной аннотацииextraMinForComplexity
и логике PR.src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfoTest.java (1)
- 158-158: Добавлена новая проверка для
getExtraMinForComplexity()
. Это соответствует изменениям в классеDiagnosticInfo
.docs/contributing/DiagnosticStructure.md (3)
48-48: Добавлен новый параметр
extraMinForComplexity
в аннотацию@DiagnosticMetadata
. Это изменение соответствует описанию PR и позволяет динамически увеличивать время на исправление замечания в зависимости от сложности. Убедитесь, что это изменение также отражено в документации и тестах.53-54: Добавлены новые свойства
modules
иcanLocateOnProject
в аннотацию@DiagnosticMetadata
. Эти изменения позволяют ограничить анализ диагностики определенными модулями и указать возможность размещения замечаний на весь проект. Это соответствует описанию PR и предоставляет больше гибкости при определении области применения диагностики.74-74: Указано значение
extraMinForComplexity
равное 1 в примере аннотации. Это значение должно быть согласовано с реализацией классовCognitiveComplexityDiagnostic
иCyclomaticComplexityDiagnostic
, упомянутых в обзоре AI. Убедитесь, что это значение корректно и соответствует логике расчета времени на исправление замечаний.
Qodana Community for JVM17 new problems were found
💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at qodana-support@jetbrains.com
|
@@ -99,28 +100,6 @@ public ParseTree visitSub(BSLParser.SubContext ctx) { | |||
Integer methodComplexity = documentContext.getCognitiveComplexityData().getMethodsComplexity().get(methodSymbol); | |||
|
|||
if (methodComplexity > complexityThreshold) { | |||
|
|||
List<DiagnosticRelatedInformation> relatedInformation = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Эээ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
если я не туплю, то этот код не работает. См аналогично в цикломатике
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfo.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
Files selected for processing (2)
- src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfo.java (1 hunks)
- src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SmokyTest.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfo.java
Additional comments: 1
src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SmokyTest.java (1)
- 146-153: Добавлен новый тестовый метод
testExtraMinForComplexity
, который проверяет, что свойствоextraMinForComplexity
каждогоdiagnosticInfo
не является отрицательным. Это соответствует описанию в PR, где упоминается добавление тестов для новой функциональности. Изменения выглядят корректными.
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
Описание
Связанные задачи
Closes #3227
Чеклист
Общие
gradlew precommit
)Для диагностик
Дополнительно
Summary by CodeRabbit
Новые функции
Рефакторинг
addDiagnostic
.Collectors.toUnmodifiableList()
на более современныйtoList()
.Тесты