CLI Interface

Command-line interface for docments compliance checking

create_parser


def create_parser(
    
)->ArgumentParser: # Configured argument parser

Create and configure the argument parser for docments CLI


handle_autofix


def handle_autofix(
    args:Namespace, # Parsed command line arguments
)->int: # Exit code

Handle auto-fix mode for non-compliant functions


generate_report


def generate_report(
    results:list, # Check results from check_project
    format:str, # Output format ("text" or "json")
    verbose:bool=False, # Whether to show compliant definitions
)->str: # Generated report as string

Generate a report in the specified format


output_report


def output_report(
    report:str, # Report content to output
    output_path:Optional=None, # File path to save report to
    quiet:bool=False, # Whether to suppress output
)->None:

Output the report to console or file


main


def main(
    args:Optional=None, # Command line arguments (for testing)
)->int: # Exit code (0 for success, 1 for non-compliance)

Main CLI entry point for docments checker

# Test the CLI with different options
print("Basic check:")
exit_code = main([])
print(f"\nExit code: {exit_code}")

print("\n" + "="*50 + "\n")

print("JSON format:")
main(["--format", "json"])
Basic check:
📚 Docments Compliance Report
==================================================
Total definitions: 58
✅ Compliant: 58
❌ Non-compliant: 0
⚠️  With TODO placeholders: 5


⚠️  Definitions with TODO placeholders:
------------------------------

📓 03_autofix.ipynb:
  ⚠️  needs_fixing (1 TODOs)
  ⚠️  get_param_name (2 TODOs)
  ⚠️  needs_param_fix (2 TODOs)

📓 04_cli.ipynb:
  ⚠️  create_parser (1 TODOs)
  ⚠️  output_report (1 TODOs)

Exit code: 0

==================================================

