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

Semicolon in decorator confuses lines_after_imports #1178

Closed
FuegoFro opened this issue Apr 13, 2020 · 2 comments
Closed

Semicolon in decorator confuses lines_after_imports #1178

FuegoFro opened this issue Apr 13, 2020 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@FuegoFro
Copy link
Contributor

If you have a decorator on the first class or function after imports that has a semicolon in the line (eg, in a string) it confuses the lines_after_imports setting into only putting a single blank line, when there should in fact be two. Here's a minimal repro:

import pytest

@pytest.mark.skip(';')
def test_thing(): pass

Removing the semicolon in the @pytest.mark.skip(';') line (eg having it be an empty string) causes it to put two blank lines after imports (as expected here).

This bug causes isort to conflict with black (though a workaround is to just put a pass between the imports and the class or function).

This was tested on latest master at time of writing (1621e19).

@timothycrosley timothycrosley added the bug Something isn't working label Jul 4, 2020
@timothycrosley timothycrosley modified the milestones: 5.0.0, 5.1.0 Jul 4, 2020
@timothycrosley
Copy link
Member

A fix for this has been deployed to PyPI in the 5.1.0 release,

Thanks for reporting!

~Timothy

@FuegoFro
Copy link
Contributor Author

Fantastic, thank you so much for the fix!

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

2 participants