def check_fic_sha(filename, row, i, log): """Checks of Flakiness-Introducing Commit SHA.""" if not common_data["SHA"].fullmatch( row["Flakiness-Introducing Commit SHA"]): log_std_error(filename, log, i, row, "Flakiness-Introducing Commit SHA")
def check_tic_mp(filename, row, i, log): """Checks validity of Test-Introducing Commit Module Path.""" if not common_data["Module Path"].fullmatch( row["Test-Introducing Commit Module Path"]): log_std_error(filename, log, i, row, "Test-Introducing Commit Module Path")
def check_pr_link(filename, row, i, log): """Checks validity of the PR Link.""" if not pr_data["PR Link"].fullmatch(row["PR Link"]) or (re.sub( r"\/pull\/\d+", "", row["PR Link"]).casefold() != row["Project URL"].casefold()): log_std_error(filename, log, i, row, "PR Link")
def check_num_failures(filename, row, i, log): """Checks validity of Number Of Test Failures In Test Suite.""" if not tso_iso_rates["Failures/Runs"].fullmatch( row["Number Of Test Failures In Test Suite"] ): log_std_error( filename, log, i, row, "Number Of Test Failures In Test Suite" )
def check_less_greater(filename, row, i, log): """Checks validity of Is P-Value Less Or Greater Than 0.05.""" if not tso_iso_rates["Less/Greater"].fullmatch( row["Is P-Value Less Or Greater Than 0.05"] ): log_std_error( filename, log, i, row, "Is P-Value Less Or Greater Than 0.05" )
def check_tic_fqn(filename, row, i, log): """Checks validity of Test-Introducing Commit Fully-Qualified Test Name.""" if not common_data["Fully-Qualified Name"].fullmatch( row["Test-Introducing Commit Fully-Qualified Test Name"]): log_std_error( filename, log, i, row, "Test-Introducing Commit Fully-Qualified Test Name", )
def check_status_consistency(filename, row, i, log): """Check that the status is consistent with the requirements.""" # Checks if Status is one of Accepted, Opened, Rejected # and checks for required information if so if row["Status"] in ["Accepted", "Opened", "Rejected"]: # The project apache/incubator-dubbo was renamed to apache/dubbo, # so the Project URL name (old) doesn't match the PR Link name # (new), despite them being the same project. This if statement is # a workaround for that issue. if (row["Project URL"] == "https://github.com/apache/incubator-dubbo" and re.sub(r"\/pull\/\d+", "", row["PR Link"]).casefold() == "https://github.com/apache/dubbo"): pass else: check_pr_link(filename, row, i, log) if row["Status"] in ["InspiredAFix", "Skipped", "MovedOrRenamed"]: # Should contain a note if row["Notes"] == "": log_warning( filename, log, i, "Status " + row["Status"] + " should contain a note", ) # If it contains a note, it should be a valid link else: check_notes(filename, row, i, log) # Should contain a PR Link if row["Status"] == "InspiredAFix": if row["PR Link"] == "": log_warning( filename, log, i, "Status " + row["Status"] + " should have a PR Link", ) # If it contains a PR link, it should be a valid one else: check_pr_link(filename, row, i, log) if row["Status"] == "" and row["PR Link"] != "": check_pr_link(filename, row, i, log) log_std_error( filename, log, i, row, "Status should not be empty when a PR link is provided.")
def check_mods(filename, row, i, log): """ Checks validity of Flaky Test File Modified, Other Test Files Modified, Code Under Test Files Modified and Build Related Files Modified. """ keys = [ "Flaky Test File Modified", "Other Test Files Modified", "Code Under Test Files Modified", "Build Related Files Modified", ] for key in keys: if not tic_fic_data["Modified"].fullmatch(row[key]): log_std_error(filename, log, i, row, key)
def check_totals(filename, row, i, log): """ Checks validity of Total Runs In Test Suite, Number of Times Test Passed In Test Suite, Total Runs In Isolation and Number of Times Test Passed In Isolation. """ keys = [ "Total Runs In Test Suite", "Number of Times Test Passed In Test Suite", "Total Runs In Isolation", "Number of Times Test Passed In Isolation", ] for key in keys: if not tso_iso_rates["Last 4"].fullmatch(row[key]): log_std_error(filename, log, i, row, key)
def check_common_rules(filename, row, i, log): """ Checks validity of Project URL, SHA Detected, Module Path, Fully-Qualified Test Name (packageName.ClassName.methodName). """ if not common_data["Project URL"].fullmatch(row["Project URL"]): log_std_error(filename, log, i, row, "Project URL") if not common_data["SHA"].fullmatch(row["SHA Detected"]): log_std_error(filename, log, i, row, "SHA Detected") if not common_data["Module Path"].fullmatch(row["Module Path"]): log_std_error(filename, log, i, row, "Module Path") if not common_data["Fully-Qualified Name"].fullmatch( row["Fully-Qualified Test Name (packageName.ClassName.methodName)"] ) or '#' in row[ "Fully-Qualified Test Name (packageName.ClassName.methodName)"]: log_std_error( filename, log, i, row, "Fully-Qualified Test Name (packageName.ClassName.methodName)", )
def check_category(filename, row, i, log): """Check validity of Category.""" if not re.fullmatch(r"(\w+|-|\;)*\w+", row["Category"]) or not all( x in pr_data["Category"] for x in row["Category"].split(";")): log_std_error(filename, log, i, row, "Category")
def check_status(filename, row, i, log): """Check validity of Status.""" if not row["Status"] in pr_data["Status"]: log_std_error(filename, log, i, row, "Status")
def check_tic_eq_fic(filename, row, i, log): """Checks validity of TIC = FIC.""" if not tic_fic_data["TIC = FIC"].fullmatch(row["TIC = FIC"]): log_std_error(filename, log, i, row, "TIC = FIC")
def check_notes(filename, row, i, log): """Checks validity of Notes.""" if not pr_data["Notes"].fullmatch(row["Notes"]): log_std_error(filename, log, i, row, "Notes")
def check_days_between(filename, row, i, log): """Checks validity of Days Between TIC-FIC.""" if not tic_fic_data["Days Between TIC-FIC"].fullmatch( row["Days Between TIC-FIC"]): log_std_error(filename, log, i, row, "Days Between TIC-FIC")
def check_pvalue(filename, row, i, log): """Checks validity of P-Value.""" if not tso_iso_rates["P-Value"].fullmatch(row["P-Value"]): log_std_error(filename, log, i, row, "P-Value")
def check_tic_sha(filename, row, i, log): """Checks validity of Test-Introducing Commit SHA.""" if not common_data["SHA"].fullmatch(row["Test-Introducing Commit SHA"]): log_std_error(filename, log, i, row, "Test-Introducing Commit SHA")