Report Generator

Generate compliance reports for docments validation

check_project


def check_project(
    nbs_path:Optional=None, # Path to notebooks directory
)->List: # List of check results for all definitions

Check all exported definitions in a project for docments compliance


generate_text_report


def generate_text_report(
    results:List, # Check results from check_project
    verbose:bool=False, # Include detailed information
)->str: # Formatted text report

Generate a human-readable text report of compliance results


generate_json_report


def generate_json_report(
    results:List, # Check results from check_project
)->Dict: # JSON-serializable report data

Generate a JSON report of compliance results

# Test the report generator
results = check_project()
print(generate_text_report(results, verbose=True))
📚 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)

✅ Compliant definitions:
------------------------------

📓 00_core.ipynb:
  ✅ DocmentsCheckResult
  ✅ __post_init__
  ✅ extract_param_docs_from_func
  ✅ extract_param_docs
  ✅ check_return_doc
  ✅ count_todos_in_docs
  ✅ check_has_docstring_from_func
  ✅ check_has_docstring
  ✅ check_type_hints
  ✅ check_params_documentation
  ✅ determine_compliance
  ✅ check_definition
  ✅ check_notebook
  ✅ check_function

📓 01_scanner.ipynb:
  ✅ get_export_cells
  ✅ extract_definitions
  ✅ scan_notebook
  ✅ scan_project

📓 02_report.ipynb:
  ✅ check_project
  ✅ _generate_summary_stats
  ✅ _generate_non_compliant_section
  ✅ _generate_todos_section
  ✅ _generate_compliant_section
  ✅ generate_text_report
  ✅ generate_json_report

📓 03_autofix.ipynb:
  ✅ find_signature_boundaries
  ✅ split_parameters
  ✅ parse_single_line_signature
  ✅ generate_param_todo_comment
  ✅ generate_return_todo_comment
  ✅ build_fixed_single_line_function
  ✅ fix_multi_line_signature
  ✅ fix_class_definition
  ✅ insert_function_docstring
  ✅ fix_single_line_function
  ✅ fix_multi_line_function
  ✅ generate_fixed_source
  ✅ fix_notebook
  ✅ DocstringInfo
  ✅ detect_docstring_style
  ✅ parse_google_docstring
  ✅ parse_numpy_docstring
  ✅ parse_sphinx_docstring
  ✅ extract_docstring_info
  ✅ convert_to_docments_format
  ✅ convert_single_line_to_docments
  ✅ convert_multiline_to_docments
  ✅ replace_docstring_in_body
  ✅ generate_fixed_source_with_conversion
  ✅ fix_notebook_with_conversion

📓 04_cli.ipynb:
  ✅ handle_autofix
  ✅ generate_report
  ✅ main
# Test JSON report
json_report = generate_json_report(results)
print(json.dumps(json_report, indent=2))
{
  "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": []
    }
  }
}
# Test TODO tracking with a function that has placeholder docs
from cjm_nbdev_docments.core import check_definition

test_with_todos = '''def example_func(
    x: int,  # TODO: Add description
    y: str  # TODO: Add description  
) -> bool:  # TODO: Add return description
    "TODO: Add function description"
    return True'''

test_def = {
    'name': 'example_func',
    'type': 'FunctionDef', 
    'source': test_with_todos,
    'notebook': 'test.ipynb',
    'args': [
        {'name': 'x', 'annotation': 'int'},
        {'name': 'y', 'annotation': 'str'}
    ],
    'returns': 'bool'
}

result = check_definition(test_def)
print(f"Function: {result.name}")
print(f"Compliant: {result.is_compliant}")
print(f"Has TODOs: {result.has_todos}")
print(f"TODO count: {result.todo_count}")

# Test current project report
print("\n" + "="*50)
print("Current project with TODO tracking:")
results = check_project()
print(generate_text_report(results))
Function: example_func
Compliant: True
Has TODOs: True
TODO count: 4

==================================================
Current project with TODO tracking:
📚 Docments Compliance Report
==================================================
Total definitions: 59
✅ Compliant: 58
❌ Non-compliant: 1

❌ Non-compliant definitions:
------------------------------

📓 cli.ipynb:
  ❌ output_report
     - Missing docs for: return