Skip to main content

Crate wdl_lint

Crate wdl_lint 

Source
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

NameTagsDescriptionConfig
CallInputKeywordDeprecated, StyleEnsures that the input: keyword is not used in call statements when WDL version is 1.2 or later.
CommandSectionIndentationSpacing, Clarity, CorrectnessEnsures consistent indentation (no mixed spaces/tabs) within command sections.
ConciseInputStyleEnsures concise input assignments are used (implicit binding when available).
ConsistentNewlinesSpacing, Clarity, PortabilityEnsures that newline usage is consistent.
ContainerUriClarity, PortabilityEnsures that values for the container key within runtime/requirements sections are well-formed.
DeclarationNameNaming, Style, ClarityEnsures declaration names do not redundantly include their type name.
DeprecatedObjectDeprecatedEnsures that the deprecated Object types are not used.
DeprecatedPlaceholderDeprecatedEnsures that deprecated expression placeholder options are not used.
DescriptionLengthSprocketCompatibilityEnsures that description meta entries are not too long for display in Sprocket documentation
DocCommentTabsStyle, ClarityEnsures that doc comments do not contain tab characters.
DocMetaStringsSprocketCompatibilityEnsures that reserved meta keys have string values for wdl-doc compatibility
DoubleQuotesStyle, ClarityEnsures that strings are defined using double quotes.
ExceptDirectiveValidClarity, Correctness, SprocketCompatibilityEnsures except directives are placed correctly to have the intended effect.
ExpectedRuntimeKeysCompleteness, DeprecatedEnsures that runtime sections have the appropriate keys.* allowed_runtime_keys - A list of keys to ignore.
HereDocCommandsClarity, CorrectnessEnsures that tasks use heredoc syntax in command sections.
ImportPlacementClarityEnsures that imports are placed between the version statement and any document items.
InputNameNaming, StyleEnsures input names are meaningful (e.g. not generic like ‘input’, ‘in’, or too short).
InputSortedSortingEnsures that input declarations are sorted
KnownRulesClarity, Correctness, SprocketCompatibilityEnsures only known rules are used in except directives.
MatchingOutputMetaCompleteness, Documentation, SprocketCompatibilityEnsures that each output field is documented in the meta section under meta.outputs.
MetaDescriptionCompleteness, Documentation, SprocketCompatibilityEnsures the meta section contains a description key
MetaSectionsCompleteness, Clarity, DocumentationEnsures that tasks and workflows have the required meta and parameter_meta sections.
OutputNameNaming, StyleEnsures output names are meaningful (e.g. not generic like ‘output’, ‘out’, or too short).
ParameterMetaMatchedCompleteness, Sorting, Documentation, SprocketCompatibilityEnsures that inputs have a matching entry in a parameter_meta section.
PascalCaseNaming, Style, ClarityEnsures that structs are defined with PascalCase names.
RedundantNoneStyleFlags redundant assignment of None to optional inputs.
RequirementsSectionCompleteness, Portability, DeprecatedEnsures that tasks have a requirements section (for WDL v1.2 and beyond).
RuntimeSectionCompleteness, PortabilityEnsures that tasks have a runtime section (for WDL v1.1 and prior).
SectionOrderingStyle, SortingEnsures that all sections are in the correct order.
ShellCheckCorrectnessEnsures that command blocks are free of ShellCheck violations.
SnakeCaseNaming, Style, ClarityEnsures that tasks, workflows, and variables are defined with snake_case names.
TodoCommentStyleFlags TODO statements in comments to ensure they are not forgotten.
UnusedDocCommentsDocumentationEnsures that all doc comments are attached to supported syntax items.

§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: DoubleQuotes, ConciseInput

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

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 None if no rule ID is close enough.
rules
Gets all of the lint rules.