-
Describe the bug I would expect When having a mix of Python ( As an examle, To Reproduce Write a
Then write this code in a notebook cell:
Run Expected behavior
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
If you want to achieve this you need to slightly change your configuration and use [flake8_nb]
max-line-length = 20 The reason for this is that The origin of this project and what it is mostly geared to is writing teaching material and tutorials, where you want to keep up code quality, but at the same time demonstrate "bad code" without adding the complexity of linter exception (cell tag configuration). That said this is more a feature than a bug, since it also allows to define different rules for notebooks and python files. [flake8_nb]
filename = *.ipynb
extend-ignore =
# All module level imports should be at the top of the file.
E402 If you are interested in a more production-oriented solution (all the code passes |
Beta Was this translation helpful? Give feedback.
-
@s-weigand Thanks for the clarification! 😊 |
Beta Was this translation helpful? Give feedback.
If you want to achieve this you need to slightly change your configuration and use
The reason for this is that
flake8-nb
hacks the internals offlake8
to treat the Notebooks like a Schödingers cat where they are ignored (json blob, which a notebook is under the hood) and checked (converted to python file version which gets mapped back in the reporter).The origin of this project and what it is mostly geared to is writing teaching material and tutorials, where you want to keep up code quality, but at the same time demonstrate "bad code" without adding the complexity of linter exception (cell tag configuration). That said this is more a feature than a bug, s…