Skip to content

Commit

Permalink
refactor: Force prefer_short to be keyword-only
Browse files Browse the repository at this point in the history
Turning on `flake8-boolean-trap` linting via Ruff resulted in the
following findings:

    reverse_argparse/reverse_argparse.py:242:31:
    FBT002 Boolean default positional argument in function definition
    reverse_argparse/reverse_argparse.py:242:31:
    FBT001 Boolean-typed positional argument in function definition
    Found 2 errors.

Switching `prefer_short` from a positional to a keyword-only argument
addresses the problem.

Note that this is technically a breaking change, but only for a
"private" method, not in the packages public API.  Therefore the change
is not registered as a breaking change via Conventional Commit syntax,
and no major version update will be created.  If users were relying on
the prior behavior of this internal method, they can simply switch to
the keyword syntax when calling it.
  • Loading branch information
jmgate committed Apr 22, 2024
1 parent 1ddbb3d commit 4c94afd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion reverse_argparse/reverse_argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def _get_short_option_strings(
]

def _get_option_string(
self, action: Action, prefer_short: bool = False
self, action: Action, *, prefer_short: bool = False
) -> str:
"""
Get the option string for the `action`.
Expand Down

0 comments on commit 4c94afd

Please sign in to comment.