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

Float to top doesn't keep imports below module docstring #1541

Closed
ericmjl opened this issue Oct 7, 2020 · 2 comments
Closed

Float to top doesn't keep imports below module docstring #1541

ericmjl opened this issue Oct 7, 2020 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@ericmjl
Copy link

ericmjl commented Oct 7, 2020

I wasn't sure if this is a bug or not, but I thought I'd report it to see whether this is intended behaviour.

When I have a module written as such:

"""Module-level docstring."""

def func():
    pass

import time

def func2():
    pass

After passing through isort, I get:

import time

"""Module-level docstring."""

def func():
    pass

def func2():
    pass

However, this conflicts with pydocstyle error D100 (Missing docstring in public module.) The behaviour that would not conflict with error D100 is:

"""Module-level docstring."""

import time

def func():
    pass

def func2():
    pass

May I ask, is the behaviour that I reported intended, or should isort be moving modules to the top but below the module-level docstring?

@timothycrosley timothycrosley added duplicate This issue or pull request already exists bug Something isn't working labels Oct 8, 2020
@timothycrosley
Copy link
Member

Hi @ericmjl,

You are correct that this is a bug! It was also mentioned in #1499 and has been fixed in the 5.6.0 release of isort: https://pycqa.github.io/isort/CHANGELOG/#560-october-7-2020

Thanks!

~Timothy

@ericmjl
Copy link
Author

ericmjl commented Oct 8, 2020

Thank you, @timothycrosley!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants