A linter helping you write correct and consistent Dezyne code.
Requires Node.js to run.
$ npm install -D dznlint
npx dznlint <options> [...files]
For help on the different options, see:
npx dznlint --help
By default, dznlint
will look for the file dznlint.config.json
in its working directory. You can also specify which config file to use by providing the --config-file
CLI argument. This json file should contain a subset of the available configuration values.
For example:
{
"implicit_illegal": "warning", // Do not allow explicit illegals
"naming_convention": {
"component": "[A-Z][a-zA-Z0-9]*", // Set naming convention for component
"interface": "I[A-Z][a-zA-Z0-9]*" // Set naming convention for interface
},
"no_shadowing": "warning" // Set shadowing rule violations to 'warning' severity
}
Default values are indicated in bold.
Arguments passed to a function call must match the parameters of that function or event.
Possible values: "hint" | "warning" | "error"
No code allowed after return statements in functions.
Possible values: "hint" | "warning" | "error"
Dznlint formatting options, will be used when supplying cli with the --format
or --f
flag to format files instead of linting.
Default formatting settings are:
{
"format": {
"indent": ["spaces", 4], // ["spaces" | "tabs", indent width] - indentation
"braces": "next-line", // "next-line" | "same-line" - where to put opening braces
"indent_components_interfaces": true, // indent component/interface root
"target_width": 80 // width of the file after which formatter might insert extra newlines
}
}
Do not mark events explicitly illegal. As of Dezyne 2.14, events not mentioned are implicitly assumed to be illegal.
Possible values: "hint" | "warning" | "error"
Temporary variables that are only referred to once should be inlined.
Possible values: "hint" | "warning" | "error"
Naming convention for various different variables.
Default value:
{
"component": "[A-Z][a-zA-Z0-9]*",
"enum": "[A-Z][a-zA-Z0-9]*",
"enum_member": "[A-Z][a-zA-Z0-9]*",
"interface": "I[A-Z][a-zA-Z0-9]*",
"local": "[a-z_][a-zA-Z0-9]*",
"type": "[A-Z][a-zA-Z0-9]*"
}
If an out
event in an interface is never fired it is not useful, and often indicates the programmer forgot something.
Possible values: "hint" | "warning" | "error"
If an in
event in an interface is always illegal it is not useful, and often indicates the programmer forgot something.
Possible values: "hint" | "warning" | "error"
Out parameters of type bool
are not allowed by Dezyne and will lead to a well-formedness error.
Possible values: "hint" | "warning" | "error"
Parameters should have distinct names.
Possible values: "hint" | "warning" | "error"
Ports cannot be bound more than once.
Possible values: "hint" | "warning" | "error"
Defer statements should capture one or more state variables to prevent unexpected verification time explosion due to the defer queue unexpectedly growing.
Possible values: "hint" | "warning" | "error"
Systems cannot contain instances of themself.
Possible values: "hint" | "warning" | "error"
Parameters and variables should not shadow (re-define) variables that already exist in scope.
Possible values: "hint" | "warning" | "error"
All ports in a system should be connected for the system to be valid.
Possible values: "hint" | "warning" | "error"
Imported dzn files should be resolvable by dznlint. This check might fail if the include directories are not properly set. If this check fails other linting rules might also fail, since they rely on type information.
Possible values: "hint" | "warning" | "error"
All referenced variables, members and types should be known.
Possible values: "hint" | "warning" | "error"
Bindings cannot bind to unknown ports.
Possible values: "hint" | "warning" | "error"
Defined instances should be used in at least one binding.
Possible values: "hint" | "warning" | "error"
Parameters should be referenced at least once, or escaped by prefixing (or replacing with) _
.
Possible values: "hint" | "warning"| "error"
Pports should be referenced at least once.
Possible values: "hint" | "warning"| "error"
Defined variables should be referenced at least once.
Possible values: "hint" | "warning" | "error"
Parameters in an on
trigger must match the number of parameters specified by the triggering event.
Possible values: "hint" | "warning" | "error"
Parameter direction (in/out/inout) should always be specified.
Possible values: "hint" | "warning" | "error"
As of Dezyne 2.15, a provided port should be marked blocking if any of its calls is implemented using the blocking
keyword. On the other hand, if no blocking
is used in the behavior for this port, it should not be marked as blocking.
Possible values: "hint" | "warning" | "error" (Default: disabled for backwards compatibility)