mcpp 1.3.3__tar.gz → 1.3.4__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.3.3/src/mcpp.egg-info → mcpp-1.3.4}/PKG-INFO +1 -1
- {mcpp-1.3.3 → mcpp-1.3.4}/pyproject.toml +2 -2
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp/memory.py +12 -6
- {mcpp-1.3.3 → mcpp-1.3.4/src/mcpp.egg-info}/PKG-INFO +1 -1
- {mcpp-1.3.3 → mcpp-1.3.4}/LICENSE +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/README.md +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/requirements.txt +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/setup.cfg +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp/__init__.py +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp/__main__.py +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp/additional.py +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp/assets/__init__.py +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp/assets/config.yaml +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp/complexity.py +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp/config.py +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp/parse.py +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp/queries.py +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp/smell.py +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp/tree.py +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp/vulnerability.py +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp.egg-info/SOURCES.txt +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp.egg-info/dependency_links.txt +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp.egg-info/entry_points.txt +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp.egg-info/requires.txt +0 -0
- {mcpp-1.3.3 → mcpp-1.3.4}/src/mcpp.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mcpp"
|
|
3
|
-
version = "1.3.
|
|
3
|
+
version = "1.3.4"
|
|
4
4
|
description = "McCabe++ (mcpp): cyclomatic complexity and other vulnerability-related code metrics"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [{name = "Lukas Pirch", email="lukas.pirch@tu-berlin.de"}]
|
|
@@ -30,4 +30,4 @@ build-backend = "setuptools.build_meta"
|
|
|
30
30
|
|
|
31
31
|
[tool.black]
|
|
32
32
|
target-version = ["py311"]
|
|
33
|
-
line-length = 120
|
|
33
|
+
line-length = 120
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import tree_sitter
|
|
2
|
+
|
|
3
|
+
from mcpp.queries import Q_CALL_NAME, Q_NEW_EXPRESSION, Q_SUBSCRIPT_EXPR, Q_FIELD_EXPR, Q_POINTER_EXPR
|
|
4
|
+
|
|
2
5
|
|
|
3
6
|
def m1(root, sitter, lang, calls=None):
|
|
4
7
|
""" # memory allocations
|
|
@@ -18,20 +21,23 @@ def m1(root, sitter, lang, calls=None):
|
|
|
18
21
|
num_allocations += 1
|
|
19
22
|
|
|
20
23
|
# Number of new object instantiations
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
try:
|
|
25
|
+
num_new_expressions = len(sitter.captures("Q_NEW_EXPRESSION", root, lang).get("expr", []))
|
|
26
|
+
except tree_sitter.QueryError:
|
|
27
|
+
num_new_expressions = 0
|
|
28
|
+
|
|
23
29
|
return {
|
|
24
30
|
"m1": num_allocations + num_new_expressions,
|
|
25
31
|
}
|
|
26
32
|
|
|
33
|
+
|
|
27
34
|
def m2(root, sitter, lang, calls=None):
|
|
28
35
|
""" # ptr dereferences
|
|
29
36
|
"""
|
|
30
37
|
sitter.add_queries({
|
|
31
|
-
"Q_CALL_NAME": Q_CALL_NAME,
|
|
32
|
-
"Q_NEW_EXPRESSION": Q_NEW_EXPRESSION,
|
|
33
38
|
"Q_SUBSCRIPT_EXPR": Q_SUBSCRIPT_EXPR,
|
|
34
39
|
"Q_FIELD_EXPR": Q_FIELD_EXPR,
|
|
40
|
+
"Q_POINTER_EXPR": Q_POINTER_EXPR,
|
|
35
41
|
})
|
|
36
42
|
|
|
37
43
|
num_ptr_expressions = 0
|
|
@@ -46,7 +52,7 @@ def m2(root, sitter, lang, calls=None):
|
|
|
46
52
|
|
|
47
53
|
# Number of pointer dereferences using the field expression syntax (ptr->field)
|
|
48
54
|
num_field_expressions = len(sitter.captures("Q_FIELD_EXPR", root, lang).get("expr", []))
|
|
49
|
-
|
|
55
|
+
|
|
50
56
|
return {
|
|
51
57
|
"m2": num_ptr_expressions + num_subscript_expressions + num_field_expressions,
|
|
52
58
|
}
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|