Formatting convention
Formatting convention
Define a formatting convention and clean up the code according to the new guidelines.
The formatting convention is defined in the Wiki.
To define:
- rule structure template/guidelines
- Python:
- PEP8
- 4 spaces instead of tabs
- double or single quotes?
- comments: reStructered Text or NumPy/SciPy?
- settings access
- either only global variables or
config
- if global variables, then these should be defined in one place
- either only global variables or
To try:
- code quality checker (linter):
snakemake --lint
- highlights issues to be solved to follow best practices
- highly recommended before publishing workflows
- automatic formatter: Snakefmt, based on Black
References:
Code "cleaning"
- changes w.r.t. formatting conventions mentioned above
- Python code
-
snakemake
rules - (other scripts)
- add comments where possible
- one place for all helper functions
- no variables/functions inside rule files
- use
os.path
utils when working with paths - replace code duplication with custom functions
- consistent indentation
- Q: can we simplify the structure in
workflow/rules/
???
Edited by Valentina Galata