ximum lines for a single diff suggestion
        min_extract_depth: Minimum depth before suggesting extraction
    """

    def __init__(self, max_diff_lines: int = 50, min_extract_depth: int = 3):
        self.max_diff_lines = max_diff_lines
        self.min_extract_depth = min_extract_depth

    def parse_file(self, filepath: str) -> ast.Module:
        """
        Parses a Python file into AST.
        
        Args:
            filepath: Path to the file
            
        Returns:
            Parsed AST of the file
            
        Raises:
            IOError: If file not found
            SyntaxError: If invalid syntax in file
        """
        try:
            with open(filepath, 'r') as f:
                source = f.read()
            return ast.parse(source)
        except IOError:
            logger.error(f"File '{filepath}' not found")
            raise
        except SyntaxError as e:
            logger.error(f"Syntax error in '{filepath}': {e}")
            raise

    def analyze_complexity(self, tree: ast.Module) -> List[Dict]:
        """
        Analyzes code complexity and identifies candidates for refactoring.
        
        Args:
            tree: AST of the file
            
        Returns:
            List of issues with positions and descriptions
        """
        issues = []
        
        class ComplexityVisitor(ast.NodeVisitor):
            def visit_FunctionDef(self, node: ast.FunctionDef) -> None:
                # Count depth of function definition
                if len(ast.get_docstring(node, clean=False)) == 0 and \
                   len(node.body) > self.min_extract_depth:
                    pos = node.lineno - 1
                    issues.append({
                        'line': pos,
                        'type': 'complex_function',
                        'message': f'Function "{node.name}" is too complex'
                    })
                self.generic_visit(node)

        visitor = ComplexityVisitor()
        visitor.visit(tree)
        return issues

    def suggest_refactorings(self, filepath: str) -> List[Dict]:
        """
        Suggests refactorings for a given file.
        
        Args:
            filepath: Path to the Python file
            
        Returns:
            List of refactoring suggestions with type and description
        """
        try:
            tree = self.parse_file(filepath)
            issues = self.analyze_complexity(tree)
            
            suggestions = []
            for issue in issues:
                if issue['type'] == 'complex_function':
                    func_name = self._get_func_name_by_line(filepath, issue['line'])
                    if func_name:
                        suggestions.append({
                            'line': issue['line'],
                            'type': 'extract_method',
                            'message': f'Extract method "{func_name}" into separate function'
                        })
            
            return suggestions
            
        except Exception as e: