Scroll to navigation

SDML(1) User Commands SDML(1)

NAME

sdml validate - Validate that a module is correct.

SYNOPSIS

sdml validate [OPTIONS] [MODULE]

DESCRIPTION

Validate that a module is correct.

This command provides deep validation of a module's content, including errors, warnings, and linter-like advice. Checks are run not only on the initial module, but it's transitively loaded dependencies.

By default the command only shows diagnostics with severity `bug` and `error`, but `warning`, `notes`, and `help` can be output with the `--level` argument. This argument also takes the values `none` and `all`.

```text ??? sdml validate --level all -i examples/errors/i0506.sdm note[I0506]: identifier not using preferred casing ?????? examples/errors/i0506.sdm:1:8 ??? 1 ??? module Example <https://example.com/api> is ??? ^^^^^^^ this identifier ??? = expected snake case (snake_case) = help: for more details, see <https://sdml.io/errors/#I0506>

note[I0506]: identifier not using preferred casing ?????? examples/errors/i0506.sdm:3:13 ??? 3 ??? structure access_record is ??? ^^^^^^^^^^^^^ this identifier ??? = expected upper camel case (UpperCamelCase) = help: for more details, see <https://sdml.io/errors/#I0506> ```

The `check-constraints` option turns on (it's default is off) the checking of constraints for correctness.

Additionally, a `short-form` option will generate diagnostics using a CSV format that is easier for tools to parse. The fields in this format are: severity, file name, start line, start column, end line, end column, error code, and message.

```text ??? sdml validate --level all --short-form -i examples/errors/i0506.sdm note,examples/errors/i0506.sdm,1,8,1,15,I0506,identifier not using preferred casing note,examples/errors/i0506.sdm,3,13,3,26,I0506,identifier not using preferred casing ```

Arguments:

[MODULE]
SDML module, loaded using the standard resolver

OPTIONS

-l, --level <LEVEL>

[default: warnings]
Possible values: - none: Turn off reporting - bugs: Implementation bugs - errors: Module errors - warnings: Module warnings - notes: Module informational notes - help: Style and other help - all: Turn it all on

-c, --check-constraints

Enable the checking of constraints in the model

-s, --short-form

Enable the short form (CSV) output

-o, --output <OUTPUT>

File name to write to, or '-' to write to stdout
[default: -]

-i, --input <INPUT>

Input SDML file name to read from, or '-' to read from stdin
[default: -]

-h, --help

Print help (see a summary with '-h')

-V, --version

Print version
October 2024 sdml validate 0.3.0+20240901