diff --git a/bin/codebasin b/bin/codebasin index 14f41b1..bf33661 100755 --- a/bin/codebasin +++ b/bin/codebasin @@ -93,14 +93,6 @@ def main(): + "May be specified multiple times. " + "If not specified, all reports will be generated.", ) - deprecated_args.add_argument( - "-d", - "--dump", - dest="dump", - metavar="", - action="store", - help="Dump out annotated platform/parsing tree to .", - ) parser.add_argument( "-x", "--exclude", @@ -140,13 +132,6 @@ def main(): max(1, logging.WARNING - 10 * (args.verbose - args.quiet)), ) - # Warnings for deprecated functionality with no planned replacement. - if args.dump: - warnings.warn( - "--dump will be removed in a future release.", - DeprecationWarning, - ) - # If no specific report was specified, generate all reports. # Handled here to prevent "all" always being in the list. if len(args.reports) == 0: @@ -249,15 +234,6 @@ def main(): platform_mapper = PlatformMapper(codebase) setmap = platform_mapper.walk(state) - if args.dump: - if util.ensure_json(args.dump): - report.annotated_dump(args.dump, state) - else: - logging.getLogger("codebasin").warning( - "Output path for annotation dump does not end with .json: " - f"'{args.dump}'. Skipping dump.", - ) - def report_enabled(name): if "all" in args.reports: return True diff --git a/codebasin/preprocessor.py b/codebasin/preprocessor.py index 85ad9e5..1b1d342 100644 --- a/codebasin/preprocessor.py +++ b/codebasin/preprocessor.py @@ -551,12 +551,6 @@ def add_child(self, child): self.children.append(child) child.parent = self - def to_json(self, assoc): - return { - "platforms": list(assoc[self]), - "children": [x.to_json(assoc) for x in self.children], - } - @staticmethod def is_start_node(): """ @@ -614,17 +608,6 @@ def __compute_file_hash(self): return hasher.hexdigest() - def to_json(self, assoc): - parent_json = super().to_json(assoc) - mydict = { - "type": "file", - "file": self.filename, - "name": os.path.basename(self.filename), - "sloc": self.total_sloc, - } - parent_json.update(mydict) - return parent_json - def __repr__(self): return _representation_string(self, attrs=["filename"]) @@ -653,23 +636,6 @@ def __init__(self, start_line=-1, end_line=-1, num_lines=0, source=None): self.num_lines = num_lines self.source = source - def to_json(self, assoc): - parent_json = super().to_json(assoc) - if self.source: - source = "\n".join(self.source) - else: - source = None - - mydict = { - "type": "code", - "start_line": self.start_line, - "end_line": self.end_line, - "sloc": self.num_lines, - "source": source, - } - parent_json.update(mydict) - return parent_json - def __repr__(self): return _representation_string( self, @@ -707,12 +673,6 @@ class DirectiveNode(CodeNode): def __init__(self): super().__init__() - def to_json(self, assoc): - parent_json = super().to_json(assoc) - mydict = {"type": "directive", "source": "\n".join(self.spelling())} - parent_json.update(mydict) - return parent_json - class UnrecognizedDirectiveNode(DirectiveNode): """ diff --git a/codebasin/report.py b/codebasin/report.py index 1090036..0244fe1 100644 --- a/codebasin/report.py +++ b/codebasin/report.py @@ -5,7 +5,6 @@ """ import itertools as it -import json import logging import warnings @@ -14,17 +13,6 @@ log = logging.getLogger("codebasin") -def annotated_dump(output_file, state): - outlist = [] - for fname in state.get_filenames(): - source_tree = state.get_tree(fname) - node_associations = state.get_map(fname) - outlist.append(source_tree.root.to_json(node_associations)) - - with open(output_file, "w") as fp: - fp.write(json.dumps(outlist, indent=2)) - - def extract_platforms(setmap): """ Extract a list of unique platforms from a set map