MCPcopy Create free account
hub / github.com/SourceCode-AI/aura / scan

Function scan

aura/cli.py:72–131  ·  view source on GitHub ↗
(
    uri,
    verbose=None,
    analyzer=None,
    out_type=("text",),
    min_score=None,
    benchmark=False,
    benchmark_sort="cumtime",
    filter_tags=None,
    fork_mode=False,
    download_only=False,
)

Source from the content-addressed store, hash-verified

70@click.option("--no-async", "fork_mode", flag_value=False)
71@click.option("--download-only", "download_only", flag_value=True)
72def scan(
73 uri,
74 verbose=None,
75 analyzer=None,
76 out_type=("text",),
77 min_score=None,
78 benchmark=False,
79 benchmark_sort="cumtime",
80 filter_tags=None,
81 fork_mode=False,
82 download_only=False,
83):
84 output_opts = {
85 "tags": filter_tags
86 }
87 if min_score is not None:
88 output_opts["min_score"] = min_score
89
90 if verbose is not None:
91 output_opts["verbosity"] = verbose + 1
92
93 if not out_type:
94 out_type = ("text",)
95
96 meta = {
97 "format": out_type,
98 "analyzers": analyzer,
99 "source": "cli",
100 "fork": fork_mode,
101 "output_opts": output_opts
102 }
103 if benchmark:
104 import cProfile, pstats, io
105
106 pr = cProfile.Profile()
107 pr.enable()
108 meta["fork"] = False
109 else:
110 cProfile, pstats, pr, io = None, None, None, None
111
112 try:
113 commands.scan_uri(uri, metadata=meta, download_only=download_only)
114 except exceptions.FeatureDisabled as e:
115 LOGGER.exception(e.args[0], exc_info=e)
116 click.secho(e.args[0], err=True, fg="red")
117 return sys.exit(2)
118 except exceptions.AuraException as e:
119 click.secho(e.args[0], err=True, fg='red')
120 return sys.exit(1)
121
122 if pr:
123 pr.disable()
124 s = io.StringIO()
125 ps = pstats.Stats(pr, stream=s).sort_stats(benchmark_sort)
126 ps.print_stats(.1)
127 print(s.getvalue())
128
129

Callers

nothing calls this directly

Calls 1

purgeFunction · 0.85

Tested by

no test coverage detected