Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pycodestyle false positive #1054

Open
djangoliv opened this issue Feb 9, 2024 · 3 comments
Open

pycodestyle false positive #1054

djangoliv opened this issue Feb 9, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@djangoliv
Copy link

Description

When a code cell is after a markdown cell, pycodestyle warns an error E303 (too many blank lines 3).

image

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

@krassowski
Copy link
Member

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.

@krassowski
Copy link
Member

I opened an issue in JupyterLab to track this: jupyterlab/jupyterlab#15870

@drichardson
Copy link

Workaround

  1. Go to Settings > Settings Editor > Code Diagnostics
  2. Under Diagnostic codes to ignore, add E303

Screenshot 2024-08-05 at 21 47 20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants