Skip to content

fix: SonarQube 26.2 compatibility (Jackson 3 / BSL LS 0.29.0-rc.1)#417

Open
nixel2007 wants to merge 3 commits intodevelopfrom
fix/sonarqube-26.2-jackson3-compat
Open

fix: SonarQube 26.2 compatibility (Jackson 3 / BSL LS 0.29.0-rc.1)#417
nixel2007 wants to merge 3 commits intodevelopfrom
fix/sonarqube-26.2-jackson3-compat

Conversation

@nixel2007
Copy link
Member

Проблема

После обновления SonarQube с 26.1 до 26.2 плагин перестал работать с ошибкой:

UnsatisfiedDependencyException: No qualifying bean of type 'tools.jackson.databind.json.JsonMapper'

SonarQube 26.2 мигрировал на Jackson 3.x (tools.jackson namespace), а 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 тестов проходят.

- 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>
Copilot AI review requested due to automatic review settings March 11, 2026 20:28
@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

Warning

Rate limit exceeded

@nixel2007 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 57 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9adf705d-0f1a-463b-8127-dc3103022664

📥 Commits

Reviewing files that changed from the base of the PR and between b5963ff and bfbafa9.

📒 Files selected for processing (2)
  • build.gradle.kts
  • src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java

Walkthrough

Обновлена сборка и shadowJar, скорректирована логика расчёта длины токена в подсветчике и расширены/переименованы множества ключевых слов SDBL; тесты синхронизированы с новыми токенами.

Changes

Cohort / File(s) Summary
Сборка и shadowJar
build.gradle.kts
Обновлён bsl-language-server до 0.29.0-rc.1. В shadowJar добавлено duplicatesStrategy = Include, AppendingTransformer для META-INF/spring.factories с разделителем \n; сохранён mergeServiceFiles() и конфигурация runtimeClasspath.
Логика подсветки и токены SDBL
src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java
Добавлена учётная логика эффективной длины токена (учёт переноса строки) при расчёте диапазона; переработаны названия и наборы SDBL-токенов (множество новых и переименованных JOIN/GROUP/ORDER/UNION/и т.п.), удалены/заменены устаревшие токены.
Тесты подсветки
src/test/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighterTest.java
Обновлены ожидаемые карты токенов и наборы ключевых слов в тестах в соответствии с изменением классификаций и добавлением новых SDBL-токенов; синхронизация с новым поведением подсветчика.

Sequence Diagram(s)

(пропущено)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 Скакну я через код и гнездо,
Токены в ряд — как морковный рост,
JOIN'ы нашли себе место всерьёз,
Версия сияет — и тесты в ажуре.
Кролик шепчет: "Прыжок — и готово всё!"

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed Название чётко отражает основные изменения: обновление совместимости с SonarQube 26.2, миграцию на Jackson 3 и обновление BSL LS до версии 0.29.0-rc.1.
Description check ✅ Passed Описание полностью соответствует изменениям: объясняет проблему, три основных изменения (обновление BSL LS, исправление shadow JAR, обновление токенов) и результаты тестов.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/sonarqube-26.2-jackson3-compat

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-server to 0.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.

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.

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between c37276f and 36bb40c.

📒 Files selected for processing (3)
  • build.gradle.kts
  • src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java
  • src/test/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighterTest.java

nixel2007 and others added 2 commits March 11, 2026 21:44
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>
@nixel2007 nixel2007 force-pushed the fix/sonarqube-26.2-jackson3-compat branch from 2e41ef2 to bfbafa9 Compare March 11, 2026 20:52
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.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 36bb40c and b5963ff.

📒 Files selected for processing (1)
  • src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java

@sonarqubecloud
Copy link

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.

2 participants