MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / validateSources

Function validateSources

app/src/API/Handlers/ProjectHandler.cpp:5678–5701  ·  view source on GitHub ↗

* @brief Validates per-source frame parsers (compiles each, flags failures). */

Source from the content-addressed store, hash-verified

5676 * @brief Validates per-source frame parsers (compiles each, flags failures).
5677 */
5678static void validateSources(const std::vector<DataModel::Source>& sources,
5679 QJsonArray& issues,
5680 bool& ok)
5681{
5682 auto& parser = DataModel::FrameParser::instance();
5683 for (const auto& src : sources) {
5684 if (src.frameParserCode.isEmpty()) {
5685 addIssue(issues,
5686 QStringLiteral("info"),
5687 QStringLiteral("source[%1]").arg(src.sourceId),
5688 QStringLiteral("Source has no frame parser; raw frames will be dropped"));
5689 continue;
5690 }
5691
5692 const bool compiled = parser.loadScript(src.sourceId, src.frameParserCode, false);
5693 if (!compiled) {
5694 ok = false;
5695 addIssue(issues,
5696 QStringLiteral("error"),
5697 QStringLiteral("source[%1].frameParser").arg(src.sourceId),
5698 QStringLiteral("Frame parser failed to compile or define parse()"));
5699 }
5700 }
5701}
5702
5703/**
5704 * @brief Validates a single dataset's references and per-field invariants.

Callers 1

validateMethod · 0.85

Calls 3

addIssueFunction · 0.85
isEmptyMethod · 0.80
loadScriptMethod · 0.45

Tested by

no test coverage detected