Skip to content

linter: additional rules #4917

@oliver-sanders

Description

@oliver-sanders

#4900 has gone beyond a basic sed file and is now the basis for a more generic linter 🎉.

Some follow-on ideas:

Editor integration:

(See #5014)

7 to 8 migration rules

This linter could be a highly valuable tool in the 7->8 upgrade. Also include a couple of Python 2->3 pointers.

  • Missing shebang
    • If Jinja2 or EmPy syntax is detected in the suite.rc or flow.cylc file and the first line of the file is not a matching shebang.
    • (rose suite-run used to tolerate missing shebang lines)
  • Module name changes
    • cylc -> cylc.flow
    • rose -> metomi.rose
    • isodatetime -> metomi.isodatetime
    • In Python files from _ import and import _.
    • In .cylc & .rc files from "_" import
  • Tabs in Python files (e.g. Jinja2 filters)
    • Use spaces to indent Python 3 files, mix of tabs and spaces is a syntax error.
  • Zero-prefixed integers in .cylc, .rc files.
    • E.G. 05 rather than 5, previously accepted, now a Jinja2 syntax error.
  • Suicide triggers
    • No longer needed, use optional outputs (for .cylc files only).
  • platform = $(rose host-select)
    • Advise using built-in host selection via configured platforms rather than $(rose host-select).
    • Note there may be legit reasons to use subshells here (platforms does not offer a filter interface yet).
    • But rose host-select is definitely unnecessary.
  • Deprecated env vars (all files in project).
  • Check for deprecated commands (documented in cylc.flow.scripts.cylc.DEAD_ENDS).
  • Parameter simplification
  • Deprecated task and workflow event template variables
  • Use of rose suite-hook (command removed at Rose 2)
  • CYLC_VERSION={{CYLC_VERSION}} (same for ROSE_ and FCM_). lint: Warn users that CYLC_VERSION={{CYLC_VERSION}} is deprecated #5890
  • Using cylc workflow-state in a task-script, should use the workflow_state xtrigger instead
  • :expired output must be optional if used (also :expire, :expire-all and :expire-any), see optional output extension proposal.

Additional style rules and bug bears

  • ...

Pull requests welcome!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions