fix: SonarQube 26.2 compatibility (Jackson 3 / BSL LS 0.29.0-rc.1)#417
fix: SonarQube 26.2 compatibility (Jackson 3 / BSL LS 0.29.0-rc.1)#417
Conversation
- Update bsl-language-server dependency from 0.28.5 to 0.29.0-rc.1 - Fix shadow JAR merging of AutoConfiguration.imports to include JacksonAutoConfiguration (required for JsonMapper bean) - Update SDBLLexer token references for bsl-parser 0.31.0 API changes - Add new tokens ADD (keyword) and UNIQUE (function) to highlighter Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughОбновлена сборка и shadowJar, скорректирована логика расчёта длины токена в подсветчике и расширены/переименованы множества ключевых слов SDBL; тесты синхронизированы с новыми токенами. Changes
Sequence Diagram(s)(пропущено) Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the plugin to work with SonarQube 26.2’s move to Jackson 3 (tools.jackson namespace) by upgrading BSL LS and adjusting shading so Spring Boot auto-configuration metadata is preserved, plus aligning SDBL token mappings with the updated lexer.
Changes:
- Bump
bsl-language-serverto0.29.0-rc.1(Spring Boot 4.x / Jackson 3 compatibility). - Fix Shadow JAR resource merging for Spring Boot
AutoConfiguration.imports. - Update SDBL lexer token mappings in the highlighter and its test to match renamed tokens.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
build.gradle.kts |
Updates BSL LS dependency and adjusts Shadow JAR merging to retain Spring Boot auto-configuration imports. |
src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java |
Updates SDBL token sets (keywords/functions) to match the new SDBLLexer token names. |
src/test/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighterTest.java |
Updates expected SDBL token name classification to stay in sync with lexer changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
build.gradle.kts (1)
145-145: СтратегияDuplicatesStrategy.INCLUDEприменяется глобально.Данная стратегия влияет на все дублирующиеся файлы в shadow JAR, а не только на файл AutoConfiguration.imports. Это может привести к непредсказуемому поведению при наличии других конфликтующих ресурсов — порядок включения файлов недетерминирован.
Альтернативный подход — использовать
DuplicatesStrategy.EXCLUDEилиDuplicatesStrategy.FAILпо умолчанию и обрабатывать конкретные конфликты точечно через трансформеры.Если текущая конфигурация работает корректно и все тесты проходят, можно оставить как есть, но стоит задокументировать это решение в комментарии.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@build.gradle.kts` at line 145, The global use of DuplicatesStrategy.INCLUDE is unsafe — adjust the shadow plugin configuration to use DuplicatesStrategy.EXCLUDE or DuplicatesStrategy.FAIL as the default and handle the specific AutoConfiguration.imports collision with a dedicated transformer (or the shadow plugin's append transformer) to merge only that resource; alternatively, if you must keep DuplicatesStrategy.INCLUDE, add a clear inline comment explaining why it's safe for this project and reference the AutoConfiguration.imports handling so future maintainers know this was an intentional trade-off (refer to the duplicatesStrategy setting and the AutoConfiguration.imports resource/transformer configuration).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@build.gradle.kts`:
- Line 145: The global use of DuplicatesStrategy.INCLUDE is unsafe — adjust the
shadow plugin configuration to use DuplicatesStrategy.EXCLUDE or
DuplicatesStrategy.FAIL as the default and handle the specific
AutoConfiguration.imports collision with a dedicated transformer (or the shadow
plugin's append transformer) to merge only that resource; alternatively, if you
must keep DuplicatesStrategy.INCLUDE, add a clear inline comment explaining why
it's safe for this project and reference the AutoConfiguration.imports handling
so future maintainers know this was an intentional trade-off (refer to the
duplicatesStrategy setting and the AutoConfiguration.imports
resource/transformer configuration).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a6286976-4024-4d0a-918c-41232096a320
📒 Files selected for processing (3)
build.gradle.ktssrc/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.javasrc/test/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighterTest.java
Tokens from bsl-parser 0.31.0 may include trailing CR/LF characters in their text. When computing the highlight range end offset, this caused the offset to exceed the line length, resulting in IllegalArgumentException from SonarQube. Truncate token text at the first newline/CR to compute correct single-line highlight ranges. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
DuplicatesStrategy.INCLUDE caused multiple language-module.properties entries in the shadow JAR. Java classloader picked only the last one (Russian), so TypoDiagnostic failed with 'en-US is not a language code known to LanguageTool'. Add PropertiesFileTransformer with Append merge strategy to properly combine all LanguageTool language classes into a single properties file. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2e41ef2 to
bfbafa9
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java`:
- Around line 187-197: The bug mixes UTF-16 indices from indexOf() with code
point counts causing wrong effectiveLength when there are non-BMP characters;
update the newline branch to compute effectiveLength in code points consistently
by converting the UTF-16 boundary to a code point count (for example: compute
boundary via firstNewLine/firstCR as now, then set effectiveLength = (int)
tokenText.substring(0, boundary).codePoints().count()), keeping the no-newline
branch as tokenText.codePoints().count(); reference variables: tokenText,
firstNewLine, firstCR, boundary, effectiveLength.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7a02eb3f-fc30-4b00-9b7f-44aedf24dea8
📒 Files selected for processing (1)
src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java
src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java
Outdated
Show resolved
Hide resolved
|



Проблема
После обновления SonarQube с 26.1 до 26.2 плагин перестал работать с ошибкой:
SonarQube 26.2 мигрировал на Jackson 3.x (
tools.jacksonnamespace), а BSL LS 0.28.5 зависел от Jackson 2.x.Изменения
1. Обновление BSL LS до 0.29.0-rc.1
BSL LS 0.29.0-rc.1 использует Spring Boot 4.0.1, который поддерживает Jackson 3.x.
2. Фикс сборки shadow JAR
Shadow JAR при мерже зависимостей терял файл
AutoConfiguration.importsизspring-boot-jackson, содержащий регистрациюJacksonAutoConfiguration. Без этого Spring Boot не создавал бинJsonMapper.Решение: добавлен
duplicatesStrategy = DuplicatesStrategy.INCLUDEиAppendingTransformerдля корректного мержа файлов автоконфигурации.3. Обновление SDBLLexer токенов
bsl-parser 0.31.0 (транзитивная зависимость) переименовал ряд токенов SDBLLexer. Обновлены маппинги в
BSLHighlighterи тесте.Тесты
Все 30 тестов проходят.