Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change all sample files to complexity instead of mcc #3456
Browse files Browse the repository at this point in the history
Nereboss committed Jun 5, 2024
1 parent dbe679a commit d75e397
Showing 5 changed files with 27 additions and 20 deletions.
10 changes: 5 additions & 5 deletions visualization/app/codeCharta/assets/sample1.cc.json
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
"attributes": {
"rloc": 400,
"functions": 10,
"mcc": 100,
"complexity": 100,
"pairingRate": 32,
"avgCommits": 17
},
@@ -26,7 +26,7 @@
"attributes": {
"rloc": 100,
"functions": 10,
"mcc": 1,
"complexity": 1,
"pairingRate": 77,
"avgCommits": 56
},
@@ -43,7 +43,7 @@
"attributes": {
"rloc": 30,
"functions": 100,
"mcc": 100,
"complexity": 100,
"pairingRate": 60,
"avgCommits": 51
}
@@ -54,7 +54,7 @@
"attributes": {
"rloc": 70,
"functions": 1000,
"mcc": 10,
"complexity": 10,
"pairingRate": 65,
"avgCommits": 22
}
@@ -91,7 +91,7 @@
}
],
"attributeTypes": {
"nodes": { "rloc": "absolute", "functions": "absolute", "mcc": "absolute", "pairingRate": "relative" },
"nodes": { "rloc": "absolute", "functions": "absolute", "complexity": "absolute", "pairingRate": "relative" },
"edges": { "pairingRate": "relative", "avgCommits": "absolute" }
}
}
10 changes: 5 additions & 5 deletions visualization/app/codeCharta/assets/sample2.cc.json
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
{
"name": "bigLeaf.ts",
"type": "File",
"attributes": { "rloc": 120, "functions": 10, "mcc": 1 },
"attributes": { "rloc": 120, "functions": 10, "complexity": 1 },
"link": "http://www.google.de"
},
{
@@ -22,17 +22,17 @@
{
"name": "smallLeaf.html",
"type": "File",
"attributes": { "rloc": 30, "functions": 101, "mcc": 80 }
"attributes": { "rloc": 30, "functions": 101, "complexity": 80 }
},
{
"name": "otherSmallLeaf.ts",
"type": "File",
"attributes": { "rloc": 70, "functions": 10, "mcc": 100 }
"attributes": { "rloc": 70, "functions": 10, "complexity": 100 }
},
{
"name": "sample2LeafMergedIn.kt",
"type": "File",
"attributes": { "rloc": 600, "functions": 10, "mcc": 1 },
"attributes": { "rloc": 600, "functions": 10, "complexity": 1 },
"link": "http://www.google.de"
}
]
@@ -41,6 +41,6 @@
}
],
"attributeTypes": {
"nodes": { "rloc": "absolute", "functions": "absolute", "mcc": "absolute" }
"nodes": { "rloc": "absolute", "functions": "absolute", "complexity": "absolute" }
}
}
8 changes: 4 additions & 4 deletions visualization/app/codeCharta/assets/sample3.cc.json
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
{
"name": "bigLeaf.ts",
"type": "File",
"attributes": { "rloc": 120, "functions": 10, "mcc": 1 },
"attributes": { "rloc": 120, "functions": 10, "complexity": 1 },
"link": "http://www.google.de"
},
{
@@ -22,19 +22,19 @@
{
"name": "smallLeaf.html",
"type": "File",
"attributes": { "rloc": 30, "functions": 19, "mcc": 80 }
"attributes": { "rloc": 30, "functions": 19, "complexity": 80 }
},
{
"name": "otherSmallLeaf.ts",
"type": "File",
"attributes": { "rloc": 80, "functions": 10, "mcc": 100 }
"attributes": { "rloc": 80, "functions": 10, "complexity": 100 }
}
]
}
]
}
],
"attributeTypes": {
"nodes": { "rloc": "absolute", "functions": "absolute", "mcc": "absolute" }
"nodes": { "rloc": "absolute", "functions": "absolute", "complexity": "absolute" }
}
}
10 changes: 5 additions & 5 deletions visualization/app/codeCharta/assets/sample4.cc.json
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
{
"name": "aLeaf.ts",
"type": "File",
"attributes": { "rloc": 120, "functions": 10, "mcc": 1 },
"attributes": { "rloc": 120, "functions": 10, "complexity": 1 },
"link": "http://www.google.de"
},
{
@@ -22,24 +22,24 @@
{
"name": "smallLeafOne.html",
"type": "File",
"attributes": { "rloc": 100, "functions": 28, "mcc": 80 }
"attributes": { "rloc": 100, "functions": 28, "complexity": 80 }
},
{
"name": "smallLeafTwo.ts",
"type": "File",
"attributes": { "rloc": 300, "functions": 5, "mcc": 150 }
"attributes": { "rloc": 300, "functions": 5, "complexity": 150 }
},
{
"name": "smallLeafThree.ts",
"type": "File",
"attributes": { "rloc": 50, "functions": 5, "mcc": 150 }
"attributes": { "rloc": 50, "functions": 5, "complexity": 150 }
}
]
}
]
}
],
"attributeTypes": {
"nodes": { "rloc": "absolute", "functions": "absolute", "mcc": "absolute" }
"nodes": { "rloc": "absolute", "functions": "absolute", "complexity": "absolute" }
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { NodeMetricData, RecursivePartial, Settings } from "../../../../codeCharta.model"

const sizeMetrics = ["rloc", "real_lines_of_code", "loc", "lines_of_code", "lines", "statements", "functions"]
const complexityMetrics = ["mcc", "cognitive_complexity", "sonar_cognitive_complexity", "max_nesting_level", "indentation_level"]
const complexityMetrics = [
"complexity",
"mcc",
"cognitive_complexity",
"sonar_cognitive_complexity",
"max_nesting_level",
"indentation_level"
]

export function isAnyMetricAvailable<T extends Pick<NodeMetricData, "maxValue">[]>(metricData: T) {
return metricData.some(x => x.maxValue > 0)

0 comments on commit d75e397

Please sign in to comment.