Skip to content

Check hidden files named explicitly on the command line - #4002

Open
ChrisJr404 wants to merge 1 commit into
codespell-project:mainfrom
ChrisJr404:check-explicit-hidden-files
Open

Check hidden files named explicitly on the command line#4002
ChrisJr404 wants to merge 1 commit into
codespell-project:mainfrom
ChrisJr404:check-explicit-hidden-files

Conversation

@ChrisJr404

Copy link
Copy Markdown

Fixes #3822.

Passing a hidden file explicitly on the command line (for example codespell ~/.bashrc) checked nothing, because the top-level loop skipped anything hidden unless --check-hidden was set. You had to already know about --check-hidden to check a file you had just named yourself, which is surprising.

Now a hidden file named explicitly is always checked. Directories still honor --check-hidden, so recursing into one (hidden or not) does not pull in hidden contents unexpectedly, which is what the issue asked for. An explicitly-named hidden directory is therefore still skipped without the flag.

I updated test_check_hidden to the new contract and added cases for an explicit hidden file (with and without --check-filenames) and for an explicit hidden directory still being skipped. I also added a note to the --check-hidden help text so the behavior is discoverable. Full test_basic.py passes, and ruff check, ruff format --check, and mypy are clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When codespell is used with dotfiles as arguments argument it should check them without needing to use --check-hidden

1 participant