Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linting #6

Open
bentsherman opened this issue Jun 11, 2024 · 3 comments
Open

Linting #6

bentsherman opened this issue Jun 11, 2024 · 3 comments

Comments

@bentsherman
Copy link
Member

Once a source file has been parsed (barring any syntax errors), you have an AST and you can do all sorts of static analysis on it. Much of that analysis will fall under error checking, like checking names, function call arguments, and types, but there are things beyond that which generally fall under "linting", which is checking for things that aren't technically errors but could lead to errors or are considered bad practice.

Linting is a very broad topic and is not something that is ever complete. The goal of this issue is to collect some of the most useful examples of linting as a starting point.

Resources:

@ewels
Copy link
Member

ewels commented Jul 3, 2024

Ideas for lint rules:

  • Hardcoded file paths in pipeline code (should be in a config)
  • Deprecated syntax (eg. nextflow.enable.dsl=2)
  • Plugins without version number pin

Potentially nf-core specific warnings?

  • Use of groupTuple without size or groupKey (credit: @FriederikeHanssen - maybe too complex)
  • Not to use set (from @jfy133 - apparently voted by the majority a long time ago)

@ewels
Copy link
Member

ewels commented Jul 5, 2024

Ideas for linting rules we could check with the nextflow_schema.json / params_schema.yml once #5 is implemented:

  • Validation of the schema file itself
    • eg. is it valid JSON, is it valid JSON schema structure
  • Validation of custom fields
    • Validate the Nextflow / nf-core custom fields (eg. our non-standard format values, etc)
    • Could be part of the above, especially if we use a schema-of-a-schema to do it
  • Params in schema but not used in Nextflow
  • Params used in Nextflow but missing in schema
  • Schema / Nextflow types mismatch
    • eg. path should be type: string and format: file-path / directory-path / path
    • eg. exists should be set if Nextflow has checkIfExists
    • Anything else like that which we can infer from the Nextflow code

Possible warnings (not errors):

  • Ungrouped parameters

@bentsherman
Copy link
Member Author

  • warn when modifying a function / closure parameter, e.g. a list or map in a map operator closure, as it can lead to race conditions

@bentsherman bentsherman changed the title Linting (i.e. static analysis) Linting Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants