Skip to content

feat(diagnostics): add UsingServiceTag additions and exclusions - #4602

Merged
sfaqer merged 3 commits into
1c-syntax:developfrom
DimaShapovaloff:codex/3173-service-tag-overrides
Oct 23, 2026
Merged

sfaqer merged 3 commits into
1c-syntax:developfrom
DimaShapovaloff:codex/3173-service-tag-overrides

Conversation

@DimaShapovaloff

@DimaShapovaloff DimaShapovaloff commented Oct 10, 2026 •

Copy link
Copy Markdown

Изменение

UsingServiceTag получает regex-параметры additionalServiceTags и excludedServiceTags: можно дополнять и сокращать стандартный набор без копирования всего serviceTags.

Исключения применяются к конкретному найденному тегу. Например, при исключении @ комментарий // @strict-types // TODO: проверить всё равно отмечается за TODO. На один комментарий выдаётся не больше одного замечания; неисключённые совпадения основного шаблона имеют приоритет над дополнительными.

Пустые, пробельные и null-значения новых параметров отключают соответствующую настройку. Повторная конфигурация сбрасывает отсутствующие дополнения и исключения. Все три шаблона сопоставляют кириллицу без учёта регистра; обратные ссылки на группы остаются независимыми. Документация RU/EN описывает приоритеты и границы совпадений.

Closes #3173

Проверки

База: develop c28c567f20da36d5f869024e136c472d0ef6a7e4, Java 21.

  • Новые регрессионные сценарии воспроизвели потерю тегов после исключённого совпадения, ошибку на null, пробельные regex, чувствительность к регистру кириллицы и сохранение удалённых настроек.
  • test --tests '*UsingServiceTagDiagnosticTest': 22 проверки диагностики и 16 архитектурных, 0 ошибок и пропусков. Проверяются также точные диапазоны и сообщения.
  • spotlessCheck precommit: успешно. Посторонние изменения генератора исключены из diff.
  • Полный набор тестов запускается в CI на Linux, Windows и macOS с Java 21/25.

Summary by CodeRabbit

  • New Features
    • Configure additional service tags to check alongside the standard tags, or set a custom primary pattern.
    • Exclude matching tags; exclusions take priority. Each comment reports at most one diagnostic, prioritizing a non-excluded primary match over an additional match.
  • Documentation
    • Clarified tag matching, whitespace handling, regular-expression rules, and configuration examples.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between c28c567 and 4956332.

📒 Files selected for processing: 7
  • docs/diagnostics/UsingServiceTag.md
  • docs/en/diagnostics/UsingServiceTag.md
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsingServiceTagDiagnostic.java
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/parameters-schema.json
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsingServiceTagDiagnostic_en.properties
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsingServiceTagDiagnostic_ru.properties
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsingServiceTagDiagnosticTest.java

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

📝 Walkthrough

The service-tag diagnostic now supports additional and excluded tag patterns. It checks primary tags before additional tags, applies exclusions to candidate matches, and reports the matched tag. Configuration schema, labels, tests, and English and Russian documentation describe the options and matching rules.

Changes: Service tag options

Layer / File(s) Summary
Configure and apply service-tag patterns
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsingServiceTagDiagnostic.java, src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/parameters-schema.json, src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsingServiceTagDiagnostic_*.properties, docs/diagnostics/UsingServiceTag.md, docs/en/diagnostics/UsingServiceTag.md
The diagnostic compiles optional additional and exclusion patterns, checks primary tags before additional tags, and skips excluded matches. The schema, labels, and documentation describe the options, precedence, and matching rules.
Validate matching and reconfiguration
src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsingServiceTagDiagnosticTest.java
Tests cover exclusions, additional tags, precedence, matching boundaries, reconfiguration, empty values, regex behavior, and Cyrillic case handling.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Suggested reviewers: sfaqer

Merge Risk: ⚪ Minimal · up to 49563

The service-tag options appear ready to merge after normal checks; no unresolved issue was established.

Pre-merge checks: Passed 4 · Failed 1

Failed 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 2 files. (5 skipped: 5… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely summarizes the main change: adding configurable service-tag additions and exclusions to the UsingServiceTag diagnostic.
Linked Issues check Passed Issue #3173 asks for additional and exclusion configuration relative to the default service-tag set. UsingServiceTagDiagnostic adds additionalServiceTags and excludedServiceTags. The diagnostic …
Out of Scope Changes check Passed The changed production code, regression tests, parameter metadata, schema, localized descriptions, and RU/EN documentation all support the parameters requested by #3173. No unrelated change is shown i…
Full details: Linked Issues check

Explanation

Issue #3173 asks for additional and exclusion configuration relative to the default service-tag set. UsingServiceTagDiagnostic adds additionalServiceTags and excludedServiceTags. The diagnostic keeps the default pattern, checks additional tags, and applies exclusions to each matched tag. The tests cover default preservation, exclusions, additions, precedence, and reconfiguration. The issue coding requirement is implemented.

Full details: Out of Scope Changes check

Explanation

The changed production code, regression tests, parameter metadata, schema, localized descriptions, and RU/EN documentation all support the parameters requested by #3173. No unrelated change is shown in the supplied change summary or the inspected files.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 2 files. (5 skipped: 5 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@sfaqer sfaqer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Пара параметров «дополнения / исключения» оправдана, это ровно то, что просили в #3173: переопределение serviceTags теряет стандартные теги из будущих версий. Формат regex согласован с serviceTags. configure() пересобирает все три шаблона. Пустое значение превращается в (?!). Схема в parameters-schema.json совпадает с аннотациями.

Основное замечание — значение из одних пробелов (см. inline): из-за флага COMMENTS оно превращается в шаблон, который совпадает со всем подряд. Остальное — уточнения документации и регистр для кириллицы.

По тестам nit: новые тесты проверяют только hasSize, без hasRange и номеров строк, хотя в runTest этого класса принят именно такой стиль. Хотя бы в паре тестов стоит проверять, какие именно строки дали замечание.


Generated by Claude Code

Comment thread docs/diagnostics/UsingServiceTag.md Resolved
@sfaqer
sfaqer merged commit ff1e149 into 1c-syntax:develop Oct 23, 2026
23 checks passed
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