codeanalyzer-python 0.1.12__py3-none-any.whl → 0.1.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codeanalyzer/__main__.py +75 -15
- {codeanalyzer_python-0.1.12.dist-info → codeanalyzer_python-0.1.13.dist-info}/METADATA +1 -1
- {codeanalyzer_python-0.1.12.dist-info → codeanalyzer_python-0.1.13.dist-info}/RECORD +7 -7
- {codeanalyzer_python-0.1.12.dist-info → codeanalyzer_python-0.1.13.dist-info}/WHEEL +0 -0
- {codeanalyzer_python-0.1.12.dist-info → codeanalyzer_python-0.1.13.dist-info}/entry_points.txt +0 -0
- {codeanalyzer_python-0.1.12.dist-info → codeanalyzer_python-0.1.13.dist-info}/licenses/LICENSE +0 -0
- {codeanalyzer_python-0.1.12.dist-info → codeanalyzer_python-0.1.13.dist-info}/licenses/NOTICE +0 -0
codeanalyzer/__main__.py
CHANGED
|
@@ -9,19 +9,74 @@ from codeanalyzer.config import OutputFormat
|
|
|
9
9
|
from codeanalyzer.schema import model_dump_json
|
|
10
10
|
from codeanalyzer.options import AnalysisOptions
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
def main(
|
|
13
|
-
input: Annotated[
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
input: Annotated[
|
|
15
|
+
Path, typer.Option("-i", "--input", help="Path to the project root directory.")
|
|
16
|
+
],
|
|
17
|
+
output: Annotated[
|
|
18
|
+
Optional[Path],
|
|
19
|
+
typer.Option("-o", "--output", help="Output directory for artifacts."),
|
|
20
|
+
] = None,
|
|
21
|
+
format: Annotated[
|
|
22
|
+
OutputFormat,
|
|
23
|
+
typer.Option(
|
|
24
|
+
"-f",
|
|
25
|
+
"--format",
|
|
26
|
+
help="Output format: json or msgpack.",
|
|
27
|
+
case_sensitive=False,
|
|
28
|
+
),
|
|
29
|
+
] = OutputFormat.JSON,
|
|
30
|
+
analysis_level: Annotated[
|
|
31
|
+
int,
|
|
32
|
+
typer.Option("-a", "--analysis-level", help="1: symbol table, 2: call graph."),
|
|
33
|
+
] = 1,
|
|
34
|
+
using_codeql: Annotated[
|
|
35
|
+
bool, typer.Option("--codeql/--no-codeql", help="Enable CodeQL-based analysis.")
|
|
36
|
+
] = False,
|
|
37
|
+
using_ray: Annotated[
|
|
38
|
+
bool,
|
|
39
|
+
typer.Option("--ray/--no-ray", help="Enable Ray for distributed analysis."),
|
|
40
|
+
] = False,
|
|
41
|
+
rebuild_analysis: Annotated[
|
|
42
|
+
bool,
|
|
43
|
+
typer.Option(
|
|
44
|
+
"--eager/--lazy",
|
|
45
|
+
help="Enable eager or lazy analysis. Defaults to lazy.",
|
|
46
|
+
),
|
|
47
|
+
] = False,
|
|
48
|
+
skip_tests: Annotated[
|
|
49
|
+
bool,
|
|
50
|
+
typer.Option(
|
|
51
|
+
"--skip-tests/--include-tests",
|
|
52
|
+
help="Skip test files in analysis.",
|
|
53
|
+
),
|
|
54
|
+
] = True,
|
|
55
|
+
file_name: Annotated[
|
|
56
|
+
Optional[Path],
|
|
57
|
+
typer.Option(
|
|
58
|
+
"--file-name",
|
|
59
|
+
help="Analyze only the specified file (relative to input directory).",
|
|
60
|
+
),
|
|
61
|
+
] = None,
|
|
62
|
+
cache_dir: Annotated[
|
|
63
|
+
Optional[Path],
|
|
64
|
+
typer.Option(
|
|
65
|
+
"-c",
|
|
66
|
+
"--cache-dir",
|
|
67
|
+
help="Directory to store analysis cache. Defaults to '.codeanalyzer' in the input directory.",
|
|
68
|
+
),
|
|
69
|
+
] = None,
|
|
70
|
+
clear_cache: Annotated[
|
|
71
|
+
bool,
|
|
72
|
+
typer.Option(
|
|
73
|
+
"--clear-cache/--keep-cache",
|
|
74
|
+
help="Clear cache after analysis. By default, cache is retained.",
|
|
75
|
+
),
|
|
76
|
+
] = False,
|
|
77
|
+
verbosity: Annotated[
|
|
78
|
+
int, typer.Option("-v", count=True, help="Increase verbosity: -v, -vv, -vvv")
|
|
79
|
+
] = 0,
|
|
25
80
|
):
|
|
26
81
|
options = AnalysisOptions(
|
|
27
82
|
input=input,
|
|
@@ -46,13 +101,17 @@ def main(
|
|
|
46
101
|
if options.file_name is not None:
|
|
47
102
|
full_file_path = options.input / options.file_name
|
|
48
103
|
if not full_file_path.exists():
|
|
49
|
-
logger.error(
|
|
104
|
+
logger.error(
|
|
105
|
+
f"Specified file '{options.file_name}' does not exist in '{options.input}'."
|
|
106
|
+
)
|
|
50
107
|
raise typer.Exit(code=1)
|
|
51
108
|
if not full_file_path.is_file():
|
|
52
109
|
logger.error(f"Specified path '{options.file_name}' is not a file.")
|
|
53
110
|
raise typer.Exit(code=1)
|
|
54
|
-
if not str(options.file_name).endswith(
|
|
55
|
-
logger.error(
|
|
111
|
+
if not str(options.file_name).endswith(".py"):
|
|
112
|
+
logger.error(
|
|
113
|
+
f"Specified file '{options.file_name}' is not a Python file (.py)."
|
|
114
|
+
)
|
|
56
115
|
raise typer.Exit(code=1)
|
|
57
116
|
|
|
58
117
|
with Codeanalyzer(options) as analyzer:
|
|
@@ -85,6 +144,7 @@ def _write_output(artifacts, output_dir: Path, format: OutputFormat):
|
|
|
85
144
|
f"Compression ratio: {artifacts.get_compression_ratio():.1%} of JSON size"
|
|
86
145
|
)
|
|
87
146
|
|
|
147
|
+
|
|
88
148
|
app = typer.Typer(
|
|
89
149
|
callback=main,
|
|
90
150
|
name="codeanalyzer",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
codeanalyzer/__init__.py,sha256=BZ3Kuwl-F_F-8H8cepLnVJ4Ku4NNUjjqg0Y6ujPQSsI,108
|
|
2
|
-
codeanalyzer/__main__.py,sha256=
|
|
2
|
+
codeanalyzer/__main__.py,sha256=ddmdCJzPZTPqPNmun-Q0euxNxKwOzXKciS02TfeJRrY,5210
|
|
3
3
|
codeanalyzer/core.py,sha256=P43skGiKUnQtkSQGHpPDgZrftAKP2HHh52g1N1Ww1S0,24503
|
|
4
4
|
codeanalyzer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
codeanalyzer/config/__init__.py,sha256=9XBxAn1oWGRuhg3bEBUuVGs3hFNXEAKrr-Ce7tq9a2k,61
|
|
@@ -23,9 +23,9 @@ codeanalyzer/syntactic_analysis/symbol_table_builder.py,sha256=0FE_ZdlyP77P1B70Q
|
|
|
23
23
|
codeanalyzer/utils/__init__.py,sha256=hC6VWdR5rerSqBxzu9KQHTASWqwrrYJv-CMDwrTlzkc,137
|
|
24
24
|
codeanalyzer/utils/logging.py,sha256=0vTkGSl5EZN8yhhWa_5Mrn1n_twRCSW53rNwjzQ9RbI,601
|
|
25
25
|
codeanalyzer/utils/progress_bar.py,sha256=ZHJzGiCo5q4dyXq4CtsrJeq9Ip7sD84T3yZjNX7TBys,2443
|
|
26
|
-
codeanalyzer_python-0.1.
|
|
27
|
-
codeanalyzer_python-0.1.
|
|
28
|
-
codeanalyzer_python-0.1.
|
|
29
|
-
codeanalyzer_python-0.1.
|
|
30
|
-
codeanalyzer_python-0.1.
|
|
31
|
-
codeanalyzer_python-0.1.
|
|
26
|
+
codeanalyzer_python-0.1.13.dist-info/METADATA,sha256=poiZ1ztgLjCTtMkNHixHe6iEGcRBWtytXMI_cSKjSzQ,16283
|
|
27
|
+
codeanalyzer_python-0.1.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
28
|
+
codeanalyzer_python-0.1.13.dist-info/entry_points.txt,sha256=eUrB7Jq5Oav6RblMX_RYfVLSw_h15NbzC3fNSnGsPuM,59
|
|
29
|
+
codeanalyzer_python-0.1.13.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
30
|
+
codeanalyzer_python-0.1.13.dist-info/licenses/NOTICE,sha256=YU0Z9NDWqKY-2jfFcbxeZ6fbnzz0oZeKmnUcO8a-bcQ,901
|
|
31
|
+
codeanalyzer_python-0.1.13.dist-info/RECORD,,
|
|
File without changes
|
{codeanalyzer_python-0.1.12.dist-info → codeanalyzer_python-0.1.13.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{codeanalyzer_python-0.1.12.dist-info → codeanalyzer_python-0.1.13.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{codeanalyzer_python-0.1.12.dist-info → codeanalyzer_python-0.1.13.dist-info}/licenses/NOTICE
RENAMED
|
File without changes
|