Skip to content

Move code from analysismodules to workflow, consistent code style and other fixes

Pieter David requested to merge piedavid/bamboo:incremental_moveandflake8 into master

While moving the code from analysismodules.py to workflow.py for the next part of !195 (merged) , I had the idea to finally up on the suggestion from @swertz to use a consistent code style, so added flake8 and pre-commit configs and fixed the errors/warnings.

For the line length I went for 100, with some tolerance for lines up to 10% longer (there are only a handful left in the code), using bugbear. For line splitting before/after binary operators (there are some cases, and trying to avoid them makes readability worse) I went for "allow split before" so a line can start with "and" or "+" (with consistent indentation that looks all right).

The current code then is PEP8-compatible (except for the line length), but differs from black in the line wrapping: both visual and hanging indents are used, but multiple function arguments can be on the same line, and the closing parenthesis does not need to be on its own line. That's close to the most compact pycodestyle-compatible option, but if a split was needed I prefer to put it at a place where it semantically makes most sense (e.g. between groups of related arguments, after punctuation or before parentheses in docstrings).

The reason the other checks are not run in CI yet is that pre-commit runs into SPI-1978. To work around it locally you can change pre-commit to use venv instead of virtualenv (grep "mvirtualenv" in the installed files), and make the "healthy" check return True in the same file.

WIP because this is based on !195 (merged) , so that one needs to be merged first. -> ready for review & merge

Edited by Pieter David

Merge request reports