JSON format:
{
  "summary": {
    "total": 58,
    "compliant": 58,
    "non_compliant": 0,
    "with_todos": 5,
    "total_todos": 7
  },
  "by_notebook": {
    "00_core.ipynb": {
      "compliant": [
        {
          "name": "DocmentsCheckResult",
          "type": "ClassDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {},
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {},
          "return_has_type_hint": false,
          "params_missing_type_hints": []
        },
        {
          "name": "__post_init__",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {},
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {},
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "extract_param_docs_from_func",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "func": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "func": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "extract_param_docs",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "source": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "source": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "check_return_doc",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "source": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "source": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "count_todos_in_docs",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "source": true,
            "name": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "source": true,
            "name": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "check_has_docstring_from_func",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "func": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "func": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "check_has_docstring",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "source": true,
            "name": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "source": true,
            "name": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "check_type_hints",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "definition": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "definition": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "check_params_documentation",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "definition": true,
            "source": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "definition": true,
            "source": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "determine_compliance",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "has_docstring": true,
            "params_documented": true,
            "return_documented": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "has_docstring": true,
            "params_documented": true,
            "return_documented": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "check_definition",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "definition": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "definition": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "check_notebook",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "nb_path": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "nb_path": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "check_function",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "func": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "func": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        }
      ],
      "non_compliant": [],
      "with_todos": []
    },
    "03_autofix.ipynb": {
      "compliant": [
        {
          "name": "needs_fixing",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {},
          "return_documented": true,
          "has_todos": true,
          "todo_count": 1,
          "params_with_type_hints": {},
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "get_param_name",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "param_str": true
          },
          "return_documented": true,
          "has_todos": true,
          "todo_count": 2,
          "params_with_type_hints": {
            "param_str": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "needs_param_fix",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "param_name": true
          },
          "return_documented": true,
          "has_todos": true,
          "todo_count": 2,
          "params_with_type_hints": {
            "param_name": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "find_signature_boundaries",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "lines": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "lines": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "split_parameters",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "params_str": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "params_str": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "parse_single_line_signature",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "sig_line": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "sig_line": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "generate_param_todo_comment",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "param_name": true,
            "result": true,
            "existing_comment": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "param_name": true,
            "result": true,
            "existing_comment": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "generate_return_todo_comment",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "result": true,
            "existing_comment": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "result": true,
            "existing_comment": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "build_fixed_single_line_function",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "parsed": true,
            "params": true,
            "result": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "parsed": true,
            "params": true,
            "result": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "fix_multi_line_signature",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "lines": true,
            "def_line_idx": true,
            "sig_end_idx": true,
            "result": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "lines": true,
            "def_line_idx": true,
            "sig_end_idx": true,
            "result": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "fix_class_definition",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "result": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "result": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "insert_function_docstring",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "lines": true,
            "def_line_idx": true,
            "indent": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "lines": true,
            "def_line_idx": true,
            "indent": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "fix_single_line_function",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "lines": true,
            "def_line_idx": true,
            "result": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "lines": true,
            "def_line_idx": true,
            "result": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "fix_multi_line_function",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "lines": true,
            "def_line_idx": true,
            "sig_end_idx": true,
            "result": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "lines": true,
            "def_line_idx": true,
            "sig_end_idx": true,
            "result": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "generate_fixed_source",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "result": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "result": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "fix_notebook",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "nb_path": true,
            "dry_run": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "nb_path": true,
            "dry_run": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "DocstringInfo",
          "type": "ClassDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {},
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {},
          "return_has_type_hint": false,
          "params_missing_type_hints": []
        },
        {
          "name": "detect_docstring_style",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "docstring": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "docstring": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "parse_google_docstring",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "docstring": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "docstring": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "parse_numpy_docstring",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "docstring": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "docstring": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "parse_sphinx_docstring",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "docstring": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "docstring": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "extract_docstring_info",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "source": true,
            "name": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "source": true,
            "name": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "convert_to_docments_format",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "source": true,
            "docstring_info": true,
            "result": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "source": true,
            "docstring_info": true,
            "result": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "convert_single_line_to_docments",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "sig_line": true,
            "docstring_info": true,
            "result": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "sig_line": true,
            "docstring_info": true,
            "result": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "convert_multiline_to_docments",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "sig_lines": true,
            "docstring_info": true,
            "result": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "sig_lines": true,
            "docstring_info": true,
            "result": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "replace_docstring_in_body",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "body_lines": true,
            "description": true,
            "def_line": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "body_lines": true,
            "description": true,
            "def_line": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "generate_fixed_source_with_conversion",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "result": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "result": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "fix_notebook_with_conversion",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "nb_path": true,
            "dry_run": true,
            "convert_docstrings": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "nb_path": true,
            "dry_run": true,
            "convert_docstrings": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        }
      ],
      "non_compliant": [],
      "with_todos": [
        {
          "name": "needs_fixing",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {},
          "return_documented": true,
          "has_todos": true,
          "todo_count": 1,
          "params_with_type_hints": {},
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "get_param_name",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "param_str": true
          },
          "return_documented": true,
          "has_todos": true,
          "todo_count": 2,
          "params_with_type_hints": {
            "param_str": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "needs_param_fix",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "param_name": true
          },
          "return_documented": true,
          "has_todos": true,
          "todo_count": 2,
          "params_with_type_hints": {
            "param_name": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        }
      ]
    },
    "01_scanner.ipynb": {
      "compliant": [
        {
          "name": "get_export_cells",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "nb_path": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "nb_path": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "extract_definitions",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "source": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "source": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "scan_notebook",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "nb_path": true,
            "nbs_root": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "nb_path": true,
            "nbs_root": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "scan_project",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "nbs_path": true,
            "pattern": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "nbs_path": true,
            "pattern": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        }
      ],
      "non_compliant": [],
      "with_todos": []
    },
    "04_cli.ipynb": {
      "compliant": [
        {
          "name": "create_parser",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {},
          "return_documented": true,
          "has_todos": true,
          "todo_count": 1,
          "params_with_type_hints": {},
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "handle_autofix",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "args": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "args": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "generate_report",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "results": true,
            "format": true,
            "verbose": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "results": true,
            "format": true,
            "verbose": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "output_report",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "report": true,
            "output_path": true,
            "quiet": true
          },
          "return_documented": true,
          "has_todos": true,
          "todo_count": 1,
          "params_with_type_hints": {
            "report": true,
            "output_path": true,
            "quiet": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "main",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "args": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "args": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        }
      ],
      "non_compliant": [],
      "with_todos": [
        {
          "name": "create_parser",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {},
          "return_documented": true,
          "has_todos": true,
          "todo_count": 1,
          "params_with_type_hints": {},
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "output_report",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "report": true,
            "output_path": true,
            "quiet": true
          },
          "return_documented": true,
          "has_todos": true,
          "todo_count": 1,
          "params_with_type_hints": {
            "report": true,
            "output_path": true,
            "quiet": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        }
      ]
    },
    "02_report.ipynb": {
      "compliant": [
        {
          "name": "check_project",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "nbs_path": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "nbs_path": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "_generate_summary_stats",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "results": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "results": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "_generate_non_compliant_section",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "results": true,
            "by_notebook": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "results": true,
            "by_notebook": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "_generate_todos_section",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "results": true,
            "by_notebook": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "results": true,
            "by_notebook": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "_generate_compliant_section",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "results": true,
            "by_notebook": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "results": true,
            "by_notebook": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "generate_text_report",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "results": true,
            "verbose": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "results": true,
            "verbose": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        },
        {
          "name": "generate_json_report",
          "type": "FunctionDef",
          "has_docstring": true,
          "missing_params": [],
          "params_documented": {
            "results": true
          },
          "return_documented": true,
          "has_todos": false,
          "todo_count": 0,
          "params_with_type_hints": {
            "results": true
          },
          "return_has_type_hint": true,
          "params_missing_type_hints": []
        }
      ],
      "non_compliant": [],
      "with_todos": []
    }
  }
}
0
# Test the new --convert-docstrings flag
print("Testing CLI with conversion support:")

