Crate wdl_lint

Source
Expand description

Lint rules for Workflow Description Language (WDL) documents.

§Rules

This table documents all implemented wdl lint rules implemented on the main branch of the stjude-rust-labs/wdl repository. Note that the information may be out of sync with released packages.

§Lint Rules

NameTagsDescription
BlankLinesBetweenElementsSpacingEnsures proper blank space between elements
CallInputSpacingClarity, Spacing, StyleEnsures proper spacing for call inputs
CommandSectionMixedIndentationClarity, Correctness, SpacingEnsures that lines within a command do not mix spaces and tabs.
CommentWhitespaceSpacingEnsures that comments are properly spaced.
ContainerValueClarity, PortabilityEnsures that the value for container keys in runtime/requirements sections are well-formed.
DeprecatedObjectDeprecatedEnsures that the deprecated Object construct is not used.
DeprecatedPlaceholderOptionDeprecatedEnsures that the deprecated placeholder options construct is not used.
DescriptionMissingCompletenessEnsures that each meta section has a description key.
DisallowedDeclarationNameNamingEnsures that declaration names do not contain their type information.
DisallowedInputNameNamingEnsures that input names are meaningful.
DisallowedOutputNameNamingEnsures that output names are meaningful.
DoubleQuotesClarity, StyleEnsures that strings are defined using double quotes.
EndingNewlineSpacing, StyleEnsures that documents end with a single newline character.
ExpressionSpacingSpacingEnsures that expressions are properly spaced.
ImportPlacementClarity, SortingEnsures that imports are placed between the version statement and any document items.
ImportSortClarity, StyleEnsures that imports are sorted lexicographically.
ImportWhitespaceClarity, Spacing, StyleEnsures that there is no extraneous whitespace between or within imports.
InconsistentNewlinesClarity, StyleEnsures that newlines are used consistently within the file.
InputSortingClarity, Sorting, StyleEnsures that input declarations are sorted
KeyValuePairsStyleEnsures that metadata objects and arrays are properly spaced.
LineWidthClarity, Spacing, StyleEnsures that lines do not exceed a certain width.
MalformedLintDirectiveClarity, CorrectnessEnsures there are no malformed lint directives.
MatchingParameterMetaCompleteness, SortingEnsures that inputs have a matching entry in a parameter_meta section.
MisplacedLintDirectiveClarity, CorrectnessEnsures there are no misplaced lint directives.
MissingMetasClarity, CompletenessEnsures that tasks have both a meta and a parameter_meta section.
MissingOutputCompleteness, PortabilityEnsures that tasks have an output section.
MissingRequirementsCompleteness, PortabilityEnsures that >=v1.2 tasks have a requirements section.
MissingRuntimeCompleteness, PortabilityEnsures that tasks have a runtime section.
NoCurlyCommandsClarityEnsures that tasks use heredoc syntax in command sections.
NonmatchingOutputCompletenessEnsures that each output field is documented in the meta section under meta.outputs.
PascalCaseClarity, Naming, StyleEnsures that structs are defined with PascalCase names.
PreambleCommentAfterVersionClarityEnsures that documents have correct comments in the preamble.
PreambleFormattingClarity, Spacing, StyleEnsures that documents have correct whitespace in the preamble.
RedundantInputAssignmentStyleEnsures that redundant input assignments are shortened
RuntimeSectionKeysCompleteness, DeprecatedEnsures that runtime sections have the appropriate keys.
SectionOrderingSorting, StyleEnsures that sections within tasks and workflows are sorted.
ShellCheckCorrectness, Portability(BETA) Ensures that command sections are free of shellcheck diagnostics.
SnakeCaseClarity, Naming, StyleEnsures that tasks, workflows, and variables are defined with snake_case names.
TodoCompletenessEnsures that TODO statements are flagged for followup.
TrailingCommaStyleEnsures that lists and objects in meta have a trailing comma.
UnknownRuleClarityEnsures there are no unknown rules present in lint directives.
VersionFormattingStyleEnsures correct formatting of the version statement
WhitespaceSpacing, StyleEnsures 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::LintVisitor;
use wdl_lint::ast::Document;
use wdl_lint::ast::Validator;

let (document, diagnostics) = Document::parse(source);
if !diagnostics.is_empty() {
    // Handle the failure to parse
}

let mut validator = Validator::default();
validator.add_visitor(LintVisitor::default());
if let Err(diagnostics) = validator.validate(&document) {
    // Handle the failure to validate
}

Re-exports§

pub use wdl_ast as ast;

Modules§

rules
Module for the lint rules.

Structs§

LintVisitor
A visitor that runs linting rules.
TagSet
A set of lint tags.
UnknownTagError
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.
RESERVED_RULE_IDS
The reserved rule identifiers that are used by analysis.

Traits§

Rule
A trait implemented by lint rules.

Functions§

optional_rules
Gets the optional rule set.
rules
Gets the default rule set.