flake8-nb icon indicating copy to clipboard operation
flake8-nb copied to clipboard

[BUG] Cells which start with `%%html` lead to SyntaxError

Open Dobatymo opened this issue 2 years ago • 3 comments

Describe the bug %%html at the start of a cell can be used to output raw html. flake8-nb fails with E999 SyntaxError: invalid syntax.

To Reproduce Have a cell like

%%html
<a href="#">asd</a>

in the notebook and run flake8-nb

Expected behavior These cells should be ignored like other non-code cells.

Desktop (please complete the following information):

  • OS: Windows 10 x64
  • Version: Python 3.8.10 with flake8-nb==0.3.1

Dobatymo avatar Nov 26 '21 07:11 Dobatymo

Thanks for reporting this bug! For the time being, you can use the cell tag flake8-noqa-cell.

But I agree that cells with cell magic, which isn't ExecutionMagics line %%timeit or explicitly defines the code as python code (%%python) should be dropped by default.

s-weigand avatar Nov 27 '21 18:11 s-weigand

@all-contributors please add @Dobatymo for bug

s-weigand avatar Nov 27 '21 18:11 s-weigand

@s-weigand

I've put up a pull request to add @Dobatymo! :tada:

allcontributors[bot] avatar Nov 27 '21 18:11 allcontributors[bot]