cylc-flow
cylc-flow copied to clipboard
cylc lint - site/workflow specific rules?
Problem
A site or workflow itself may have specific lint requirements that are very specific and not really suitable for the standard set of rules. Is there a way to add your own as plugins (e.g. via entry_points or similar)?
Proposed Solution
Allow site specific rules be added and used via entry_points or similar.
Sounds reasonable to load rulesets via entry points.
Would it be sane (and easier to implement?) to allow regex based rules to be defined in the pyproject TOML file?
@ColemanTom - What sort of rules do you want to implement?
My thought would be:
[cylc-lint]
rulesets.P.name = "My Custom Rulez"
rulesets.P.letter = "P" # The letter for your rule-set
rulesets.P.1.rule = "(.*)" # A regex
rulesets.P.1.description = "What the problem is"
Equally, I don't see why we can't allow entry points - but why make it more complex than necessary?
Entry points are pretty easy to implement, they allow the provision of lint functions which more closely matches the implementation and would allow cylc lint rulesets to be developed and shared as packages whereas pyproject.toml extensions would be workflow specific with no capability for sharing.
@ColemanTom - What sort of rules do you want to implement?
Honestly, I'm not 100% certain at this point as I've not kept up to date with what is inside cylc lint, and perhaps it would be more logical for local things to be their own tool, distinct from cylc itself. But, I do think it is a reasonable feature to have available. Similar to flake8 which allows extensive plugins to be used
Equally, I don't see why we can't allow entry points - but why make it more complex than necessary?
I think entry points give a lot more flexibility. A regex pattern would apply to everything, but perhaps a rule a site has may be something like if rose opt conf files are there for installation, make sure no environment variables are referenced - so a regex but only only specific files. Also, entry points are used in other linters that allow plugins, for example flake8 uses entry points, see flake8-bugbear for example.
Ok, entry points seem reasonable.
I've opened a new issue for entry-point support in cylc line, closing this discussion.
https://github.com/cylc/cylc-flow/issues/6028