Skip to content

Nextflow linter errors on custom Groovy code in lib/ as not being defined #6634

@clintval

Description

@clintval

Bug report

Expected behavior and actual behavior

Running nextflow lint ./ on a project that has Groovy classes in lib/ and using those classes in the Nextflow script and processes should not return a "is not defined" error. Instead, an error like this appears:

Error main.nf:5:5: `MyHelpers` is not defined
│   5 |     MyHelpers.SayHi
╰     |     ^^^^^^^^^

Nextflow linting complete!
 ❌ 1 file had 1 error

Steps to reproduce the problem

Make a little Groovy helper at lib/MyHelpers.groovy:

/** Helpers for my Nextflow project. */
class MyHelpers {
    public static final String SayHi = "echo 'Hello, World!'"
}

And a Nextflow script to use that helper:

process say_something {
    output: stdout()
    script: MyHelpers.SayHi
}

workflow { say_something() | view }

Program output

Running the script works:

nextflow run main.nf
...
[f4/d8349f] say_something | 1 of 1 ✔
Hello, World!

But no matter how I used the Groovy code, I can't get it to lint successfully:

nextflow lint ./
Error main.nf:5:5: `MyHelpers` is not defined
│   5 |     MyHelpers.SayHi
╰     |     ^^^^^^^^^

Nextflow linting complete!
 ❌ 1 file had 1 error

I suspect the linter is not compiling and accessing code in lib/.

Environment

  • Nextflow version: 25.10.2
  • Java version: OpenJDK Runtime Environment Homebrew (build 23.0.2)
  • Operating system: MacOS
  • Bash version: zsh 5.9 (arm64-apple-darwin24.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions