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
CallInputSpacingClarity, Spacing, StyleEnsures proper spacing for call inputs
CommandSectionIndentationClarity, Correctness, SpacingEnsures consistent indentation (no mixed spaces/tabs) within command sections.
CommentWhitespaceSpacingEnsures that comments are properly spaced.
ConciseInputStyleEnsures concise input assignments are used (implicit binding when available).
ConsistentNewlinesClarity, StyleEnsures that \n or \r\n newlines are used consistently within the file.
ContainerUriClarity, PortabilityEnsures that the value for the container key in runtime/requirements sections is well-formed.
DeclarationNameNamingEnsures declaration names do not redundantly include their type name.
DeprecatedObjectDeprecatedEnsures that the deprecated Object construct is not used.
DeprecatedPlaceholderDeprecatedEnsures that the deprecated placeholder options construct is not used.
DoubleQuotesClarity, StyleEnsures that strings are defined using double quotes.
ElementSpacingSpacingEnsures proper blank space between elements
EndingNewlineSpacing, StyleEnsures that documents end with a single newline character.
ExpectedRuntimeKeysCompleteness, DeprecatedEnsures that runtime sections have the appropriate keys.
ExpressionSpacingSpacingEnsures that expressions are properly spaced.
HereDocCommandsClarityEnsures that tasks use heredoc syntax in command sections.
ImportPlacementClarity, SortingEnsures that imports are placed between the version statement and any document items.
ImportSortedClarity, StyleEnsures that imports are sorted lexicographically.
ImportWhitespaceClarity, Spacing, StyleEnsures that there is no extraneous whitespace between or within imports.
InputNameNamingEnsures input names are meaningful (e.g., not generic like ‘input’, ‘in’, or too short).
InputSortedClarity, Sorting, StyleEnsures that input declarations are sorted
KnownRulesClarityEnsures only known rules are used in lint directives.
LineWidthClarity, Spacing, StyleEnsures that lines do not exceed a certain width.
LintDirectiveFormattedClarity, CorrectnessEnsures lint directives are correctly formatted.
LintDirectiveValidClarity, CorrectnessEnsures lint directives are placed correctly to have the intended effect.
MatchingOutputMetaCompletenessEnsures that each output field is documented in the meta section under meta.outputs.
MetaDescriptionCompletenessEnsures the meta section contains a description key.
MetaKeyValueFormattingStyleEnsures that metadata objects and arrays are properly spaced.
MetaSectionsClarity, CompletenessEnsures that tasks and workflows have the required meta and parameter_meta sections.
OutputNameNamingEnsures output names are meaningful (e.g., not generic like ‘output’, ‘out’, or too short).
ParameterMetaMatchedCompleteness, SortingEnsures that inputs have a matching entry in a parameter_meta section.
PascalCaseClarity, Naming, StyleEnsures that structs are defined with PascalCase names.
PreambleCommentPlacementClarityEnsures that documents have correct comments in the preamble.
PreambleFormattedClarity, Spacing, StyleEnsures that documents have correct whitespace in the preamble.
RedundantNoneStyle, ClarityEnsures optional inputs don’t have redundant None assignments.
RequirementsSectionCompleteness, PortabilityEnsures that >=v1.2 tasks have a requirements section.
RuntimeSectionCompleteness, PortabilityEnsures that <v1.2 tasks have a runtime section.
SectionOrderingSorting, StyleEnsures that sections within tasks and workflows are sorted.
ShellCheckCorrectness, PortabilityEnsures that command sections are free of shellcheck diagnostics.
SnakeCaseClarity, Naming, StyleEnsures that tasks, workflows, and variables are defined with snake_case names.
TodoCommentCompletenessEnsures that TODO statements are flagged for followup.
TrailingCommaStyleEnsures that lists and objects in meta have a trailing comma.
VersionStatementFormattedStyleEnsures the version statement is correctly formatted.
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::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§

Linter
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.

Traits§

Rule
A trait implemented by lint rules.

Functions§

find_nearest_rule
Finds the nearest rule ID to the given unknown rule ID, or None if no rule ID is close enough.
rules
Gets the default rule set.