CLI Commands

cnspec policy lint

Lint a policy bundle to check for errors and ensure it compiles correctly.

Validate a policy bundle to ensure it compiles correctly and all queries and references are valid. Run this before uploading a policy to catch errors early. To learn more about managing policies, read Manage Policies with cnspec.

cnspec policy lint my-policy.mql.yaml

Output results in SARIF format for CI integration:

cnspec policy lint my-policy.mql.yaml --output sarif --output-file results.sarif

Options

  -h, --help                  help for lint
  -o, --output string         Set the output format: compact, sarif (default "cli")
      --output-file string    Set the output file
      --strict-rule strings   Treat warnings from these rule IDs as errors (repeatable). Use 'all' to promote every warning to an error.

Options inherited from parent commands

      --api-proxy string        Set the proxy for communications with Mondoo Platform API
      --auto-update             Enable automatic provider installation and update (default true)
      --config string           Set config file path (default $HOME/.config/mondoo/mondoo.yml)
      --log-level string        Set the log level: error, warn, info, debug, trace (default "info")
      --logging-config string   Path to a logging configuration file (YAML or JSON) that selects the log writer, level, and writer-specific options
  -v, --verbose                 Enable verbose output

SEE ALSO

On this page