6a4a49158c
- Fix error suppression in validate_all_commands: log at DEBUG level instead of silently swallowing exceptions - Fix multi-word command name parsing bug: use command_token_count to skip the full command prefix when extracting positional values - Add @cli tag to features/cli_docstring_example_validation.feature - Update CONTRIBUTING.md with CLI docstring example style guide - Update CHANGELOG.md with entry for automated docstring validation - Update CONTRIBUTORS.md with contribution entry - Fix test design flaws: separate Given/When/Then steps per scenario - Add validate_all_commands test coverage via new Behave scenario - Fix _extract_positional_args to only count required positional args
42 lines
2.1 KiB
Gherkin
42 lines
2.1 KiB
Gherkin
@cli
|
|
Feature: CLI docstring example validation
|
|
As a documentation maintainer
|
|
I want to ensure CLI docstring examples respect positional argument order
|
|
So that published documentation accurately reflects the command signature
|
|
|
|
Scenario: Validator detects positional arguments before options
|
|
Given I have a CLI command with positional arguments and options
|
|
When I validate the command's docstring examples
|
|
Then the validation should pass for examples with positional args before options
|
|
|
|
Scenario: Validator rejects options before positional arguments
|
|
Given I have a CLI command with options placed before positional arguments
|
|
When I validate the bad command's docstring examples
|
|
Then the validation should fail for examples with options before positional args
|
|
|
|
Scenario: Validator handles commands without examples
|
|
Given I have a CLI command without docstring examples
|
|
When I validate the command's docstring examples
|
|
Then the validation should pass for commands without examples
|
|
|
|
Scenario: Validator parses example lines with shlex
|
|
Given I have a CLI command with quoted arguments in examples
|
|
When I validate the command's docstring examples
|
|
Then the validation should correctly parse quoted arguments
|
|
|
|
Scenario: Validator reports clear error messages
|
|
Given I have a CLI command with invalid docstring examples
|
|
When I validate the invalid command's docstring examples
|
|
Then the error message should identify the command and example line
|
|
And the error message should explain the positional argument order requirement
|
|
|
|
Scenario: Validator handles multi-word command names correctly
|
|
Given I have a multi-word CLI command with positional arguments and options
|
|
When I validate the multi-word command's docstring examples
|
|
Then the validation should pass for multi-word commands with correct argument order
|
|
|
|
Scenario: Validator scans all commands in a directory
|
|
Given I have a directory with CLI command modules
|
|
When I validate all commands in the directory
|
|
Then the validate all commands result should be True
|