oliver-zehentleitner / maity
cli: one bounded whole-number argparse type instead of four that parse differently
tsk-6b2rbjaxjn52 Proposed
Audit round 4 (tsk-hgnbapyw7hnh), read at 0a1b832e. Kind: duplication (a rule written four ways).
What is wrong
cli/src/maity/cli.pyhas four argparse types for 'a whole number from A to B', each parsing differently:_chat_limit(cli.py:2507-2510):isascii() and isdigit(), then the range._grace(cli.py:3598-3602): bareint(value); a non-number raises ValueError, so argparse prints its generic 'invalid _grace value' text._ticker_limit(cli.py:4191-4198):int(value)with its own message._uuid_count(cli.py:4820-4828, new with #2038):int(value, 10), which also takes+5,5,1_000and non-ASCII digits that_chat_limitrefuses._seq_arg(cli.py:2794) is the same shape with no upper bound.
Proposal
- One factory, e.g.
_whole(low, high, name), with the_chat_limitrule (ASCII digits only) and one message form; the five options use it.
Effort / risk: S. Low; usage errors only. test_cli and test_uuid pin the messages that change.