Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

fix: do not pass file names with pre-commit #610

Merged
merged 5 commits into from
Jan 8, 2023
Merged

Conversation

yajo
Copy link
Contributor

@yajo yajo commented Nov 7, 2022

This is the only way pydocstyle will obey its own match rules.

Thanks for submitting a PR!

Please make sure to check for the following items:

  • Add unit tests and integration tests where applicable.
    If you've added an error code or changed an error code behavior,
    you should probably add or change a test case file under tests/test_cases/ and add
    it to the list under tests/test_definitions.py.
    If you've added or changed a command line option,
    you should probably add or change a test in tests/test_integration.py.
  • Add a line to the release notes (docs/release_notes.rst) under "Current Development Version".
    Make sure to include the PR number after you open and get one.

Please don't get discouraged as it may take a while to get a review.

This is the only way pydocstyle will obey its own match rules.
@samj1912 samj1912 enabled auto-merge (squash) January 8, 2023 17:58
@samj1912 samj1912 merged commit f6bee54 into PyCQA:master Jan 8, 2023
@bszonye
Copy link

bszonye commented Jan 8, 2023

This change is causing pre-commit to emit a warning:

$ pre-commit run --all-files
[WARNING] Unexpected key(s) present on https://github.com/pycqa/pydocstyle => pydocstyle: pass_file_names

It looks like the correct spelling of the option is pass_filenames:
https://pre-commit.com/#hooks-pass_filenames

Is this change actually working as expected?

@bszonye
Copy link

bszonye commented Jan 8, 2023

Also, this appears to change the documented behavior here:
https://www.pydocstyle.org/en/stable/usage.html#usage-with-the-pre-commit-git-hooks-framework

Checked-in python files will be passed as positional arguments so no need to use --match=*.py. You can also use command line arguments instead of configuration files to achieve the same effect with less files.

If that's changing then the documentation needs an update and possibly instructions for how to get the old behavior:

- repo: https://github.com/pycqa/pydocstyle
  rev: 6.2.3
  hooks:
  - id: pydocstyle
    pass_filenames: true

@bszonye
Copy link

bszonye commented Jan 8, 2023

Should I move my comments here to a new issue? I noticed that a revert commit has been opened and closed a couple times now.

@samj1912
Copy link
Member

samj1912 commented Jan 8, 2023

This commit has been reverted.

@bszonye
Copy link

bszonye commented Jan 8, 2023

Thanks! By the way, I discovered accidentally that the underlying issue that motivated this PR might have already been addressed. Please see my comment here:
#111 (comment)

@bszonye
Copy link

bszonye commented Jan 8, 2023

Aha, I was still seeing the error in pre-commit because this:

- repo: https://github.com/pycqa/pydocstyle
  rev: 6.2.3
  hooks:
  - id: pydocstyle

gets the broken config from the 6.2.3 release. Reverting my config to 6.2.2 works around the problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants