Linting API
Users interact with RefTrace via Starlark, a Python-like language. See the difference between Python and Starlark here.
The API RefTrace exposes is callback-based. Users define “rules” and RefTrace supplies them with a Nextflow module object.
Rules must be of this form:
Behavior is undefined for duplicate rules in the same “rules” file and for rules that don’t accept a single module
argument. name
can be anything. RefTrace only cares that rules start with rule_
and accept a single module
argument.
Other helper functions can be defined in the same file as your rules. The standard built-in Starlark functions are available. RefTrace disables fail and handles output from print.
Rule Output
RefTrace provides three functions for rules to interact with the outside world:
fatal
The fatal(*args)
function is used to report linting errors. It stops the execution of the rule in the current module.
error
The error(*args)
function is used to report linting errors. It reports the error but continues execution.
The print(*args)
function is used to output to the console. It’s useful for debugging and exploring.
Nextflow Module Object
This is the top-level object that rules operate on. It represents a single Nextflow module.
module.path (string)
The absolute path to the module.
module.includes (List[Include])
A list of all the includes in the module.
module.processes (List[Process])
A list of all the processes in the module.
Include Object
include.items (List[IncludeItem])
A list of all the functions, processes, or named workflows being included from the module.
include.module_path (string)
The path to the module being included.
IncludeItem Object
Represents a function, process, or named workflow being included from the module.
item.name (string)
The name of the function, process, or named workflow.
item.alias (string)
The alias of the function, process, or named workflow.
The name would be foo
and the alias would be bar
.
Process Object
Represents a single Nextflow process.
process.name (string)
The name of the process. Does not include the module path.
process.inputs (Inputs)
The inputs to the process. An object.
process.outputs (Outputs)
The outputs of the process. An object.
process.directives (Directives)
This is an object, not a list. It provides a typed interface to the directives in the process.
Each field in the Directives
object is a list. For example, a process can have multiple label
directives.
Process Inputs Object
The fields map to the type of inputs listed here.
The available fields are:
Val
File
Path
Env
Stdin
Tuple
Process Outputs Object
The fields map to the type of outputs listed here.
The available fields are:
Val
File
Path
Env
Stdout
Tuple
Directives Object
The fields map to the directives listed here. See the Nextflow docs for more details about each directive.
accelerator
after_script
arch
array
before_script
cache
cluster_options
conda
container
container_options
cpus
debug
disk
echo
error_strategy
executor
ext
fair
label
machine_type
max_submit_await
max_errors
max_forks
max_retries
memory
module
penv
pod
publish_dir
queue
resource_labels
We currently only provide the keys.
resource_limits
scratch
shell
spack
stage_in_mode
stage_out_mode
store_dir
tag
time
dynamic
Directive that has a closure as an argument. RefTrace currently does not try to evaluate closures.
unknown
Directive that is not recognized by RefTrace.