Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions lib/addoninfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,28 @@ static std::string parseAddonInfo(AddonInfo& addoninfo, const picojson::value &j
}
}

{
const auto it = obj.find("checkers");
if (it != obj.cend()) {
const auto& val = it->second;
if (!val.is<picojson::array>())
return "Loading " + fileName + " failed. 'checkers' must be an array.";
for (const picojson::value &v : val.get<picojson::array>()) {
if (!v.is<picojson::object>())
return "Loading " + fileName + " failed. 'checkers' entry is not an object.";

const picojson::object& checkerObj = v.get<picojson::object>();
if (checkerObj.size() == 1) {
const std::string c = checkerObj.begin()->first;
if (!checkerObj.begin()->second.is<std::string>())
return "Loading " + fileName + " failed. 'checkers' entry requirement is not a string.";
const std::string req = checkerObj.begin()->second.get<std::string>();
addoninfo.checkers.emplace(c, req);
}
}
}
}

{
const auto it = obj.find("executable");
if (it != obj.cend()) {
Expand Down
2 changes: 2 additions & 0 deletions lib/addoninfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "config.h"

#include <string>
#include <map>

struct CPPCHECKLIB AddonInfo {
std::string name;
Expand All @@ -31,6 +32,7 @@ struct CPPCHECKLIB AddonInfo {
std::string python; // script interpreter
bool ctu = false;
std::string runScript;
std::map<std::string, std::string> checkers; // checker name and its requirement

std::string getAddonInfo(const std::string &fileName, const std::string &exename, bool debug = false);
};
Expand Down
Loading
Loading