Repository navigation
Adopt reflect-cpp XML/JSON SSOT for Platform, Suppressions, and .cppcheck Project schemas - #3
Open
clockblocker wants to merge 3 commits into
Open
clockblocker wants to merge 3 commits into
clockblocker wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deep Single Source of Truth (SSOT) adoption of
reflect-cpp(rfl::xml,rfl::json, andrfl::json::to_schema) across three XML/JSON configuration domains in Cppcheck, unifying duplicated CLI (tinyxml2) and GUI (QXmlStreamReader/QXmlStreamWriter) schemas into a single header-only definition inlib/schemas.h.Summary of Changes (3 commits)
8958cc8): Replacedtinyxml2parsing inlib/platform.{h,cpp}andtest/testplatform.cppwithcppcheck::schemas::PlatformSchema. AddedloadFromXml,loadFromJson,toXml,toJson,jsonSchema, and.jsonplatform file loading inPlatform::loadFromFile. EnabledREFLECTCPP_XMLand markedpugixml::pugixmlinclude directories asSYSTEMfor AppleClang-Weverything.36dded6): Removedtinyxml2(xml.h) fromlib/suppressions.cpp. MigratedSuppressionList::parseXmlFileto pugixml +rfl::xml::read<SuppressEntrySchema>(node)(PR Fixed preprocessor testcases cppcheck-opensource/cppcheck#66 DOM node interop) while preserving exact legacy error messages, migratedSuppressionList::dumptorfl::xml::write<"suppressions">(schema, doc), and addedparseJson,toXml,toJson, andjsonSchema..cppcheckProject File schema (7a8f1ef): ReplacedImportProject::importCppcheckGuiProject's ~200-linetinyxml2loop andgui/projectfile.{h,cpp}'s ~725 lines of duplicatedQXmlStreamReader/QXmlStreamWritercode with sharedcppcheck::schemas::ProjectFileSchema(all 36 child elements +versionattribute). Added.cppcheck.jsonsupport in both CLI (ImportProject::import) and GUI (ProjectFile::read/write), plusImportProject::projectFileJsonSchema().Key Metrics
git diff --shortstat fork/main..HEAD:14 files changed, 1493 insertions(+), 1293 deletions(-)gui/projectfile.cpp:1211 -> 580LoC (-631),gui/projectfile.h:689 -> 595LoC (-94)lib/importproject.cpp:5977 -> 5960LoC (-17)lib/platform.cpp:527 -> 562LoC (+35, adds XML/JSON write, JSON read, JSON Schema)lib/suppressions.cpp:1002 -> 1086LoC (+84, adds XML/JSON write, JSON read, JSON Schema)lib/schemas.h:0 -> 445LoC (single shared SSOT across all 3 domains, isolated to.cppincludes with lazy function templates to avoid cross-domain template instantiation)Verification
testrunnerandcppcheckcleanly with Ninja + AppleClang-Weverything(0 warnings)TestImportProject: 52/52 passed (0 failed, 1 todo)TestPlatform: 21/21 passed (0 failed, 2 todos)TestSuppressions: 74/74 passed (0 failed)TestCmdlineParser: 363/363 passed (0 failed, 2 todos)--platform=avr8 --xml-version=3 --suppress=fooand empty/no-root.cppcheckerror strings end-to-endRemaining
reflect-cppGaps Observedrfl::xml::readignores the root element tag name, requiring manual root tag verification (<platform>,<project>).rfl::NoExtraFieldsis not supported cleanly byrfl::xml::Reader, requiring manual allowlist checks for strict unknown-element diagnostics (<suppress>,<project>,<safe-checks>).std::optional<rfl::Attribute<T>>is not recognized as an XML attribute (is_attribute_vonly unwrapsrfl::Rename), requiring invertedrfl::Attribute<std::optional<T>>."xml_content", which leaks into JSON serialization and JSON Schema output.<check-headers/>,<max-ctu-depth/>,<analyze-all-vs-configs/>) cannot customize empty-element defaults per type inrfl::xml::Reader, requiring DOM pre-normalization beforerfl::xml::read.rfl::xml::write(e.g. omitting XML declaration or custom line indentation prefix), requiring manualpugi::xml_document::save(..., pugi::format_no_declaration)+ line prefixing forSuppressionList::dump.inlinefunctions in a multi-domain schema header cause heavy redundant template instantiation for large structs (37-fieldProjectFileSchema) across every including TU; lazy function templates were required to isolate compile time.