Beispiel #1
0
def main():
    """The entry point to kodi-addon-checker
    """
    load_plugins()
    parser = argparse.ArgumentParser(
        prog="kodi-addon-checker",
        description="Checks Kodi repo for best practices and creates \
                                     problem and warning reports.\r\nIf optional add-on \
                                     directories are provided, check only those add-ons. \
                                     Otherwise, scan current repository and check all add-ons in \
                                     the current directory.")
    parser.add_argument("--version",
                        action="version",
                        version="%(prog)s 0.0.1")
    parser.add_argument("add_on",
                        metavar="add-on",
                        type=dir_type,
                        nargs="*",
                        help="optional add-on directories")
    ConfigManager.fill_cmd_args(parser)
    args = parser.parse_args()

    repo_path = os.path.abspath(os.getcwd())
    config = Config(repo_path, args)
    ConfigManager.process_config(config)
    check_repo(config, repo_path, args.add_on)
Beispiel #2
0
 def setUp(self):
     self.path = "script.test/"
     self.whitelist = ["INFO: Checking add-on script.test", "INFO: Created by mzfr", "INFO: This is a new addon"
                       "INFO: Image icon exists", "Icon dimensions are fine", "INFO: Image fanart exists",
                       "WARN: Complex entry point", "WARN: We found", "please check the logfile"]
     load_plugins()
     self.config = Config(self.path)
     ReportManager.enable(["array"])
     self.all_repo_addons = get_all_repo_addons()
     self.args = Args()
Beispiel #3
0
def main():
    """The entry point to kodi-addon-checker
    """
    load_plugins()
    parser = argparse.ArgumentParser(prog="kodi-addon-checker",
                                     description="Checks Kodi repo for best practices and creates \
                                     problem and warning reports.\r\nIf optional add-on \
                                     directories are provided, check only those add-ons. \
                                     Otherwise, scan current repository and check all add-ons in \
                                     the current directory.")
    parser.add_argument("--version", action="version",
                        version="%(prog)s {version}".format(version=__version__))
    parser.add_argument("dir", type=dir_type, nargs="*", help="optional add-on or repo directories")
    parser.add_argument("--branch", choices=ValidKodiVersions, required=True,
                        help="Target branch name where the checker will resolve dependencies")
    parser.add_argument("--PR", help="Tell if tool is to run on a pull requests or not", action='store_true')
    parser.add_argument("--allow-folder-id-mismatch", help="Allow the addon's folder name and id to mismatch",
                        action="store_true")
    ConfigManager.fill_cmd_args(parser)
    args = parser.parse_args()

    log_file_name = os.path.join(os.getcwd(), "kodi-addon-checker.log")
    Logger.create_logger(log_file_name, __package__)

    all_repo_addons = check_addon.get_all_repo_addons()

    if args.dir:
        # Following report is a wrapper for all sub reports
        report = Report("")
        for directory in args.dir:
            report.add(check_artifact(directory, args, all_repo_addons))
    else:
        report = check_artifact(os.getcwd(), args, all_repo_addons)

    if report.problem_count > 0:
        report.add(Record(PROBLEM, "We found %s problems and %s warnings, please check the logfile." %
                          (report.problem_count, report.warning_count)))
        sys.exit(1)
    elif report.warning_count > 0:
        report.add(Record(WARNING, "We found no problems and %s warnings, please check the logfile." %
                          report.warning_count))
    else:
        report.add(Record(INFORMATION, "We found no problems and no warnings, please enjoy your day."))
 def setUp(self):
     self.path = join(HERE, "test_data", "PO_files")
     load_plugins()
     ReportManager.enable(["array"])
     self.report = Report("")
     self.report_matches = ("ERROR: Invalid PO file")
Beispiel #5
0
 def setUp(self):
     load_plugins()
     ReportManager.enable(["array"])
     self.report = Report("")