Open mithro opened 7 years ago
The main contributors of migen/misoc are not using the following rules:
I see why you want that (to ease future changes in the code), but this should be an advice and probably not a rule. Some can found code easier to read without this so would avoid comma where not really needed or allow use of line continuation when only one element is in the comb/sync statement.
Brief explanation
Migen / LiteX doesn't quite follow pep8 / pylint for good reasons. Extend pep8 and/or pylint to understand when it should allow violations. Extra additional checks for good Migen / LiteX style should also be added.
Expected results
Running
pep8-migen
on Migen / LiteX HDL code does the following;Detailed Explanation
Due to the way the MiSoC / LiteX code works, this is preferred way to format the following statement;
See the migen documentation for more examples.
When the code is formatting this way it will fail
pep8
with the following output;We need a pep8 / pylint extension which understand MiSoC / LiteX HDL formatting.
There are also a number of LiteX / Migen "code smells" that pep8 / pylint should also detect. Some are listed in the following section.
Migen / LiteX code smells
pep8 code smells which definitely apply
try
/except:
clausepep8 code smells which do not apply
comb
/sync
blocks.Incorrect wrapping of final brace
All lists / dictionaries should have commas on the last element;
No;
Yes;
Missing Comma on final element in list / dictionary
All lists / dictionaries should have commas on the last element;
No;
Yes;
No;
Yes;
Using line continuation rather than list
FIXME: Check this one makes sense...
No;
Yes;
Using the wrong docstring style
Migen / LiteX use the "Numpy DocString style" for docstring comments.
See examples;
Code should not be using the "Google DocString Style" and not the "PEP 287 DocString Style"
This is supported by the napoleon module in Sphinx.
Not using
yield from
in test bencheshttps://m-labs.hk/migen/manual/simulation.html#pitfalls
Further reading
Knowledge Prerequisites
Contacts