Closed Bug 817729 Opened 13 years ago Closed 13 years ago

dmcli: values min_args and max_args a little confusing

Categories

(Testing :: Mozbase, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mcote, Unassigned)

Details

Attachments

(1 file)

DMCli.commands uses integers to specify min_args and max_args most of the time, but sometimes it uses None instead of 0. I think it would be clearer to always use 0; as it stands, it seems to imply that None does something different from 0. Also if we always use integers, we can simplify the if statement on lines 140-141 to remove the boolean check and just compare arg lengths.
Correction: None *does* have a special meaning for max_args: no limit to the number of arguments. It still doesn't seem to make sense for min_args, though, so I propose changing all None values to 0 for min_args and putting a comment about the special meaning of None for max_args.
Actually it looks like argument-length enforcement was broken if max_args was 0, since the if statement didn't actually look for None specifically, just any falsey value.
Assignee: nobody → mcote
Status: NEW → ASSIGNED
Attachment #687948 - Flags: review?(wlachance)
Comment on attachment 687948 [details] [diff] [review] Fix and clarify argument-length check lgtm
Attachment #687948 - Flags: review?(wlachance) → review+
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: