Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(script): Verify checker labelling invariants (e.g., guideline:XX:rule, profile:defaultprofile:sensitiveprofile:extreme) with the label-tool #4275

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
30 changes: 30 additions & 0 deletions scripts/labels/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,33 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# -------------------------------------------------------------------------
"""
This library ships reusable components and user-facing tools to verify,
generate, and adapt the checker labels in the CodeChecker configuration
structure.
"""
# Load the interpreter injection first.
from . import codechecker

from . import \
checker_labels, \
exception, \
fixit, \
http_, \
output, \
projects, \
transformer, \
util


__all__ = [
"checker_labels",
"codechecker",
"exception",
"fixit",
"http_",
"output",
"projects",
"transformer",
"util",
]
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@


try:
from .doc_url.generate_tool import __main__ as doc_url_generate
from .doc_url.verify_tool import __main__ as doc_url_verify
from .invariant_check.tool import __main__ as invariant_check
from .severity.generate_tool import __main__ as severity_generate
except ModuleNotFoundError as e:
import traceback
traceback.print_exc()
Expand All @@ -37,22 +40,28 @@ def args() -> argparse.ArgumentParser:
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
subparsers = parser.add_subparsers(
title="subcommands",
description="Please select a subcommand to continue.",
description="""
'label-tool' is a collection of semi-individual sub-tools.
Please select one to continue.
""",
dest="subcommand",
required=True)

def add_subparser(command: str, package):
def add_subparser(package):
subparser = subparsers.add_parser(
command,
list(globals().keys())[list(globals().values()).index(package)],
prog=package.__package__,
help=package.short_help,
description=package.description,
epilog=package.epilogue,
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
subparser = package.args(subparser)
subparser = package.arg_parser(subparser)
subparser.set_defaults(__main=package.main)

add_subparser("doc_url_verify", doc_url_verify)
add_subparser(doc_url_generate)
add_subparser(doc_url_verify)
add_subparser(invariant_check)
add_subparser(severity_generate)

return parser

Expand Down
Loading
Loading