-
Notifications
You must be signed in to change notification settings - Fork 510
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 searching from inside a hidden directory #2377
Fix searching from inside a hidden directory #2377
Conversation
When searching files like this: ``` mkdir .hidden_folder cd .hidden_folder touch File.kt ktlint '*.kt' ``` ktlint reported that it found no files. The fact that the current directory is hidden should have no effect.
Tnx for your contribution. Unfortunately, I have to reject it in its current form. What are your reasons to use hidden folders and what is your need to scan them? Hidden directories are excluded on purpose. I think, the original reason was to exclude those directories as they are used by version control systems like git. Scanning files in Of course the current exclusion of all hidden folders, might lead to exclusion of folders for which you do want to enable scanning. The default behavior of excluding hidden folders may not be changed. Have you tried to specify the path to your hidden folder as glob? Something like below, does also scan the hidden folders for me:
|
Understandable, nothing changes in those cases. The hidden folders under the root folder continue to be skipped. All the existing tests pass as well, including those that test that ktlint does not enter hidden folders. There is a side-effect of the current logic, however: if the root folder itself is hidden from the point of view of its parent then no searching will be done at all.
I have a tool that launches subcommands from within a hidden folder, and unfortunately I have little control over it. One of the subcommands is ktlint, and ktlint refuses to search any files, no matter how I lay them out on the filesystem.
In this example as written, the shell expands ktlint '**/*.kt' '**/*.kts' 'src/main/kotlin/.hidden_folder/**' then ktlint stops searching files under 'src/main/kotlin/.hidden_folder'. cd src/main/kotlin/.hidden_folder
ktlint '**' |
… Make unit test less confusing by renaming ".git" to ".hidden"
Tnx for detailed explanation! Now I understand what the change is about. I have added a commit to add a log message and made the unit less confusing. |
No worries, thanks! |
Description
When searching files like this:
ktlint reported that it found no files.
The fact that the current directory is hidden should have no effect.
Checklist
Before submitting the PR, please check following (checks which are not relevant may be ignored):
Closes #<xxx>
orFixes #<xxx>
(replace<xxx>
with issue number)Documentation is updated. See difference between snapshot and release documentation