import os
import re

def find_comment_blocks(directory):
    for root, _, files in os.walk(directory):
        for file in files:
            if not file.endswith('.py'): continue
            path = os.path.join(root, file)
            with open(path, 'r', encoding='utf-8') as f:
                lines = f.readlines()
            
            in_comment = False
            comment_start = 0
            comment_count = 0
            
            for i, line in enumerate(lines):
                if line.strip().startswith('#'):
                    if not in_comment:
                        in_comment = True
                        comment_start = i + 1
                    comment_count += 1
                else:
                    if in_comment and comment_count > 5:
                        print(f"{path}: lines {comment_start}-{comment_start+comment_count-1} ({comment_count} lines)")
                    in_comment = False
                    comment_count = 0
            
            if in_comment and comment_count > 5:
                print(f"{path}: lines {comment_start}-{comment_start+comment_count-1} ({comment_count} lines)")

find_comment_blocks('backend')
