import os import subprocess def count_lines(): try: # Get list of tracked files result = subprocess.run(['git', 'ls-files'], capture_output=True, text=True, check=True) files = result.stdout.splitlines() except subprocess.CalledProcessError: print("Not a git repository or git error.") return stats = {} total_effective = 0 total_files = 0 comments = { '.py': '#', '.js': '//', '.jsx': '//', '.ts': '//', '.tsx': '//', '.css': '/*', # Simple check, not perfect for block comments across lines or inline '.html': '