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

"Suspicious state" when editing unterminated docstrings in Python #948

Closed
fice-t opened this Issue Apr 20, 2016 · 5 comments

Comments

Projects
None yet
2 participants
@fice-t

fice-t commented Apr 20, 2016

When you're editing a docstring without closing triple quotes in Python that's not immediately followed by EOF, then the following message pops up:

Suspicious state from syntax checker python-pycompile: Checker python-pycompile returned non-zero exit code 1, but no errors from output:   File "/tmp/flycheck1595szW/test.py", line 4
    """ Here we have an unterminated docstring.
    x + y

        ^
SyntaxError: EOF while scanning triple-quoted string literal


Checker definition probably flawed.

To reproduce: Just try and remove the ending triple quotes from the following:

def test(x, y):
    """ Here we have an unterminated docstring."""
    x + y

This was produced in emacs -Q with Flycheck version: 26snapshot (package: 20160419.712) on GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.18.9)

@lunaryorn

This comment has been minimized.

Contributor

lunaryorn commented Apr 20, 2016

@fice-t Would you mind to tell me your Python version?

@lunaryorn

This comment has been minimized.

Contributor

lunaryorn commented Apr 20, 2016

Never mind, I can reproduce it. It appears that the python-pycompile pattern doesn't handle multiline messages well.

I'll fix this issue at some point, however, python-pycompile is intended as a very last resort. python-flake8 and python-pylint are generally preferred and should be used instead. Hence this issue has rather low priority for me personally.

Pull requests would be very welcome. @fice-t Would you give it a try?

@fice-t

This comment has been minimized.

fice-t commented Apr 20, 2016

Ah, I still use the default checkers. I'll have to get around to customizing them.

Anyway, I changed the

(= 2 (zero-or-more not-newline) "\n")

in the checker definition to

(>= 2 (zero-or-more not-newline) "\n")

and it seems to fix the issue. Is there a reason why = 2 was chosen?

@lunaryorn

This comment has been minimized.

Contributor

lunaryorn commented Apr 20, 2016

@fice-t I don't know. It's been like that since it was merged, see #484. I guess it's safe to change, isn't it?

Would you mind to try the modified pattern with different syntax errors and different files?

@fice-t

This comment has been minimized.

fice-t commented Apr 20, 2016

Seems to work the same as before in other cases/files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment