added json for line info

This commit is contained in:
ALEXks
2025-04-23 14:25:01 +03:00
parent 06980ee344
commit b88eccaad4
2 changed files with 23 additions and 9 deletions

View File

@@ -1,3 +1,3 @@
#pragma once
#define VERSION_SPF "2410"
#define VERSION_SPF "2411"

View File

@@ -1464,18 +1464,32 @@ int SPF_GetFileLineInfo(void*& context, int winHandler, short *options, short *p
{
runPassesForVisualizer(projName, { FILE_LINE_INFO });
string resVal = "";
for (auto it = lineInfo.begin(); it != lineInfo.end(); ++it)
json metric_array = json::array();
for (const auto& fileInfo : lineInfo)
{
if (it != lineInfo.begin())
resVal += "@";
json fileMetric;
auto itD = dirsInfo.find(it->first);
if (itD == dirsInfo.end())
resVal += it->first + "@" + to_string(it->second) + "_0_0";
else
resVal += it->first + "@" + to_string(it->second) + "_" + to_string(itD->second.first.size()) + "_" + to_string(itD->second.second.size());
fileMetric["file"] = fileInfo.first;
fileMetric["linesCount"] = fileInfo.second;
auto it = dirsInfo.find(fileInfo.first);
if (it == dirsInfo.end())
{
fileMetric["numSPF"] = 0;
fileMetric["numDVM"] = 0;
}
else
{
fileMetric["numSPF"] = (int)it->second.first.size();
fileMetric["numDVM"] = (int)it->second.second.size();
}
metric_array.push_back(fileMetric);
}
json allMetrics;
allMetrics["allMetrics"] = metric_array;
string resVal = allMetrics.dump();
copyStringToShort(result, resVal);
retSize = (int)resVal.size() + 1;