semgrep fails when Python file has trailing indentation

Created on 17 Mar 2020  路  7Comments  路  Source: returntocorp/semgrep

When there is trailing tab in a Python file semgrep fails.

Failing: https://sgrep.live/5J3
Trailing tab removed: https://sgrep.live/JjQ

Expected behavior
Expected semgrep to succeed, or error and clearly told me the Python syntax was invalid.

bug external-user good first issue python

Most helpful comment

@jajajasalu2 I think your PR in returntocorp/pfff#102 likely fixes this. 馃帀

All 7 comments

@jajajasalu2 I think your PR in returntocorp/pfff#102 likely fixes this. 馃帀

@DrewDennison unfortunately no, that PR is in but https://semgrep.live/5J3?version=develop still fails to parse

FWIW, when I run semgrep manually on this file from the command line, everything is happy. @DrewDennison is it possible this is an issue with semgrep.live?

I used semgrep-core as of 5df168ab0550c

Are you sure? Running on https://github.com/returntocorp/semgrep/pull/843/commits/119d3ce4d22979bdbf823affea87d14bd592691c which should be the same as 5df168ab0550c still gets the parse error

Hi,

Just my two cents on this: https://github.com/returntocorp/pfff/pull/102 does fix an underlying lexing issue but not this bug. The last few tokens for the erroneous code are

INDENT
NEWLINE
DEDENT
NEWLINE
EOF

For which I don't see a corresponding production in the python parser. Python 3.7 doesn't give me a syntax error either, so I guess this should parse.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

izar picture izar  路  3Comments

disconnect3d picture disconnect3d  路  5Comments

Mandawi picture Mandawi  路  4Comments

dev-zero picture dev-zero  路  4Comments

ajinabraham picture ajinabraham  路  6Comments