Skip to content

Добавление игнонирование регистра в диагностику Typo#3630

Merged
nixel2007 merged 3 commits intodevelopfrom
feature/feat2889
Dec 2, 2025
Merged

Добавление игнонирование регистра в диагностику Typo#3630
nixel2007 merged 3 commits intodevelopfrom
feature/feat2889

Conversation

@theshadowco
Copy link
Member

@theshadowco theshadowco commented Dec 1, 2025

Описание

  1. Добавлен параметр, позволяющий частично игнорировать регистр слов исключений: список слов исключений обогащается
  • словами в нижнем регистре
  • словами в титульном представлении (ТРег)
  1. оптимизировано хранение слов исключений - при конфигурировании диагностики сразу сохраняется набор
  2. момо делом добавлена таска updateLicences для работы precommit

Связанные задачи

Closes #2889

Чеклист

Общие

  • Ветка PR обновлена из develop
  • Отладочные, закомментированные и прочие, не имеющие смысла участки кода удалены
  • Изменения покрыты тестами
  • Обязательные действия перед коммитом выполнены (запускал команду gradlew precommit)

Для диагностик

  • Описание диагностики заполнено для обоих языков (присутствуют файлы для обоих языков, для русского заполнено все подробно, перевод на английский можно опустить)

Дополнительно

Переработка реквеста #2945

Summary by CodeRabbit

  • New Features

    • Added a case-insensitive option for Typo diagnostic excluded words so ignored words can match regardless of case.
  • Chores

    • Updated build configuration to include a license-formatting prerequisite and improved build timestamp formatting.
  • Tests

    • Added test coverage for the case-insensitive excluded-words behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 1, 2025

Walkthrough

Adds an optional case-insensitive flag to the Typo diagnostic (expands ignored words by case), updates configuration schema and localization, fixes a build utility, and adds a test for case-insensitive ignore behavior.

Changes

Cohort / File(s) Summary
Build Configuration
build.gradle.kts
Added updateLicenses Gradle task depending on licenseFormat. buildTime() now returns the formatted UTC timestamp String.
Typo diagnostic implementation
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic.java
Added private wordsToIgnore Set and caseInsensitive flag; introduced makeWordsToIgnore() to build ignore list (optionally adding lower/upper/capitalized variants via WordUtils); renamed camelCaseSplitedWordscamelCaseSplitWords; wired new ignore set into configuration and token processing.
Configuration schema
src/main/resources/.../configuration/parameters-schema.json
Added boolean caseInsensitive property to #/definitions/Typo (default false, description "Excluded words are case-insensitive").
Diagnostics schema formatting
src/main/resources/.../configuration/schema.json
Reformatted several enum arrays (type, severity, scope, lspSeverity) from single-line to multi-line; no behavioral changes.
Localization
src/main/resources/.../diagnostics/TypoDiagnostic_en.properties, .../TypoDiagnostic_ru.properties
Added caseInsensitive configuration key (English and Russian descriptions).
Tests
src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnosticTest.java
Added testConfigureUserWordsToIgnoreCaseInsensitive to verify case-insensitive ignore behavior with mixed-case input.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Inspect makeWordsToIgnore() for correct locale-aware capitalization and duplication handling.
  • Verify integration of wordsToIgnore into token filtering and no regression in existing behavior.
  • Check the new test for adequate coverage and edge-case handling.

Possibly related PRs

Suggested labels

hacktoberfest-accepted

Suggested reviewers

  • nixel2007

Poem

🐰 I hopped through words both big and small,
I learned to match them, one and all.
Lower, upper, capital too—
No typo hides from this rabbit crew! 🥕

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main change: adding case-insensitive word exclusion to the Typo diagnostic.
Linked Issues check ✅ Passed All objectives from issue #2889 are met: optional caseInsensitive flag added to Typo diagnostic, functionality allows ignoring case in excluded words with proper behavior for both true and false states.
Out of Scope Changes check ✅ Passed All changes are in-scope. Schema updates, Java implementation, properties, tests, and build configuration changes all directly support the caseInsensitive feature and precommit task addition.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/feat2889

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 207c08c and 97e18b4.

