Closed
Description
您好,我在linux上的一个简单的python程序上运行计算圈复杂度的代码的时候执行结果为空
【python代码】
a = 10
for i in range(10):
print("test")
【gdl文件】
// script
use coref::python::*
fn default_db() -> PythonDB {
return PythonDB::load("coref_python_src.db")
}
/**
- Get cyclomatic complexity of functions
- @param name function name
- @param value cyclomatic complexity of function
- @param path path of file including this function
- @param sline function start line
- @param eline function end line
*/
fn getCyclomaticComplexity(
name: string,
value: int,
path: string,
sline: int,
eline: int) -> bool {
// get metric function
for (c in MetricFunction(default_db())) {
if (path = c.getLocation().getFile().getRelativePath() &&
name = c.getQualifiedName() &&
value = c.getCyclomaticComplexity() &&
sline = c.getLocation().getStartLineNumber() &&
eline = c.getLocation().getEndLineNumber()) {
return true
}
}
}
fn main() {
output(getCyclomaticComplexity())
}
【运行指令】
./sparrow-cli/sparrow database create -s test_java -lang java -o ./db_java/
./sparrow-cli/sparrow query run -d ./db_java/ -gdl test2.gdl -o ./
Metadata
Metadata
Assignees
Labels
No labels