Пример #1
0
def add_report_cmd(subparsers):
    report_help = ("Produces a report of copyright header notices within "
                   "selected targets to help identify files that don't meet "
                   "expectations.")
    parser = subparsers.add_parser('report', help=report_help)
    parser.set_defaults(cmd=lambda o: ReportCmd(o))
    add_jobs_option(parser)
    add_json_option(parser)
    add_git_tracked_targets_parameter(parser)
Пример #2
0
def add_check_cmd(subparsers):
    check_help = ("Validates that selected targets do not have copyright "
                  "header issues, gives a per-file report and returns a "
                  "non-zero shell status if there are any issues discovered.")
    parser = subparsers.add_parser('check', help=check_help)
    parser.set_defaults(cmd=lambda o: CheckCmd(o))
    add_jobs_option(parser)
    add_json_option(parser)
    add_git_tracked_targets_parameter(parser)
Пример #3
0
def add_report_cmd(subparsers):
    report_help = ("Produces a report with the analysis of the code format "
                   "adherence of the selected targets taken as a group.")
    parser = subparsers.add_parser('report', help=report_help)
    parser.set_defaults(cmd=lambda o: ReportCmd(o))
    add_jobs_option(parser)
    add_json_option(parser)
    add_clang_options(parser, style_file=True)
    add_git_tracked_targets_parameter(parser)
def add_report_cmd(subparsers):
    report_help = ("Runs clang static analysis and produces a summary report "
                   "of the findings.")
    parser = subparsers.add_parser('report', help=report_help)
    parser.set_defaults(cmd=lambda o: ReportCmd(o))
    add_jobs_option(parser)
    add_json_option(parser)
    add_clang_options(parser, report_path=True)
    add_git_repository_parameter(parser)
Пример #5
0
def add_report_cmd(subparsers):
    report_help = ("Validates that the selected targets do not have basic "
                   "style issues, give a per-file report and returns a "
                   "non-zero shell status if there are any basic style issues "
                   "discovered.")
    parser = subparsers.add_parser('report', help=report_help)
    parser.set_defaults(cmd=lambda o: ReportCmd(o))
    add_jobs_option(parser)
    add_json_option(parser)
    add_git_tracked_targets_parameter(parser)
Пример #6
0
def add_check_cmd(subparsers):
    check_help = ("Validates that the selected targets match the style, gives "
                  "a per-file report and returns a non-zero shell status if "
                  "there are any format issues discovered.")
    parser = subparsers.add_parser('check', help=check_help)
    parser.set_defaults(cmd=lambda o: CheckCmd(o))
    add_jobs_option(parser)
    add_json_option(parser)
    add_clang_options(parser, style_file=True, force=True)
    add_git_tracked_targets_parameter(parser)
def add_check_cmd(subparsers):
    check_help = ("Runs clang static analysis and output details for each "
                  "discovered issue. Returns a non-zero shell status if any "
                  "issues are found.")
    parser = subparsers.add_parser('check', help=check_help)
    parser.set_defaults(cmd=lambda o: CheckCmd(o))
    add_jobs_option(parser)
    add_json_option(parser)
    add_clang_options(parser, report_path=True)
    add_git_repository_parameter(parser)
Пример #8
0
        repository_cmds = {
            'copyright_header': CopyrightHeaderCheck(settings),
            'basic_style': BasicStyleCheck(settings),
            'clang_format': ClangFormatCheck(settings),
            'clang_static_analysis': ClangStaticAnalysisCheck(settings),
        }
        self.json = settings.json
        super().__init__(settings, repository_cmds, silent=settings.json)

    def _output(self, results):
        if self.json:
            return super()._output(results)
        reports = [(self.repository_cmds[l].title + ":\n" +
                    self.repository_cmds[l]._output(r))
                   for l, r in sorted(results.items())]
        return '\n'.join(reports)


if __name__ == "__main__":
    description = ("Wrapper to invoke a collection of scripts that check on "
                   "the state of the repository.")
    parser = argparse.ArgumentParser(description=description)
    add_jobs_option(parser)
    add_json_option(parser)
    add_clang_options(parser, report_path=True, style_file=True, force=True)
    add_git_tracked_targets_parameter(parser)
    settings = parser.parse_args()
    finish_clang_settings(settings)
    checks = Checks(settings)
    checks.run()