📒 Files selected for processing (1)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic.java (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: Analyse
  • GitHub Check: build (25, ubuntu-latest)
  • GitHub Check: build (25, macOS-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (25, windows-latest)
  • GitHub Check: build
  • GitHub Check: Analyze the repo with CodeSee

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
Contributor

@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

🧹 Nitpick comments (2)
src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnosticTest.java (1)

86-100: Test coverage for case-insensitive feature looks good.

The test validates that mixed-case exclusion words match when caseInsensitive=true. Consider adding a complementary test to verify that caseInsensitive=false (the default) does not exclude differently-cased variants — this would confirm the strict matching behavior described in issue #2889.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic.java (1)

118-121: Use primitive boolean instead of wrapper Boolean.

For consistency with other diagnostic parameters (e.g., minWordLength uses primitive int) and to avoid potential null-related issues, prefer the primitive type.

   @DiagnosticParameter(
     type = Boolean.class
   )
-  private Boolean caseInsensitive = false;
+  private boolean caseInsensitive = false;
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f74aa30 and 207c08c.

⛔ Files ignored due to path filters (1)
  • src/test/resources/diagnostics/TypoDiagnostic.bsl is excluded by !src/test/resources/**
📒 Files selected for processing (7)
  • build.gradle.kts (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic.java (4 hunks)
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/parameters-schema.json (1 hunks)
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json (2 hunks)
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic_en.properties (1 hunks)
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic_ru.properties (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnosticTest.java (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/diagnostics/*.properties

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Resource bundles for diagnostics should have both Russian and English versions

Files:

  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic_en.properties
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic_ru.properties
**/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.java: Follow the Style Guide provided in docs/en/contributing/StyleGuide.md
Use Lombok annotations to reduce boilerplate code and enable annotation processing in your IDE
Optimize imports before committing but do NOT optimize imports across the entire project unless specifically working on that task
Follow Java naming conventions with meaningful, descriptive names; keep class and method names concise but clear
Write JavaDoc for public APIs and include comments for complex logic
Use Target Java 17 as the language version

Files:

  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnosticTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic.java
**/diagnostics/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Each diagnostic should have a Java implementation class, resource bundle for localized messages, unit tests, and documentation

Files:

  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnosticTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic.java
**/diagnostics/*Test.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Write comprehensive unit tests for each diagnostic including test cases for edge cases, following existing test patterns

Files:

  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnosticTest.java
**/test/java/**/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use appropriate test frameworks (JUnit, AssertJ, Mockito) for testing

Files:

  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnosticTest.java
build.gradle.kts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

build.gradle.kts: Use Gradle with Kotlin DSL for build configuration
Be cautious with external dependencies and review security alerts from CodeQL and Dependabot

Files:

  • build.gradle.kts
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Applies to docs/*/diagnostics/**/*.md : Update diagnostic documentation in both Russian and English with examples of problematic code and fixes
📚 Learning: 2025-11-27T07:17:33.726Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Applies to **/diagnostics/*.properties : Resource bundles for diagnostics should have both Russian and English versions

Applied to files:

  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic_en.properties
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic_ru.properties
📚 Learning: 2025-11-27T07:17:33.726Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Applies to docs/*/diagnostics/**/*.md : Update diagnostic documentation in both Russian and English with examples of problematic code and fixes

Applied to files:

  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic_en.properties
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnosticTest.java
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic_ru.properties
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic.java
📚 Learning: 2025-11-27T07:17:33.726Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Applies to **/diagnostics/*Test.java : Write comprehensive unit tests for each diagnostic including test cases for edge cases, following existing test patterns

Applied to files:

  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnosticTest.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: build
  • GitHub Check: Analyze the repo with CodeSee
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (25, windows-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (25, macOS-latest)
  • GitHub Check: build (25, ubuntu-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (25, ubuntu-latest)
  • GitHub Check: build (25, macOS-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (25, windows-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (17, windows-latest)
🔇 Additional comments (6)
build.gradle.kts (1)

451-458: LGTM!

The updateLicenses task provides a convenient alias for precommit workflows, and the buildTime() function correctly returns the formatted timestamp.

src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json (1)

927-986: LGTM!

Formatting changes to multi-line enum arrays improve readability without affecting functionality.

src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic_en.properties (1)

10-11: LGTM!

English localization for the new caseInsensitive parameter is properly added, maintaining consistency with the Russian resource bundle.

src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic_ru.properties (1)

18-19: LGTM!

Russian localization for the new caseInsensitive parameter is properly added, consistent with the English resource bundle.

src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/parameters-schema.json (1)

1983-1989: LGTM!

The caseInsensitive property is correctly defined with appropriate type, default value, and description. Default false ensures backward compatibility.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TypoDiagnostic.java (1)

130-147: Verify case transformation handles edge cases with multi-word exceptions.

When WordUtils.capitalizeFully(exceptions, delimiter) is called, it treats the comma as a word delimiter. Ensure this produces expected results for compound words like "HttpСоединение" that might appear in the exceptions list. The implementation looks correct for the stated requirements.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 1, 2025

@nixel2007 nixel2007 merged commit 0454275 into develop Dec 2, 2025
38 checks passed
@nixel2007 nixel2007 deleted the feature/feat2889 branch December 2, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants