I am trying to use the docformatter hook with pre-commit to format my Python code. However, I am encountering an issue where the docformatter hook does not respect the configuration in my pyproject.toml file when run through pre-commit, but it does respect the configuration when run manually with poetry.
Specifically, I have the following configuration for the docformatter hook in my .pre-commit-config.yaml file:
bash
- repo: https://github.com/PyCQA/docformatter
rev: v1.5.0
hooks:
- id: docformatter
args: ["--in-place", "--config", "./pyproject.toml"]
However, when I run pre-commit run --all-files docformatter, docformatter seems to ignore the configuration in pyproject.toml and uses its default settings instead. On the other hand, when I run poetry run docformatter ., docformatter correctly uses the settings in pyproject.toml.
Can someone explain why this might be happening, and how I can get docformatter to respect my pyproject.toml configuration when run through pre-commit?
Thank you.
I am trying to use the
docformatterhook withpre-committo format my Python code. However, I am encountering an issue where thedocformatterhook does not respect the configuration in mypyproject.tomlfile when run throughpre-commit, but it does respect the configuration when run manually withpoetry.Specifically, I have the following configuration for the
docformatterhook in my.pre-commit-config.yamlfile:bash
- repo: https://github.com/PyCQA/docformatter rev: v1.5.0 hooks: - id: docformatter args: ["--in-place", "--config", "./pyproject.toml"]However, when I run
pre-commit run --all-files docformatter,docformatterseems to ignore the configuration inpyproject.tomland uses its default settings instead. On the other hand, when I runpoetry run docformatter .,docformattercorrectly uses the settings inpyproject.toml.Can someone explain why this might be happening, and how I can get
docformatterto respect mypyproject.tomlconfiguration when run throughpre-commit?Thank you.