elyra-ai / elyra

Elyra extends JupyterLab with an AI centric approach.
https://elyra.readthedocs.io/en/stable/
Apache License 2.0
1.85k stars 342 forks source link

Pyflakes detects wrong line in code analysis errors compared to ipython #1400

Open karlaspuldaro opened 3 years ago

karlaspuldaro commented 3 years ago

Describe the issue The static code analysis tool used in LSP extension detects error in the wrong code line compared to ipython image

To Reproduce Steps to reproduce the behavior:

  1. Open a notebook (or python editor in Elyra)
  2. Add a few lines of python code that includes a syntax error
  3. Run the notebook cell (or run your script from python editor)
  4. Notice the syntax error message from ipython kernel and the code line of the error
  5. Open the LSP diagnostics panel (right click on the editor)
  6. Notice the same syntax error pointing to a different code line

Environment information

lresende commented 3 years ago

Is this the same as https://github.com/elyra-ai/elyra/issues/719

karlaspuldaro commented 3 years ago

@lresende Not really, pyflakes seems to be always detecting the line above where the actual problem is, independent of blank lines in the file, like in this notebook example: image

Then when the error in on the 1st line it will point to line 0: image

krassowski commented 3 years ago

So if pycodestyle is right but pyflakes is wrong it is something that needs to be addressed in the pyls(p). Looks like 0-based vs 1-based indexing. FYI we are migrating from now unmaintained python-language-server (pyls) to community-maintained python-lsp-server (pylsp) - same codebase, same maintainers (except for palantir).