A Flake8 plugin to ensure a consistent format for multiline containers.
Install from pip
with:
pip install flake8-multiline-containers
Code | Rule |
---|---|
JS101 | Multi-line container not broken after opening character |
JS102 | Multi-line container does not close on same column as opening |
# Right: Opens and closes on same line
foo = {'a': 'hello', 'b': 'world'}
# Right: Line break after parenthesis, closes on same column as opening
foo = {
'a': 'hello',
'b': 'world',
}
# Right: Line break after parenthesis, closes on same column as opening
foo = [
'hello', 'world',
]
# Wrong: JS101
foo = {'a': 'hello',
'b': 'world',
}
# Wrong: JS101, JS102
foo = {'a': 'hello',
'b': 'world'}
# Wrong: JS101, JS102
foo = {'hello',
'world'
}