# Test the parser with the new flag
parser = create_parser()
test_args = parser.parse_args(["--fix", "--convert-docstrings", "--dry-run"])

print(f"Parsed args:")
print(f"  fix: {test_args.fix}")
print(f"  convert_docstrings: {test_args.convert_docstrings}")
print(f"  dry_run: {test_args.dry_run}")

print("\nCLI help text for the new flag:")
parser.print_help()
Testing CLI with conversion support:
Parsed args:
  fix: True
  convert_docstrings: True
  dry_run: True

CLI help text for the new flag:
usage: ipykernel_launcher.py [-h] [--nbs-path NBS_PATH] [--format {text,json}]
                             [--output OUTPUT] [--verbose] [--quiet]
                             [--todos-only] [--fix] [--convert-docstrings]
                             [--dry-run]

Check nbdev project for docments compliance

options:
  -h, --help            show this help message and exit
  --nbs-path NBS_PATH   Path to notebooks directory (defaults to nbdev config)
  --format {text,json}  Output format (default: text)
  --output OUTPUT, -o OUTPUT
                        Save report to file instead of printing
  --verbose, -v         Show compliant definitions in text report
  --quiet, -q           Only show summary (exit code indicates compliance)
  --todos-only          Show only functions with TODO placeholders
  --fix                 Auto-fix non-compliant functions by adding placeholder
                        docs
  --convert-docstrings  Convert existing Google/NumPy/Sphinx docstrings to
                        docments format (use with --fix)
  --dry-run             Show what would be fixed without making changes

Examples:
  # Check current project
  nbdev-docments

  # Check specific notebooks directory
  nbdev-docments --nbs-path ./notebooks

  # Generate JSON report
  nbdev-docments --format json

  # Save report to file
  nbdev-docments --output report.txt

  # Show all definitions (including compliant ones)
  nbdev-docments --verbose

  # Show only functions with TODO placeholders
  nbdev-docments --todos-only

  # Auto-fix non-compliant functions
  nbdev-docments --fix

  # Auto-fix with docstring conversion
  nbdev-docments --fix --convert-docstrings

  # Preview fixes without applying
  nbdev-docments --fix --dry-run