CLI
docstring_format_checker.cli
π
Summary
Command-line interface for the docstring format checker.
main
π
main(
ctx: Context,
version: Optional[bool] = Option(
None,
"--version",
"-v",
callback=_version_callback,
is_eager=True,
help="Show version and exit",
),
examples: Optional[bool] = Option(
None,
"--examples",
"-e",
callback=_show_examples_callback,
is_eager=True,
help="Show usage examples and exit",
),
help_flag: Optional[bool] = Option(
None,
"--help",
"-h",
callback=_help_callback,
is_eager=True,
help="Show this message and exit",
),
) -> None
Summary
Check Python docstring formatting and completeness.
Details
This tool analyzes Python files and validates that functions, methods, and classes have properly formatted docstrings according to the configured sections.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctx
|
Context
|
The context object for the command. |
required |
version
|
Optional[bool]
|
Show version and exit. |
Option(None, '--version', '-v', callback=_version_callback, is_eager=True, help='Show version and exit')
|
examples
|
Optional[bool]
|
Show usage examples and exit. |
Option(None, '--examples', '-e', callback=_show_examples_callback, is_eager=True, help='Show usage examples and exit')
|
help_flag
|
Optional[bool]
|
Show help message and exit. |
Option(None, '--help', '-h', callback=_help_callback, is_eager=True, help='Show this message and exit')
|
Returns:
Type | Description |
---|---|
None
|
Nothing is returned. |
Source code in src/docstring_format_checker/cli.py
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 |
|
check
π
check(
path: str = Argument(
...,
help="Path to Python file or directory to check",
),
config: Optional[str] = Option(
None,
"--config",
"-c",
help="Path to configuration file (TOML format)",
),
recursive: str = Option(
"true",
"--recursive",
"-r",
help="Check directories recursively (default: true). Accepts: true/false, t/f, yes/no, y/n, 1/0, on/off",
),
exclude: Optional[list[str]] = Option(
None,
"--exclude",
"-x",
help="Glob patterns to exclude (can be used multiple times)",
),
quiet: bool = Option(
False,
"--quiet",
"-q",
help="Only show errors, no success messages",
),
verbose: bool = Option(
False,
"--verbose",
"-n",
help="Show detailed output",
),
examples: Optional[bool] = Option(
None,
"--examples",
"-e",
callback=_show_check_examples_callback,
is_eager=True,
help="Show usage examples and exit",
),
help_flag: Optional[bool] = Option(
None,
"--help",
"-h",
callback=_help_callback,
is_eager=True,
help="Show this message and exit",
),
) -> None
Summary
Check docstrings in Python files.
Details
This command checks the docstrings in the specified Python file or directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
The path to the Python file or directory to check. |
Argument(..., help='Path to Python file or directory to check')
|
config
|
Optional[str]
|
The path to the configuration file (TOML format). |
Option(None, '--config', '-c', help='Path to configuration file (TOML format)')
|
recursive
|
bool
|
Whether to check directories recursively. |
Option('true', '--recursive', '-r', help='Check directories recursively (default: true). Accepts: true/false, t/f, yes/no, y/n, 1/0, on/off')
|
exclude
|
list[str]
|
Glob patterns to exclude (can be used multiple times). |
Option(None, '--exclude', '-x', help='Glob patterns to exclude (can be used multiple times)')
|
quiet
|
bool
|
Whether to only show errors, no success messages. |
Option(False, '--quiet', '-q', help='Only show errors, no success messages')
|
verbose
|
bool
|
Whether to show detailed output. |
Option(False, '--verbose', '-n', help='Show detailed output')
|
examples
|
Optional[bool]
|
Show usage examples and exit. |
Option(None, '--examples', '-e', callback=_show_check_examples_callback, is_eager=True, help='Show usage examples and exit')
|
help_flag
|
Optional[bool]
|
Show help message and exit. |
Option(None, '--help', '-h', callback=_help_callback, is_eager=True, help='Show this message and exit')
|
Returns:
Type | Description |
---|---|
None
|
Nothing is returned. |
Source code in src/docstring_format_checker/cli.py
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 |
|
config_example
π
config_example(
help_flag: Optional[bool] = Option(
None,
"--help",
"-h",
callback=_help_callback,
is_eager=True,
help="Show this message and exit",
)
) -> None
Summary
Show example configuration file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
help_flag
|
Optional[bool]
|
Show help message and exit. |
Option(None, '--help', '-h', callback=_help_callback, is_eager=True, help='Show this message and exit')
|
Returns:
Type | Description |
---|---|
None
|
Nothing is returned. |
Source code in src/docstring_format_checker/cli.py
612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 |
|
entry_point
π
entry_point() -> None
Summary
Entry point for the CLI scripts defined in pyproject.toml.
Source code in src/docstring_format_checker/cli.py
707 708 709 710 711 712 |
|