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

Option close-quotes-on-newline doesn't work with pre-commit #169

Closed
VDuchauffour opened this issue Mar 21, 2023 · 3 comments
Closed

Option close-quotes-on-newline doesn't work with pre-commit #169

VDuchauffour opened this issue Mar 21, 2023 · 3 comments
Labels
S: feedback Open but need feedback from OP to proceed with solution
Milestone

Comments

@VDuchauffour
Copy link

VDuchauffour commented Mar 21, 2023

Hello,
It seems that the option close-quotes-on-newline is not taken into account with pre-commit when it is declared in the pyproject.toml. For instance, if I have the following files:
pyproject.toml

[tool.docformatter]
close-quotes-on-newline = true

and .pre-commit-config.yaml

  - repo: https://github.com/PyCQA/docformatter
    rev: v1.5.0
    hooks:
      - id: docformatter
        args:
          [
            "--in-place",
            "--config",
            "pyproject.toml",
          ]

When I run docformatter on the following example, it works as expected:

 class CudaStatus:
     """Singleton class that contains informations relative to CUDA in the
-    current process."""
+    current process.
+    """

But the pre-commit pipeline will not fix the issue, unless I had a "--close-quotes-on-newline", in the args section in the pre-commit-config. Any ideas about this ?
I also think that the documentation should specify that this option fixes the pydocstyle D209 rule.
Thanks

@github-actions github-actions bot added the fresh This is a new issue label Mar 21, 2023
@weibullguy weibullguy added P: bug PEP 257 violation or existing functionality that doesn't work as documented C: stakeholder Relates to docformatter stakeholder requested behavior and removed fresh This is a new issue labels Mar 21, 2023
@weibullguy weibullguy added this to the v1.7.0 milestone Apr 4, 2023
@weibullguy
Copy link
Member

@VDuchauffour this is similar to issue #172. In both cases, I see you're using docformatter-1.5.0. Could you try with docformatter-1.6.0 to see if the problem persists? Also, is that the only argument you set in pyproject.toml or is that the only setting that is being ignored?

In all of my pre-commits, docformatter reads pyproject.toml, but the only thing I set is:

[tool.docformatter]
wrap-summaries = 88
wrap-descriptions = 88

I also don't quote the args in .pre-commit-config.yaml although it should work either way.

    - repo: https://github.com/PyCQA/docformatter
      rev: v1.6.0
      hooks:
        - id: docformatter
          additional_dependencies: [tomli]
          args: [--in-place, --config, ./pyproject.toml]

@weibullguy
Copy link
Member

weibullguy commented Apr 4, 2023

@VDuchauffour actually, now that I posted that comment, you probably need to add the additional_dependencies: [tomli] to your .pre-commit-config.yaml file. If that solves your issue, this is a docformatter documentation issue.

@weibullguy weibullguy added S: feedback Open but need feedback from OP to proceed with solution and removed P: bug PEP 257 violation or existing functionality that doesn't work as documented C: stakeholder Relates to docformatter stakeholder requested behavior labels Apr 4, 2023
@VDuchauffour
Copy link
Author

Hello @weibullguy, thanks for your answers.
Actually I solved the issue simply by adding as you said additional_dependencies: [tomli] in the .pre-commit-config.yaml file. I guess it was not related to the option itself but rather to the fact that the pre-commit action can't read the pyproject file without this dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: feedback Open but need feedback from OP to proceed with solution
Projects
None yet
Development

No branches or pull requests

2 participants