Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import nextflow.script.v2.FeatureFlagNode;
import nextflow.script.v2.FunctionNode;
import nextflow.script.v2.IncludeNode;
import nextflow.script.v2.IncludeVariable;
import nextflow.script.v2.OutputNode;
import nextflow.script.v2.ProcessNode;
import nextflow.script.v2.ScriptNode;
Expand Down Expand Up @@ -147,6 +148,7 @@ private void declareInclude(IncludeNode node) {
if( otherInclude != null )
addError("`" + name + "` is already included", node, "First included here", (ASTNode) otherInclude);
includes.put(name, module);
declaredVariables.add(module);
}
}

Expand Down Expand Up @@ -176,8 +178,12 @@ public void visit() {

// warn about any unused local variables
for( var variable : declaredVariables ) {
if( variable instanceof ASTNode node && !variable.getName().startsWith("_") )
sourceUnit.addWarning("Variable was declared but not used", node);
if( variable instanceof ASTNode node && !variable.getName().startsWith("_") ) {
var message = variable instanceof IncludeVariable
? "Include was not used"
: "Variable was declared but not used";
sourceUnit.addWarning(message, node);
}
}
}
}
Expand Down