Skip to content

Conversation

@zachariahcox
Copy link
Contributor

Key updates include:

  • adding a Preformatted property to functions and materialized views to control query formatting
  • enhancing test coverage for formatted and preformatted entities (the unit tests didn't appear to compile before)
  • upgrading the target framework to .NET 8.0.
  • simplifying the inclusion of demo data files in the test project.

Preformatted

When true, a yaml file representing a function or materialized view will not be passed through the pretty print method.
The default is false and should not impact existing yaml files.

If new files opt in, the create-or-alter scripts should honor the original formatting.
This should reduce query errors related to reformatting.

Copilot AI review requested due to automatic review settings June 13, 2025 21:19
Copy link
Contributor

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

Adds the ability to opt out of automated query formatting (“preformatted” mode) for both functions and materialized views, upgrades tests and project settings to .NET 8.0, and simplifies inclusion of demo data.

  • Introduce a Preformatted boolean on models and guard calls to .PrettifyKql() in cleanup
  • Expand unit tests to verify default and opted-in formatting behaviors
  • Upgrade test project to target net8.0 and glob-demo-data inclusion

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
KustoSchemaTools/Parser/DatabaseCleanup.cs Wrap view/function formatting in a Preformatted check
KustoSchemaTools/Model/MaterializedView.cs Add Preformatted property with default false
KustoSchemaTools/Model/Function.cs Add Preformatted flag and adjust script-generation logic
KustoSchemaTools.Tests/YamlDatabaseParserTests.cs Add tests for default vs. preformatted scenarios
KustoSchemaTools.Tests/KustoSchemaTools.Tests.csproj Bump to net8.0 and glob DemoData directory
DemoData YAML files Mark sample view/function with preformatted: true
Comments suppressed due to low confidence (3)

KustoSchemaTools/Model/Function.cs:17

  • The Literal scalar style attribute is currently applied to the Preformatted bool; it should likely be on the Body string property to preserve literal-block formatting in YAML.
[YamlMember(ScalarStyle = YamlDotNet.Core.ScalarStyle.Literal)]

KustoSchemaTools/Model/Function.cs:75

  • [nitpick] Avoid hard-coded slice indices (9 and ^15) which are opaque; consider computing offsets from known markers or extracting these as named constants so their purpose is clear.
parameters = replacedFunction[9..^15];

KustoSchemaTools.Tests/YamlDatabaseParserTests.cs:106

  • [nitpick] This comment is duplicated around two different assertions and may confuse readers; consider clarifying or removing the redundant line.
// preformatted option makes query match non-formatted version

@zachariahcox
Copy link
Contributor Author

Thanks @alex-slynko ! I'm going to need help merging this one -- I don't have write permissions

@alex-slynko alex-slynko merged commit 1bd1d3d into github:main Jun 18, 2025
1 check 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