Skip to content

nextflow lint breaks when reporting certain syntax errors #6664

@bentsherman

Description

@bentsherman

Bug report

From this Slack thread: https://nextflow.slack.com/archives/C02TPSL19UJ/p1765881373697229

The following test cases have syntax errors:

// nextflow.config
process {
  withLabel:
  'bambino' {
    container = "..."
  }
}
process SEQTK_SAMPLE {

  script:
  """
  ${
    params.is_paired_end
    ? "..."
    : "..."
  }
  """
}

Expected behavior and actual behavior

The linter should report syntax errors for both snippets (the language sever reports them correctly).

Instead it fails with an error like this:

java.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 12
	at ...
	at java.base/java.lang.String.substring(String.java:2834)
	at nextflow.script.parser.v2.StandardErrorListener.printCodeBlock(ErrorListener.groovy:187)
	at nextflow.script.parser.v2.StandardErrorListener.onError(ErrorListener.groovy:99)
	at nextflow.cli.CmdLint$_printErrors_lambda7.doCall(CmdLint.groovy:210)
	at nextflow.cli.CmdLint.printErrors(CmdLint.groovy:205)
	at nextflow.cli.CmdLint.access$0(CmdLint.groovy)
	at nextflow.cli.CmdLint$_checkErrors_lambda4.doCall(CmdLint.groovy:193)
	at nextflow.cli.CmdLint.checkErrors(CmdLint.groovy:189)
	at nextflow.cli.CmdLint.run(CmdLint.groovy:149)
	at nextflow.cli.Launcher.run(Launcher.groovy:515)
	at nextflow.cli.Launcher.main(Launcher.groovy:675)

Steps to reproduce the problem

Run nextflow lint with the given code snippets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions