Expand description
Lint rules for Workflow Description Language (WDL) documents.
§Rules
This table documents all sprocket lint rules implemented on the main branch of the stjude-rust-labs/sprocket repository. Note that the information may be out of sync with released packages.
§Lint Rules
| Name | Tags | Description | Config |
|---|---|---|---|
CallInputSpacing | Spacing, Style | Ensures that call inputs are spaced appropriately. | |
CallInputKeyword | Deprecated, Style | Ensures that the input: keyword is not used in call statements when WDL version is 1.2 or later. | |
CommandSectionIndentation | Spacing, Clarity, Correctness | Ensures consistent indentation (no mixed spaces/tabs) within command sections. | |
CommentWhitespace | Spacing, Style | Ensures that WDL comments have the proper spacing. | |
ConciseInput | Style | Ensures concise input assignments are used (implicit binding when available). | |
ConsistentNewlines | Spacing, Clarity, Portability | Ensures that newline usage is consistent. | |
ContainerUri | Clarity, Portability | Ensures that values for the container key within runtime/requirements sections are well-formed. | |
DeclarationName | Naming, Style, Clarity | Ensures declaration names do not redundantly include their type name. | |
DeprecatedObject | Deprecated | Ensures that the deprecated Object types are not used. | |
DeprecatedPlaceholder | Deprecated | Ensures that deprecated expression placeholder options are not used. | |
DescriptionLength | SprocketCompatibility | Ensures that description meta entries are not too long for display in Sprocket documentation | |
DocMetaStrings | SprocketCompatibility | Ensures that reserved meta keys have string values for wdl-doc compatibility | |
DoubleQuotes | Style, Clarity | Ensures that strings are defined using double quotes. | |
ElementSpacing | Spacing, Style | Ensures that WDL elements are spaced appropriately. | |
EndingNewline | Spacing, Portability | Ensures that documents end with a single newline character. | |
ExpectedRuntimeKeys | Completeness, Deprecated | Ensures that runtime sections have the appropriate keys. | * allowed_runtime_keys - A list of keys to ignore. |
ExpressionSpacing | Spacing, Style | Ensures that WDL expressions are properly spaced. | |
HereDocCommands | Clarity, Correctness | Ensures that tasks use heredoc syntax in command sections. | |
ImportPlacement | Clarity | Ensures that imports are placed between the version statement and any document items. | |
ImportSorted | Sorting | Ensures that imports are sorted lexicographically. | |
ImportWhitespace | Spacing, Style | Ensures that there is no extraneous whitespace between or within imports. | |
InputName | Naming, Style | Ensures input names are meaningful (e.g. not generic like ‘input’, ‘in’, or too short). | |
InputSorted | Sorting | Ensures that input declarations are sorted | |
KnownRules | Clarity, Correctness, SprocketCompatibility | Ensures only known rules are used in lint directives. | |
LineWidth | Spacing, Style | Ensures that lines do not exceed a certain width. | |
LintDirectiveFormatted | Clarity, Correctness, SprocketCompatibility | Ensures lint directives are correctly formatted. | |
LintDirectiveValid | Clarity, Correctness, SprocketCompatibility | Ensures lint directives are placed correctly to have the intended effect. | |
MatchingOutputMeta | Completeness, Documentation, SprocketCompatibility | Ensures that each output field is documented in the meta section under meta.outputs. | |
MetaDescription | Completeness, Documentation, SprocketCompatibility | Ensures the meta section contains a description key | |
MetaKeyValueFormatting | Spacing, Style | Ensures that arrays and objects in meta and parameter_meta sections have one element per line and are indented correctly. | |
MetaSections | Completeness, Clarity, Documentation | Ensures that tasks and workflows have the required meta and parameter_meta sections. | |
OutputName | Naming, Style | Ensures output names are meaningful (e.g. not generic like ‘output’, ‘out’, or too short). | |
ParameterMetaMatched | Completeness, Sorting, Documentation, SprocketCompatibility | Ensures that inputs have a matching entry in a parameter_meta section. | |
PascalCase | Naming, Style, Clarity | Ensures that structs are defined with PascalCase names. | |
PreambleCommentPlacement | Style, Clarity, SprocketCompatibility | Ensures that preamble comments are inside the preamble. | |
PreambleFormatted | Spacing, Style, SprocketCompatibility | Ensures that documents have correct formatting in the preamble. | |
RedundantNone | Style | Flags redundant assignment of None to optional inputs. | |
RequirementsSection | Completeness, Portability, Deprecated | Ensures that tasks have a requirements section (for WDL v1.2 and beyond). | |
RuntimeSection | Completeness, Portability | Ensures that tasks have a runtime section (for WDL v1.1 and prior). | |
SectionOrdering | Style, Sorting | Ensures that all sections are in the correct order. | |
ShellCheck | Correctness | Ensures that command blocks are free of ShellCheck violations. | |
SnakeCase | Naming, Style, Clarity | Ensures that tasks, workflows, and variables are defined with snake_case names. | |
TodoComment | Style | Flags TODO statements in comments to ensure they are not forgotten. | |
TrailingComma | Style | Ensures that lists and objects have a trailing comma and that there’s not extraneous whitespace and/or comments before the trailing comma. | |
VersionStatementFormatted | Spacing, Style | Ensures the version statement is correctly formatted. | |
Whitespace | Spacing, Style | Ensures that a document does not contain undesired whitespace. |
§Definitions
§Definitions
§WDL Document Structure
§Preamble
The document preamble is defined as anything before the version declaration statement and the version declaration statement itself. Only comments and whitespace are permitted before the version declaration.
§Comment Types
§Lint Directives
Lint directives are special comments that begin with #@ except: followed by a comma-delimited list of rule IDs. These comments are used to disable specific lint rules for a section of the document. When a lint directive is encountered in the preamble, it will disable the specified rules for the entire document.
For example:
#@ except: LineWidth, CommentWhitespace§Preamble Comments
Preamble comments are special comments at the start of a WDL file that begin with double pound signs (##). These comments are used for documentation that doesn’t fit within any of the WDL-defined documentation elements (i.e., meta and parameter_meta sections). They may provide context for a collection of tasks or structs, or they may provide a high-level overview of a workflow. Preamble comments can be formatted as Markdown text.
For example:
## # FlagFilter
##
## A struct to represent the filtering flags used in various `samtools` commands.§Examples
An example of parsing a WDL document and linting it:
use wdl_lint::Linter;
use wdl_lint::analysis::Validator;
use wdl_lint::analysis::document::Document;
let mut validator = Validator::default();
validator.add_visitor(Linter::default());Re-exports§
pub use wdl_analysis as analysis;pub use wdl_ast as ast;
Modules§
- rules
- Module for the lint rules.
Structs§
- Config
- The configuration for lint rules.
- Linter
- A visitor that runs linting rules.
- TagSet
- A set of lint tags.
- Unknown
TagError - An error for when an unknown tag is encountered.
Enums§
- Tag
- A lint rule tag.
Constants§
- DEFINITIONS_
TEXT - The definitions of WDL concepts and terminology used in the linting rules.
Statics§
- ALL_
RULE_ IDS - All rule IDs sorted alphabetically.
- ALL_
TAG_ NAMES - All tag names sorted alphabetically.
Traits§
- Rule
- A trait implemented by lint rules.
Functions§
- find_
nearest_ rule - Finds the nearest rule ID to the given unknown rule ID,
or
Noneif no rule ID is close enough. - rules
- Gets all of the lint rules.