From 178381c30a34d6aa88eacd3ecf642fbfad74bfa4 Mon Sep 17 00:00:00 2001 From: firewave Date: Thu, 24 Oct 2024 04:19:18 +0200 Subject: [PATCH] CppCheck: actually generate analyzer information for markup files --- lib/cppcheck.cpp | 6 +++++- test/cli/qml_test.py | 3 --- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 11b2a325928b..348cbbc4cdca 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -689,8 +689,12 @@ unsigned int CppCheck::checkFile(const FileWithDetails& file, const std::string } mUnusedFunctionsCheck->parseTokens(tokenizer, mSettings); - // TODO: open file so we can set the fileinfo + // TODO: how to get the proper tokenlist to generate the proper hash? + const std::size_t hash = time(nullptr); // calculateHash(tokenizer.list, mSettings); + std::list errors; + mAnalyzerInformation.analyzeFile(mSettings.buildDir, file.spath(), cfgname, hash, errors); mAnalyzerInformation.setFileInfo("CheckUnusedFunctions", mUnusedFunctionsCheck->analyzerInfo()); + mAnalyzerInformation.close(); } return EXIT_SUCCESS; } diff --git a/test/cli/qml_test.py b/test/cli/qml_test.py index 7e09d5360e26..9b64f1d01a49 100644 --- a/test/cli/qml_test.py +++ b/test/cli/qml_test.py @@ -2,7 +2,6 @@ # python3 -m pytest test-qml.py import os -import pytest from testutils import cppcheck __script_dir = os.path.dirname(os.path.abspath(__file__)) @@ -53,8 +52,6 @@ def test_unused_functions_j(): assert ret == 0, stdout -# TODO: fillSampleData is not unused -@pytest.mark.xfail(strict=True) def test_unused_functions_builddir(tmpdir): build_dir = os.path.join(tmpdir, 'b1') os.mkdir(build_dir)