()
return lines, any_errors
Validates extra third party licenses.

    An integration may use code from an outside source or origin that is not pypi-
    it will have a file in its check directory titled `3rdparty-extra-LICENSE.csv`
Validates extra third party licenses.
Validates extra third party licenses .
def validate_extra_licenses():
    """
    Validates extra third party licenses.

    An integration may use code from an outside source or origin that is not pypi-
    it will have a file in its check directory titled `3rdparty-extra-LICENSE.csv`
    """
    lines = []
    any_errors = False

    all_extra_licenses = get_extra_license_files()

    for license_file in all_extra_licenses:
        errors = False
        rows = read_license_file_rows(license_file)
        for line_no, row, line in rows:
            # determine if number of columns is complete by checking for None values (DictReader populates missing columns with None https://docs.python.org/3.8/library/csv.html#csv.DictReader) # noqa
            if None in row.values():
                errors = True
                any_errors = True
                echo_failure(f"{license_file}:{line_no} Has the wrong amount of columns")
                annotate_error(license_file, "Contains the wrong amount of columns", line=line_no)
                continue

            # all headers exist, no invalid headers
            all_keys = set(row)
            ALL_HEADERS = set(HEADERS)
            if all_keys != ALL_HEADERS:
                invalid_headers = all_keys.difference(ALL_HEADERS)
                if invalid_headers:
                    echo_failure(f'{license_file}:{line_no} Invalid column {invalid_headers}')
                    annotate_error(license_file, f"Detected invalid column {invalid_headers}", line=line_no)

                missing_headers = ALL_HEADERS.difference(all_keys)
                if missing_headers:
                    echo_failure(f'{license_file}:{line_no} Missing columns {missing_headers}')
                    annotate_error(license_file, f"Detected missing columns {invalid_headers}", line=line_no)

                errors = True
                any_errors = True
                continue
            license_type = row['License']
            if license_type not in VALID_LICENSES:
                errors = True
                any_errors = True
                echo_failure(f'{license_file}:{line_no} Invalid license type {license_type}')
                annotate_error(license_file, f"Detected invalid license type {license_type}", line=line_no)
                continue
            if not errors:
                lines.append(line)

    return lines, any_errors
def validate_extra_licenses ( ) : lines = [ ] any_errors = False all_extra_licenses = get_extra_license_files ( ) for license_file in all_extra_licenses : errors = False rows = read_license_file_rows ( license_file ) for line_no , row , line in rows : # determine if number of columns is complete by checking for None values (DictReader populates missing columns with None https://docs.python.org/3.8/library/csv.html#csv.DictReader) # noqa if None in row . values ( ) : errors = True any_errors = True echo_failure ( f"{license_file}:{line_no} Has the wrong amount of columns" ) annotate_error ( license_file , "Contains the wrong amount of columns" , line = line_no ) continue # all headers exist, no invalid headers all_keys = set ( row ) ALL_HEADERS = set ( HEADERS ) if all_keys != ALL_HEADERS : invalid_headers = all_keys . difference ( ALL_HEADERS ) if invalid_headers : echo_failure ( f'{license_file}:{line_no} Invalid column {invalid_headers}' ) annotate_error ( license_file , f"Detected invalid column {invalid_headers}" , line = line_no ) missing_headers = ALL_HEADERS . difference ( all_keys ) if missing_headers : echo_failure ( f'{license_file}:{line_no} Missing columns {missing_headers}' ) annotate_error ( license_file , f"Detected missing columns {invalid_headers}" , line = line_no ) errors = True any_errors = True continue license_type = row [ 'License' ] if license_type not in VALID_LICENSES : errors = True any_errors = True echo_failure ( f'{license_file}:{line_no} Invalid license type {license_type}' ) annotate_error ( license_file , f"Detected invalid license type {license_type}" , line = line_no ) continue if not errors : lines . append ( line ) return lines , any_errors