Skip to content

CLI Interaction Guide๐Ÿ”—

Interface directly with the docstring-format-checker (or dfc) to standardise your project's documentation. Access a detailed walkthrough of all command-line operations, designed to help new developers master the tool's capabilities.

๐Ÿ› ๏ธ The dfc Command๐Ÿ”—

Interact with the tool primarily through the dfc command. Treat this as an alias for the longer docstring-format-checker command, providing a more concise interface for frequent use.

๐Ÿ“Ÿ Basic Syntax๐Ÿ”—

Follow the general structure of a dfc command:

Terminal
dfc [OPTIONS] [PATHS]...

Target one or more paths, such as specific Python files or entire directories.

Full Help Command (--help / -h)๐Ÿ”—

Terminal
dfc --help
     _                _        _                    __                            _             _               _
  __| | ___   ___ ___| |_ _ __(_)_ __   __ _       / _| ___  _ __ _ __ ___   __ _| |_       ___| |__   ___  ___| | _____ _ __
 / _` |/ _ \ / __/ __| __| '__| | '_ \ / _` |_____| |_ / _ \| '__| '_ ` _ \ / _` | __|____ / __| '_ \ / _ \/ __| |/ / _ \ '__|
| (_| | (_) | (__\__ \ |_| |  | | | | | (_| |_____|  _| (_) | |  | | | | | | (_| | ||_____| (__| | | |  __/ (__|   <  __/ |
 \__,_|\___/ \___|___/\__|_|  |_|_| |_|\__, |     |_|  \___/|_|  |_| |_| |_|\__,_|\__|     \___|_| |_|\___|\___|_|\_\___|_|
                                       |___/


 Usage: dfc [OPTIONS] [PATHS]... COMMAND [ARGS]...

 A CLI tool to check and validate Python docstring formatting and completeness.

โ•ญโ”€ Arguments โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚   paths      [PATHS]...  Path(s) to Python file(s) or directory(s) for DFC to check                                                                                               โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ --config   -f      TEXT  Path to configuration file (TOML format)                                                                                                                 โ”‚
โ”‚ --exclude  -x      TEXT  Glob patterns to exclude (can be used multiple times)                                                                                                    โ”‚
โ”‚ --output   -o      TEXT  Output format: 'table' or 'list' [default: list]                                                                                                         โ”‚
โ”‚ --check    -c            Throw error (exit 1) if any issues are found                                                                                                             โ”‚
โ”‚ --quiet    -q            Only output pass/fail confirmation, suppress errors unless failing                                                                                       โ”‚
โ”‚ --example  -e      TEXT  Show examples: 'config' for configuration example, 'usage' for usage examples                                                                            โ”‚
โ”‚ --version  -v            Show version and exit                                                                                                                                    โ”‚
โ”‚ --help     -h            Show this message and exit                                                                                                                               โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

โ•ญโ”€ Usage Examples โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Execute the below commands in any terminal after installing the package.                                                                                                          โ”‚
โ”‚                                                                                                                                                                                   โ”‚
โ”‚ dfc myfile.py                   # Check a single Python file (list output)                                                                                                        โ”‚
โ”‚ dfc myfile.py other_file.py     # Check multiple Python files                                                                                                                     โ”‚
โ”‚ dfc src/                        # Check all Python files in src/ directory                                                                                                        โ”‚
โ”‚ dfc -x src/app/__init__.py src/ # Check all Python files in src/ directory, excluding one init file                                                                               โ”‚
โ”‚ dfc --output=table myfile.py    # Check with table output format                                                                                                                  โ”‚
โ”‚ dfc -o list myfile.py           # Check with list output format (default)                                                                                                         โ”‚
โ”‚ dfc --check myfile.py           # Check and exit with error if issues found                                                                                                       โ”‚
โ”‚ dfc --quiet myfile.py           # Check quietly, only show pass/fail                                                                                                              โ”‚
โ”‚ dfc --quiet --check myfile.py   # Check quietly and exit with error if issues found                                                                                               โ”‚
โ”‚ dfc . --exclude '*/tests/*'     # Check current directory, excluding tests                                                                                                        โ”‚
โ”‚ dfc . -c custom.toml            # Use custom configuration file                                                                                                                   โ”‚
โ”‚ dfc --example=config            # Show example configuration                                                                                                                      โ”‚
โ”‚ dfc -e usage                    # Show usage examples (this help)                                                                                                                 โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ•ญโ”€ Configuration Example โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Place the below config in your `pyproject.toml` file.                                                                                                                             โ”‚
โ”‚                                                                                                                                                                                   โ”‚
โ”‚ [tool.dfc]                                                                                                                                                                        โ”‚
โ”‚ # or [tool.docstring-format-checker]                                                                                                                                              โ”‚
โ”‚ allow_undefined_sections = false                                                                                                                                                  โ”‚
โ”‚ require_docstrings = true                                                                                                                                                         โ”‚
โ”‚ check_private = true                                                                                                                                                              โ”‚
โ”‚ validate_param_types = true                                                                                                                                                       โ”‚
โ”‚ optional_style = "validate"  # "silent", "validate", or "strict"                                                                                                                  โ”‚
โ”‚ sections = [                                                                                                                                                                      โ”‚
โ”‚     { order = 1, name = "summary",  type = "free_text",          required = true, admonition = "note", prefix = "!!!" },                                                          โ”‚
โ”‚     { order = 2, name = "details",  type = "free_text",          required = false, admonition = "abstract", prefix = "???+" },                                                    โ”‚
โ”‚     { order = 3, name = "params",   type = "list_name_and_type", required = false },                                                                                              โ”‚
โ”‚     { order = 4, name = "raises",   type = "list_type",          required = false },                                                                                              โ”‚
โ”‚     { order = 5, name = "returns",  type = "list_name_and_type", required = false },                                                                                              โ”‚
โ”‚     { order = 6, name = "yields",   type = "list_type",          required = false },                                                                                              โ”‚
โ”‚     { order = 7, name = "examples", type = "free_text",          required = false, admonition = "example", prefix = "???+" },                                                     โ”‚
โ”‚     { order = 8, name = "notes",    type = "free_text",          required = false, admonition = "note", prefix = "???" },                                                         โ”‚
โ”‚ ]                                                                                                                                                                                 โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

๐Ÿ“‚ Target Paths๐Ÿ”—

Determine which parts of your codebase dfc should examine.

๐Ÿ“„ Single Files๐Ÿ”—

Check an individual file by providing its path:

Terminal
dfc sample.py

๐Ÿ“ Directories๐Ÿ”—

Check all Python files within a directory (including subdirectories) by providing the folder path:

Terminal
dfc src/

๐Ÿ—ƒ๏ธ Multiple Targets๐Ÿ”—

Combine multiple files and directories in a single command:

Terminal
dfc module1.py src/utils/

โš™๏ธ Core Options๐Ÿ”—

Customise the behaviour of dfc and its search location for settings.

๐Ÿ“„ Configuration File (--config / -f)๐Ÿ”—

Direct dfc to look for a [tool.dfc] section in your pyproject.toml. Use this option to point to a specific TOML file instead.

Terminal
dfc --config=custom_config.toml src/

๐Ÿšซ Exclusion Patterns (--exclude / -x)๐Ÿ”—

Ignore specific files or directories using glob patterns. This is particularly useful for skipping third-party libraries, virtual environments, or test suites.

Terminal
dfc . --exclude='*/tests/*' --exclude 'setup.py'

Note

Provide the --exclude flag multiple times to specify several patterns.

๐ŸŽจ Output Format (--output / -o)๐Ÿ”—

Standardise the appearance of error reports. Choose between a detailed list (default) or a structured table.

๐Ÿ“ Render as a list๐Ÿ”—

Terminal
dfc --output=list sample.py
sample.py
  Line 1 - function 'calculate_area':
    - Missing required section: 'summary'
    - Missing required section: 'params'

๐Ÿ“Š Render as a table๐Ÿ”—

Terminal
dfc --output=table sample.py
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ File      โ”ƒ Line โ”ƒ Item           โ”ƒ Type     โ”ƒ Error                                 โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ sample.py โ”‚    1 โ”‚ calculate_area โ”‚ function โ”‚ - Missing required section: 'summary' โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ›ก๏ธ Execution Controls๐Ÿ”—

Manage the interaction between dfc and other tools or scripts.

๐Ÿ Check Mode (--check / -c)๐Ÿ”—

Ensure that dfc returns a non-zero exit code if any issues are found. Integrate dfc into Continuous Integration (CI) pipelines or git hooks with this flag.

Terminal
dfc --check src/

๐Ÿ”‡ Quiet Mode (--quiet / -q)๐Ÿ”—

Suppress all detailed error messages. Report only a high-level summary if errors occur, or nothing at all if the check passes.

Terminal
dfc --quiet --check src/

๐Ÿ“– Helper Commands๐Ÿ”—

Access built-in documentation and version information directly from the terminal.

๐Ÿ’ก Show Examples (--example / -e)๐Ÿ”—

View pre-configured templates to help you get started quickly.

  • --example config: Display a comprehensive TOML configuration template.
  • --example usage: Display common CLI usage patterns.
Terminal
dfc --example=config

๐Ÿ”ข Version Information (--version / -v)๐Ÿ”—

Check which version of docstring-format-checker is currently installed.

Terminal
dfc --version

โ“ Help Message (--help / -h)๐Ÿ”—

Display a full summary of all available arguments, options, and usage examples.

Terminal
dfc --help

๐ŸŽ“ Guided Walkthrough๐Ÿ”—

Follow these steps to explore the most important features of the dfc CLI.

๐Ÿ—๏ธ 1. Create a workspace๐Ÿ”—

Prepare a small environment with a few sample files to test the tool. Create a directory named dfc_walkthrough and add the following files:

dfc_walkthrough/good_code.py
def calculate_area(width: int, height: int) -> int:
    """
    !!! note "Summary"
        Calculate the area of a rectangle.

    Params:
        width (int): The width of the rectangle.
        height (int): The height of the rectangle.

    Returns:
        (int): The calculated area.
    """
    return width * height


def calculate_perimeter(width: int, height: int) -> int:
    """
    !!! note "Summary"
        Calculate the perimeter of a rectangle.

    Params:
        width (int): The width of the rectangle.
        height (int): The height of the rectangle.

    Returns:
        (int): The calculated perimeter.
    """
    return 2 * (width + height)
dfc_walkthrough/bad_code.py
def calculate_area(width: int, height: int) -> int:
    """
    Calculate the area of a rectangle.

    Args:
        width (int): The width of the rectangle.
        height (int): The height of the rectangle.

    Returns:
        (int): The calculated area.
    """
    return width * height


def calculate_perimeter(width: int, height: int) -> int:
    """
    Calculate the perimeter of a rectangle.

    Parameters:
        width (int): The width of the rectangle.
        height (int): The height of the rectangle.

    Returns:
        (int): The calculated perimeter.
    """
    return 2 * (width + height)

๐Ÿ” 2. Identify issues๐Ÿ”—

Run a standard check on the bad_code.py file to see the inconsistency reports from dfc.

Terminal
dfc bad_code.py

Expect dfc to identify missing summary admonitions and incorrectly named sections like Args (which should be Params by default).

๐Ÿ“Š 3. Utilise the table view๐Ÿ”—

Switch to the table format to get a more structured overview of the errors. Read multiple issues with ease using this layout.

Terminal
dfc --output=table bad_code.py

๐Ÿ“‚ 4. Check an entire directory๐Ÿ”—

Instruct dfc to scan the whole directory. Find all .py files and report on each one automatically.

Terminal
dfc .

View results for both good_code.py (which should pass) and bad_code.py in the output.

๐Ÿค– 5. Standardise for CI๐Ÿ”—

Prepare your commands for a CI environment. Use the --quiet and --check flags to ensure that the process fails if documentation is insufficient, without cluttering the logs.

Terminal
dfc --quiet --check .

Observe no output upon a successful check. Receive a concise summary if errors are present:

Found 6 error(s) in 2 functions over 1 file

โš ๏ธ Watch Out๐Ÿ”—

Keep these nuances in mind to avoid common pitfalls:

๐Ÿš Shell Pattern Matching๐Ÿ”—

Different shells (like bash, zsh, or fish) handle glob patterns (like *) differently. Always surround your exclusion patterns with quotes to ensure they are passed correctly to dfc.

  • Correct: dfc --exclude '*/tests/*' .
  • Incorrect: dfc --exclude */tests/* .

๐Ÿ“ Argument Order๐Ÿ”—

Move flags to the start of the command if errors occur (a common requirement for Typer-based tools):

  • Recommended: dfc --output=table src/
  • Sometimes Unreliable: dfc src/ --output=table