mcpp 1.0.0__tar.gz → 1.1.1__tar.gz
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.
- {mcpp-1.0.0/src/mcpp.egg-info → mcpp-1.1.1}/PKG-INFO +1 -1
- {mcpp-1.0.0 → mcpp-1.1.1}/pyproject.toml +1 -1
- {mcpp-1.0.0 → mcpp-1.1.1}/src/mcpp/__init__.py +1 -1
- {mcpp-1.0.0 → mcpp-1.1.1}/src/mcpp/__main__.py +13 -0
- {mcpp-1.0.0 → mcpp-1.1.1}/src/mcpp/parse.py +0 -1
- {mcpp-1.0.0 → mcpp-1.1.1/src/mcpp.egg-info}/PKG-INFO +1 -1
- {mcpp-1.0.0 → mcpp-1.1.1}/LICENSE +0 -0
- {mcpp-1.0.0 → mcpp-1.1.1}/README.md +0 -0
- {mcpp-1.0.0 → mcpp-1.1.1}/requirements.txt +0 -0
- {mcpp-1.0.0 → mcpp-1.1.1}/setup.cfg +0 -0
- {mcpp-1.0.0 → mcpp-1.1.1}/src/mcpp/assets/__init__.py +0 -0
- {mcpp-1.0.0 → mcpp-1.1.1}/src/mcpp/assets/config.yaml +0 -0
- {mcpp-1.0.0 → mcpp-1.1.1}/src/mcpp/complexity.py +0 -0
- {mcpp-1.0.0 → mcpp-1.1.1}/src/mcpp/config.py +0 -0
- {mcpp-1.0.0 → mcpp-1.1.1}/src/mcpp/queries.py +0 -0
- {mcpp-1.0.0 → mcpp-1.1.1}/src/mcpp/vulnerability.py +0 -0
- {mcpp-1.0.0 → mcpp-1.1.1}/src/mcpp.egg-info/SOURCES.txt +0 -0
- {mcpp-1.0.0 → mcpp-1.1.1}/src/mcpp.egg-info/dependency_links.txt +0 -0
- {mcpp-1.0.0 → mcpp-1.1.1}/src/mcpp.egg-info/entry_points.txt +0 -0
- {mcpp-1.0.0 → mcpp-1.1.1}/src/mcpp.egg-info/requires.txt +0 -0
- {mcpp-1.0.0 → mcpp-1.1.1}/src/mcpp.egg-info/top_level.txt +0 -0
|
@@ -71,5 +71,18 @@ def extract_single(in_file: Path, metrics: List[str]):
|
|
|
71
71
|
return extract([in_file], metrics)
|
|
72
72
|
|
|
73
73
|
|
|
74
|
+
def extract_code(code: str, metrics: List[str] = list(METRICS.keys())):
|
|
75
|
+
metrics = [fun for name, fun in METRICS.items() if name in metrics]
|
|
76
|
+
sitter = Sitter("c", "cpp")
|
|
77
|
+
|
|
78
|
+
tree, lang = sitter.parse(code)
|
|
79
|
+
root = tree.root_node
|
|
80
|
+
calls = set(get_call_names(sitter, root, lang))
|
|
81
|
+
res = {}
|
|
82
|
+
for fun in metrics:
|
|
83
|
+
res.update(fun(root, sitter, lang, calls))
|
|
84
|
+
return res
|
|
85
|
+
|
|
86
|
+
|
|
74
87
|
if __name__ == '__main__':
|
|
75
88
|
main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|