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

W292: error message gets shown three times #948

Open
jugmac00 opened this issue Jun 30, 2020 · 1 comment
Open

W292: error message gets shown three times #948

jugmac00 opened this issue Jun 30, 2020 · 1 comment

Comments

@jugmac00
Copy link

While preparing a code snippet for #947 I encountered another bug

test.py

#: does not raise E265

a = print  #: neither raises E265

#raises

=>

❯ pycodestyle test.py 
test.py:5:1: E265 block comment should start with '# '
test.py:5:8: W292 no newline at end of file
test.py:5:8: W292 no newline at end of file
test.py:5:8: W292 no newline at end of file

or minimal

#a

=>

❯ pycodestyle test.py 
test.py:1:1: E265 block comment should start with '# '
test.py:1:3: W292 no newline at end of file
test.py:1:3: W292 no newline at end of file
test.py:1:3: W292 no newline at end of file
pycodestyle --version
2.6.0
@asottile
Copy link
Member

interesting, this appears to be due to an edgecase in the tokenizer with comments:

$ python3 -m tokenize ../g.py 
0,0-0,0:            ENCODING       'utf-8'        
1,0-1,1:            NUMBER         '1'            
1,1-1,2:            NEWLINE        ''             
2,0-2,0:            ENDMARKER      ''             
$ python3 -m tokenize ../f.py 
0,0-0,0:            ENCODING       'utf-8'        
1,0-1,2:            COMMENT        '#a'           
1,2-1,2:            NL             ''             
1,2-1,3:            NEWLINE        ''             
2,0-2,0:            ENDMARKER      ''             

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants