Skip to content

Conversation

@Mr-Rm
Copy link
Collaborator

@Mr-Rm Mr-Rm commented Feb 2, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Strengthened annotation validation to enforce proper usage rules and prevent annotations from appearing in restricted contexts.
    • Enhanced error handling with clearer messages when annotations are misused in variable, method, or module contexts.
  • Tests

    • Added test coverage for annotation restriction validation across multiple code contexts.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 2, 2026

📝 Walkthrough

Walkthrough

The pull request introduces a new ParseCodeBatch method to the BSL parser and strengthens validation rules for annotations in restricted contexts. Error handling for variable definitions is enhanced, including stricter enforcement of annotation placement. Supporting tests validate annotation constraints across multiple scenarios.

Changes

Cohort / File(s) Summary
Parser Implementation
src/OneScript.Language/SyntaxAnalysis/DefaultBslParser.cs
Adds new public method ParseCodeBatch(bool allowReturns = false) for expanded parsing surface. Refactors variable section handling (BuildVariableSection → BuildVariablesSection), tightens annotation validation in restricted contexts, and enhances error detection in variable definitions. Adjusts token advancement and semicolon/comma handling throughout.
Error Definitions
src/OneScript.Language/SyntaxAnalysis/LocalizedErrors.cs
Introduces new public factory method AnnotationNotAllowed() returning localized error message for annotation constraint violations (Russian: "Аннотация неприменима в данном месте", English: "Annotation is not allowed here").
Parser Unit Tests
src/Tests/OneScript.Language.Tests/ParserTests.cs
Adds four new test cases validating that annotations are rejected in lists, methods, before method end, and in module body. Simplifies existing TestLocalExportVar assertion to check error ID directly.
Integration Tests
tests/annotations.os
Adds new test routine ТестДолжен_ПроверитьПолучениеАннотацийСпискаПеременных() to verify annotation reflection on variable properties, registered in test execution list.

Poem

🐰 A parser hops through code so clear,
With annotations bounded near,
New batches parsed with proper care,
Validation rules now everywhere!
BuildVariables stands tall and bright,
As errors dance where annotations aren't right!

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly references issue #1652 and accurately describes the main changes: adding support for variable list annotations and error handling for disallowed annotation contexts.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@EvilBeaver EvilBeaver merged commit 2f1e9a3 into EvilBeaver:develop Feb 4, 2026
2 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