CLI
docstring_format_checker.cli
🔗
Summary
Command-line interface for the docstring format checker.
check_docstrings
🔗
check_docstrings(
path: str,
config: Optional[str] = None,
exclude: Optional[list[str]] = None,
quiet: bool = False,
output: str = "list",
check: bool = False,
) -> None
Summary
Core logic for checking docstrings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
The path to the file or directory to check. |
required |
config
|
Optional[str]
|
The path to the configuration file.
Default: |
None
|
exclude
|
Optional[list[str]]
|
List of glob patterns to exclude from checking.
Default: |
None
|
quiet
|
bool
|
Whether to suppress output.
Default: |
False
|
output
|
str
|
Output format: 'table' or 'list'.
Default: |
'list'
|
check
|
bool
|
Whether to throw error if issues are found.
Default: |
False
|
Returns:
| Type | Description |
|---|---|
None
|
Nothing is returned. |
Source code in src/docstring_format_checker/cli.py
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 530 531 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 | |
main
🔗
main(
ctx: Context,
path: Optional[str] = Argument(
None,
help="Path to Python file or directory to check",
),
config: Optional[str] = Option(
None,
"--config",
"-f",
help="Path to configuration file (TOML format)",
),
exclude: Optional[list[str]] = Option(
None,
"--exclude",
"-x",
help="Glob patterns to exclude (can be used multiple times)",
),
output: str = Option(
"list",
"--output",
"-o",
help="Output format: 'table' or 'list'",
show_default=True,
),
check: bool = Option(
False,
"--check",
"-c",
help="Throw error (exit 1) if any issues are found",
),
quiet: bool = Option(
False,
"--quiet",
"-q",
help="Only output pass/fail confirmation, suppress errors unless failing",
),
example: Optional[str] = Option(
None,
"--example",
"-e",
callback=_example_callback,
is_eager=True,
help="Show examples: 'config' for configuration example, 'usage' for usage examples",
),
version: Optional[bool] = Option(
None,
"--version",
"-v",
callback=_version_callback,
is_eager=True,
help="Show version and exit",
),
help_flag: Optional[bool] = Option(
None,
"--help",
"-h",
callback=_help_callback_main,
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 |
path
|
Optional[str]
|
Path to Python file or directory to check. |
Argument(None, help='Path to Python file or directory to check')
|
config
|
Optional[str]
|
Path to configuration file (TOML format). |
Option(None, '--config', '-f', help='Path to configuration file (TOML format)')
|
exclude
|
Optional[list[str]]
|
Glob patterns to exclude. |
Option(None, '--exclude', '-x', help='Glob patterns to exclude (can be used multiple times)')
|
output
|
str
|
Output format: 'table' or 'list'. |
Option('list', '--output', '-o', help="Output format: 'table' or 'list'", show_default=True)
|
check
|
bool
|
Throw error if any issues are found. |
Option(False, '--check', '-c', help='Throw error (exit 1) if any issues are found')
|
quiet
|
bool
|
Only output pass/fail confirmation. |
Option(False, '--quiet', '-q', help='Only output pass/fail confirmation, suppress errors unless failing')
|
example
|
Optional[str]
|
Show examples: 'config' or 'usage'. |
Option(None, '--example', '-e', callback=_example_callback, is_eager=True, help="Show examples: 'config' for configuration example, 'usage' for usage examples")
|
version
|
Optional[bool]
|
Show version and exit. |
Option(None, '--version', '-v', callback=_version_callback, is_eager=True, help='Show version and exit')
|
help_flag
|
Optional[bool]
|
Show help message and exit. |
Option(None, '--help', '-h', callback=_help_callback_main, 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
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 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 | |
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
701 702 703 704 705 706 | |