def run_line_checks()

in scancode/scanCode.py [0:0]


def run_line_checks(file_path, checks):
    """Check each line in a file against given list of filters."""
    if not os.path.isfile(file_path):
        if VERBOSE:
            print_error(MSG_SKIPPING_FILE % file_path)
        return []

    errors = []
    line_number = 0
    # For each line in the file, run all "line checks"

    # open file in text mode; skip any binary files
    try:
        with open(file_path, 'r') as fp:
            for line in fp:
                line_number += 1
                for check in checks:
                    if line_number == 1:
                        vprint(col.cyan(MSG_RUNNING_LINE_CHECKS %
                                        check.__name__))
                    err = check(line)
                    if err is not None:
                        errors.append((line_number, err))
    except UnicodeDecodeError:
        if VERBOSE:
            print_error(MSG_SKIPPING_BINARY_FILE % file_path)
    return errors