def check_file(src, rules, disabled):
    """Applies a set of rules on a file."""
    logger = logging.getLogger('retf')
    logger.info("Checking file %s for typographical errors.", src)
    content = load_text_from_file(src)
    findings = 0

    for rule in rules:
        if rule.get('description') in disabled:
            continue

        logger.debug("%s: checking rule '%s'.", src,
                     rule.get('description'))
        logger.debug(rule.get('find'))
        newcontent, count = rule.get('regex').subn(
            rule.get('replace'), content
        )

        if 0 > count:
            logger.warning("%d match(s) in file %s : %s.", count, src,
                           rule.get('description'))
            findings += count
        content = newcontent

    return (findings, content)
dataset/ETHPy150Open openstack/openstack-doc-tools/cleanup/retf/retf.py/check_file/swapped operands of `>`