jupyterlab-lsp
jupyterlab-lsp copied to clipboard
pycodestyle false positive
Description
When a code cell is after a markdown cell, pycodestyle warns an error E303 (too many blank lines 3).
Reproduce
- install jupyterlab, jupyterlab-lsp and 'python-lsp-server[all]'
- open jupyterlab
- open a new notebook
- create a simple markdown cell
- create a simple code cell with a function (or anything)
Expected behavior
No warnings
Context
jupyterlab 4.1.0 jupyterlab-lsp 5.0.3 pycodestyle 2.11.1
Regards
Thanks! This is a bug in JupyterLab itself - when the code of jupyterlab-lsp was moved to JupyterLab (in 4.0 release) the contributor who did that also added support for Markdown documents by using extractors mechanisms; it seems that markdown cells are erroneously included as empty cells in the resulting Python document.
It seems that the logic in TextForeignCodeExtractor and in the extractForeignCode() or appendCodeBlock need to be modified so that when an entire cell gets extracted, rather than adding an empty code cell equivalent (padded by two empty lines on each side) no cell would be added instead.
I opened an issue in JupyterLab to track this: https://github.com/jupyterlab/jupyterlab/issues/15870
Workaround
- Go to
Settings > Settings Editor > Code Diagnostics - Under Diagnostic codes to ignore, add
E303