PowerShell / DSC

This repo is for the DSC v3 project
MIT License
133 stars 22 forks source link

Some static-analysis support #403

Open SteveL-MSFT opened 2 months ago

SteveL-MSFT commented 2 months ago

Summary of the new feature / enhancement

Instead of hitting a run-time error, it would be useful to have some static analysis be performed. I do wonder if it should be part of whatIf or separate since whatIf will already handle some of it:

Proposed technical implementation details (optional)

No response

michaeltlombardi commented 2 months ago

A command for validating a configuration document (and reference manifest, honestly) would be deeply useful for users and authoring tools alike, I think.

Maybe something like:

# By path
dsc validate document --path ./myconfig.dsc.config.yaml
# From stdin, with detailed info as JSON objects
$myConfig | dsc validate document --detailed
# As above, but for manifests:
$myResource | dsc validate manifest

The JSON objects from the output could contain information that the eventual extension could use, but at the very least they would tell the author the context and message that failed validation.

Another useful eventual option would be to enable suggestions, like using newer versions of resources, or noticing you're supplying a credential without using secureString, etc.