Analyze codebase for size, complexity, and quality metrics Find all files matching include patterns Exclude directories from exclude list Build file list for analysis For each file, count total, code, blank, comment lines Aggregate totals by file type Parse functions/methods in each file Calculate cyclomatic complexity per function Identify deeply nested code blocks Detect duplicate code blocks Find long functions (> 50 lines) Find large files (> 500 lines) Count TODO/FIXME comments Format metrics according to output parameter Include recommendations for concerning metrics ``` Code Metrics Report =================== Project: {project_name} Path: {path} Date: {date} Size Metrics: - Total Files: {total_files} - Lines of Code: {lines_of_code} - Blank Lines: {blank_lines} - Comment Lines: {comment_lines} - Comment Ratio: {comment_ratio}% Complexity Metrics: - Avg Cyclomatic Complexity: {avg_complexity} - Max Complexity: {max_complexity} ({max_complexity_file}) - Deep Nesting Issues: {deep_nesting_count} Quality Metrics: - Duplicate Code Blocks: {duplicate_count} - Long Functions (>50 lines): {long_functions_count} - Large Files (>500 lines): {large_files_count} - TODO/FIXME Count: {todo_count} Structure: - Avg File Size: {avg_file_size} lines - Avg Function Size: {avg_function_size} lines Breakdown by Language: {for each language} - {language}: {file_count} files, {line_count} lines {end for} Recommendations: {recommendations} ```