You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: -h/--help after -- prints help instead of being treated as a file name #423
The help check in _main looks at every argument, including those after the -- end-of-options marker. A file literally named -h (or --help) passed after -- prints the usage text and exits 0 instead of being checked or formatted. With --check a CI gate passes silently. With --in-place the file is skipped. This is rare, since the file must be named like an option.
src/docformatter/__main__.py:116 tests "--help" in configurator.args_lst or "-h" in configurator.args_lst over all tokens. The --config pre-scan in src/docformatter/configuration.py already stops at -- (line 104). Limiting the help check to the tokens before the first -- would fix it.
I have a fix with a regression test ready and will open a pull request for it right after filing this issue; it will link back here.
A correction to my report: a plain file named -h is not a Python file, so docformatter skips it even after the fix, and --check still exits 0 there. The case the bug really affects is a directory named -h given after -- with --recursive: the usage text is printed and the check exits 0 without reading the Python files in it. That is the case #424 tests. Sorry for the confusion.
Activity
shashank11yadav commentedon Nov 30, 2026
A correction to my report: a plain file named
-his not a Python file, so docformatter skips it even after the fix, and--checkstill exits 0 there. The case the bug really affects is a directory named-hgiven after--with--recursive: the usage text is printed and the check exits 0 without reading the Python files in it. That is the case #424 tests. Sorry for the confusion.