Skip to content

Add Roslyn analyzer (Waffle.Analyzer) for compile-time template syntax validation#10

Merged
Rijicho merged 1 commit into
mainfrom
feature/rijicho/analyzer
Jun 10, 2026
Merged

Add Roslyn analyzer (Waffle.Analyzer) for compile-time template syntax validation#10
Rijicho merged 1 commit into
mainfrom
feature/rijicho/analyzer

Conversation

@Rijicho

@Rijicho Rijicho commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new Roslyn analyzer package Waffle.Analyzer that inspects the interpolated string arguments passed to WaffleSyntax.Render / RenderCSharp at compile time. Template structure violations that previously surfaced only at runtime — such as unclosed blocks, out-of-scope loop variables, and misplaced control commands — are now reported as build errors and IDE diagnostics.

Related Issue

Closes #9

Changes

  • src/Waffle.Analyzer/ — new analyzer project (Waffle.Analyzer.csproj)
    • WaffleTemplateAnalyzer — DiagnosticAnalyzer that detects WaffleSyntax.Render / RenderCSharp call sites and dispatches analysis on their interpolated string arguments
    • TemplateBlockWalker — walks block structure, variable scope, and control-command consistency
    • WaffleDiagnostics — diagnostic rule definitions for WAF001–WAF007
  • tests/Waffle.Analyzer.Test/ — test project covering pass and fail cases for every rule
  • README.md — added Waffle.Analyzer badge and package table entry
  • src/Waffle.Analyzer/README.md — analyzer-specific README
  • .github/workflows/release.yml — added Waffle.Analyzer to the release workflow
  • Waffle.sln — added new projects to the solution

Checklist

  • All existing tests pass (dotnet test -c Debug)
  • New functionality is covered by tests
  • This PR targets the main branch

Contribution License Agreement

@Rijicho Rijicho self-assigned this Jun 10, 2026
@Rijicho Rijicho added the enhancement New feature or request label Jun 10, 2026
@Rijicho Rijicho merged commit 190667e into main Jun 10, 2026
4 checks passed
@Rijicho Rijicho deleted the feature/rijicho/analyzer branch June 10, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Roslyn analyzer (Waffle.Analyzer) for compile-time template syntax validation

1 participant