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

Docformatter conflict with isort #203

Closed
M1troll opened this issue May 3, 2023 · 2 comments · Fixed by #204
Closed

Docformatter conflict with isort #203

M1troll opened this issue May 3, 2023 · 2 comments · Fixed by #204
Labels
C: convention Relates to docstring format convention P: bug PEP 257 violation or existing functionality that doesn't work as documented

Comments

@M1troll
Copy link

M1troll commented May 3, 2023

Hi!

Description

I recently update docformatter v1.6.0 -> v1.6.4 and actions on my project was failed.
After spending time searching, reason turned out to be following - isort and docformatter make opposite changes to the file:

  • docformatter - remove empty line between import and constant comment
  • isort - add this line

Also was checked v1.6.1, v1.6.2 and v1.6.3 - they have same problem.

As I see it, PEP8 says:

You should put a blank line between each group of imports.

I think this applies to constants as well, so docformatter shouldn't remove that line.

Reproduction

You can reproduce my problem with next data:

Python code:

import os
from typing import Iterator

"""Don't remove this comment, it's cool."""
IMPORTANT_CONSTANT = "potato"

.pre-commit-config.yaml:

repos:
  - repo: https://github.com/pycqa/docformatter
    rev: v1.6.4
    hooks:
      - id: docformatter
        args: [
          --wrap-summaries=120,
          --wrap-descriptions=0,
          --in-place,
          --blank
        ]

  - repo: https://github.com/pycqa/isort
    rev: 5.12.0
    hooks:
      - id: isort

After run pre-commit run --all-files you will see that file changed twice and actions was failed:

import os
from typing import Iterator
-                                                                           
"""Don't remove this comment, it's cool."""
IMPORTANT_CONSTANT = "potato"
import os
from typing import Iterator
+                                                                           
"""Don't remove this comment, it's cool."""
IMPORTANT_CONSTANT = "potato"
@github-actions github-actions bot added the fresh This is a new issue label May 3, 2023
@weibullguy weibullguy added P: bug PEP 257 violation or existing functionality that doesn't work as documented C: convention Relates to docstring format convention and removed fresh This is a new issue labels May 3, 2023
@weibullguy
Copy link
Member

@M1troll should be fixed in v1.6.5.

@M1troll
Copy link
Author

M1troll commented May 4, 2023

@weibullguy , Thank you! Now everything works without problems)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: convention Relates to docstring format convention P: bug PEP 257 violation or existing functionality that doesn't work as documented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants