Try   HackMD

DSL2 Coding guidelines and best practices


Disclaimer

  • We're trying to forge the best practices
    • Syntax and/or logic might (and probably will) evolve

Comments

  • Add them
  • It's useful for:
    • πŸ‘‰ future you πŸ‘ˆ
    • your collaborators
    • whoever will look at your code at any point

How, if and when to use if and when to control modules

  • Use if logic in the main workflow
    • or even better branch, which follows the data flow paradigm
  • All subworkflows should be simpler and have no need for such logic
    • Use when in modules.config to control modules
      • Expect if too many empty process thant clutter the terminal
      • Then ok to use if

Channel Assignment

  • Use explicit channel assignment rather than .set{} for readability. E.g.,

    ​​​​ch_foo = ch_bar.map{ meta, baz -> [baz] }
    

    is easier to identify input/output than

    ​​​​ch_bar.map{ meta, baz -> [baz] }.set{ ch_foo }
    

Collect files to use in a process

script:
def inputs = input.collect{"-I $it"}.join(' ')
"""

Error messages


Naming conventions

  • Channel variables should start with ch_
  • snake_case for variables

Add CI Tests