-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
Fix config file search and inclusion in header #2048
base: main
Are you sure you want to change the base?
Conversation
685bcba
to
0385403
Compare
0385403
to
db7b044
Compare
for more information, see https://pre-commit.ci
c1474fd
to
cbc8f01
Compare
@@ -630,7 +630,7 @@ def select_config_file(src_files: tuple[str, ...]) -> Path | None: | |||
# NOTE: input. | |||
working_directory = Path.cwd() | |||
src_files_as_paths = ( | |||
(working_directory / src_file).resolve() for src_file in src_files or (".",) | |||
(working_directory / src_file).resolve() for src_file in src_files + (".",) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain this? Obviously, there's some unspecified side effect in external logic, but I don't get it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds the current working directory to the search path for source files as well, as proposed in the linked issue.
@@ -245,6 +245,7 @@ def _get_default_option(option_name: str) -> Any: | |||
src_files = click.argument( | |||
"src_files", | |||
nargs=-1, | |||
is_eager=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #1902 (comment). Making only src_files
eager doesn't work though, as it won't pick up the config if not specified, then.
Just stumbled over this issue again, so I thought I might as well fix it.
Closes #1902
Contributor checklist
Maintainer checklist
backwards incompatible
,feature
,enhancement
,deprecation
,bug
,dependency
,docs
orskip-changelog
as they determine changelog listing.