CLI
docstring_format_checker.cli
🔗
Summary
Command-line interface for the docstring format checker.
check_docstrings
🔗
check_docstrings(
paths: list[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 |
|---|---|---|---|
paths
|
list[str]
|
The path(s) to the file(s) or directory(ies) 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
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 | |
main
🔗
main(
ctx: Context,
paths: Optional[list[str]] = Argument(
None,
help="Path(s) to Python file(s) or directory(s) for DFC 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 |
paths
|
Optional[list[str]]
|
Path(s) to Python file(s) or directory(ies) to check. |
Argument(None, help='Path(s) to Python file(s) or directory(s) for DFC 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
821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 | |
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
930 931 932 933 934 935 | |