-
Notifications
You must be signed in to change notification settings - Fork 109
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
Новая диагностика "Зарезервированные имена параметров" #3187
Conversation
...a/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java
Show resolved
Hide resolved
...a/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java
Show resolved
Hide resolved
...a/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java
Outdated
Show resolved
Hide resolved
...a/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java
Outdated
Show resolved
Hide resolved
...hub/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic_en.properties
Outdated
Show resolved
Hide resolved
...hub/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic_ru.properties
Outdated
Show resolved
Hide resolved
...st/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesTest.java
Show resolved
Hide resolved
65402a5
to
2fd0f7d
Compare
2fd0f7d
to
0de76af
Compare
...a/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java
Outdated
Show resolved
Hide resolved
...a/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java
Show resolved
Hide resolved
Kudos, SonarCloud Quality Gate passed! |
...hub/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic_ru.properties
Outdated
Show resolved
Hide resolved
WalkthroughИзменения внедряют новый диагностический класс Changes
Poem
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.
Actionable comments posted: 2
Outside diff range and nitpick comments (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java (1)
71-87
: Методы корректно идентифицируют параметры с зарезервированными именами. Рассмотрите возможность кэширования результатов регулярного выражения для повышения производительности.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (2)
src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/parameters-schema.json
is excluded by!**/*.json
src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json
is excluded by!**/*.json
Files selected for processing (7)
- docs/diagnostics/ReservedParameterNames.md (1 hunks)
- docs/en/diagnostics/ReservedParameterNames.md (1 hunks)
- src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java (1 hunks)
- src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic_en.properties (1 hunks)
- src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic_ru.properties (1 hunks)
- src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesTest.java (1 hunks)
- src/test/resources/diagnostics/ReservedParameterNamesDiagnostic.bsl (1 hunks)
Files skipped from review due to trivial changes (4)
- src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic_en.properties
- src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic_ru.properties
- src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesTest.java
- src/test/resources/diagnostics/ReservedParameterNamesDiagnostic.bsl
Additional context used
Markdownlint
docs/diagnostics/ReservedParameterNames.md
4-4: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank linesdocs/en/diagnostics/ReservedParameterNames.md
6-6: Expected: 1; Actual: 2
Multiple consecutive blank lines
Additional comments not posted (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java (2)
54-60
: Конфигурация диагностики корректно обрабатывает входные данные и устанавливает регулярное выражение. Отличная работа!
62-69
: Проверка на пустой шаблон перед выполнением диагностики улучшает производительность. Хорошее решение!
/rebase |
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.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java (1 hunks)
- src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic_ru.properties (1 hunks)
- src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesTest.java (1 hunks)
Files skipped from review due to trivial changes (1)
- src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic_ru.properties
Additional comments not posted (8)
src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesTest.java (4)
40-44
: МетодtestEmpty
выглядит хорошо.Метод проверяет отсутствие диагностик при отсутствии настроенных зарезервированных слов.
46-60
: МетодtestPositive
выглядит хорошо.Метод корректно настраивает зарезервированное слово и проверяет наличие диагностик.
62-73
: МетодtestNegative
выглядит хорошо.Метод тестирует различные несоответствующие зарезервированные слова и проверяет отсутствие диагностик.
35-39
: Структура тестового класса выглядит хорошо.Структура класса ясна и соответствует лучшим практикам.
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java (4)
62-69
: Методcheck
выглядит хорошо.Метод проверяет, что шаблон зарезервированных слов не пуст перед продолжением.
71-76
: МетодvisitMethod
выглядит хорошо.Метод корректно извлекает параметры для проверки.
78-87
: МетодcheckParameterName
выглядит хорошо.Метод проверяет имена параметров на соответствие шаблону зарезервированных слов.
47-49
: Структура класса выглядит хорошо.Структура класса ясна и соответствует лучшим практикам.
@Override | ||
public void configure(Map<String, Object> configuration) { | ||
|
||
var incomingMask = (String) configuration.getOrDefault("reservedWords", RESERVED_WORDS_DEFAULT); | ||
|
||
this.reservedWords = CaseInsensitivePattern.compile("^" + incomingMask.trim() + "$"); | ||
} |
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.
Добавьте проверку на пустую строку.
Метод настройки должен дополнительно проверять, что шаблон зарезервированных слов не пуст.
- this.reservedWords = CaseInsensitivePattern.compile("^" + incomingMask.trim() + "$");
+ if (!incomingMask.trim().isEmpty()) {
+ this.reservedWords = CaseInsensitivePattern.compile("^" + incomingMask.trim() + "$");
+ }
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
@Override | |
public void configure(Map<String, Object> configuration) { | |
var incomingMask = (String) configuration.getOrDefault("reservedWords", RESERVED_WORDS_DEFAULT); | |
this.reservedWords = CaseInsensitivePattern.compile("^" + incomingMask.trim() + "$"); | |
} | |
@Override | |
public void configure(Map<String, Object> configuration) { | |
var incomingMask = (String) configuration.getOrDefault("reservedWords", RESERVED_WORDS_DEFAULT); | |
if (!incomingMask.trim().isEmpty()) { | |
this.reservedWords = CaseInsensitivePattern.compile("^" + incomingMask.trim() + "$"); | |
} | |
} |
Описание
Добавлена новая диагностика, проверяющая совпадение имен параметров методов с именами системных перечислений и т.п., задающихся списком
Связанные задачи
Чеклист
Общие
gradlew precommit
)Для диагностик
Дополнительно