"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PythonExtractor = void 0;
const PYTHON_PATTERNS = [
    {
        name: 'bare_except',
        category: 'error_handling',
        regex: /^\s*except\s*:/gm,
        description: 'Prefers specific exception over bare except:',
    },
    {
        name: 'wildcard_import',
        category: 'import_style',
        regex: /^\s*from\s+\w+\s+import\s+\*/gm,
        description: 'Prefers explicit imports over wildcard imports',
    },
    {
        name: 'print_debug',
        category: 'debug_style',
        regex: /\bprint\s*\(/g,
        description: 'Prefers logging over print() for debugging',
    },
    {
        name: 'type_hint_missing',
        category: 'type_annotation',
        regex: /^def\s+\w+\s*\((?!.*:\s*\w)/m,
        description: 'Missing type hints in function signature',
    },
    {
        name: 'old_string_format',
        category: 'string_style',
        regex: /%[sdrf]/g,
        description: 'Prefers f-strings over % formatting',
    },
    {
        name: 'range_len',
        category: 'loop_style',
        regex: /\brange\(len\(/g,
        description: 'Prefers enumerate() over range(len())',
    },
    {
        name: 'mutable_default',
        category: 'bug_prone',
        regex: /def\s+\w+\s*\([^)]*=\s*(\[\s*\]|\{\s*\}|set\(\s*\))/g,
        description: 'Avoid mutable default arguments',
    },
];
class PythonExtractor {
    extract(code) {
        const results = [];
        for (const p of PYTHON_PATTERNS) {
            const matches = code.match(p.regex);
            if (matches) {
                results.push({
                    category: p.category,
                    description: p.description,
                    from: p.name,
                    to: p.name.replace(/_/g, '_fixed'),
                    confidenceDelta: Math.min(0.15, matches.length * 0.05),
                    conditions: [],
                });
            }
        }
        return results;
    }
}
exports.PythonExtractor = PythonExtractor;
//# sourceMappingURL=python-extractor.js.map