Uploaded image for project: 'Qt Quality Assurance Infrastructure'
  1. Qt Quality Assurance Infrastructure
  2. QTQAINFRA-4707

The bot that posts static analysis comments on Teams is broken

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • None
    • unversioned
    • Static analysis
    • None

    Description

      Example invocation of the bot-script sendDiffEmail.py that fails:

      sendDiffEmail.py qtbase-dev qtbase-dev-20211124-f5f7f78766 qtbase-dev-20211125-8a883dea1c /home/cc-runs/codechecker_daily_diffs/qtbase-dev-20211125-8a883dea1c/codechecker_diff.json
      
      Traceback (most recent call last):
       File "/usr/local/src/static_analysis_scripts/runAnalyseScripts/sendDiffEmail.py", line 161, in <module>
       email_payloads = generate_emails(run_diff_content)
       File "/usr/local/src/static_analysis_scripts/runAnalyseScripts/sendDiffEmail.py", line 53, in generate_emails
       new_bugs = new_bugs.sort_values(by='severity', ascending=False)
       File "/usr/lib/python3/dist-packages/pandas/core/frame.py", line 5008, in sort_values
       k = self._get_label_or_level_values(by, axis=axis)
       File "/usr/lib/python3/dist-packages/pandas/core/generic.py", line 1774, in _get_label_or_level_values
       raise KeyError(key)
      
       KeyError: 'severity'
      

       

      The reason is that CodeChecker in Version 6.18.0 silently changed the schema of the JSON output. They documented it later (after I opened an issue) as such:

      https://codechecker.readthedocs.io/en/latest/analyzer/user_guide/#json-format-of-codechecker-parse

      For reference here is a pair of new and old JSON files:

      NEW

      {
        "version": 1,
        "reports": 
        [
          {
            "analyzer_result_file_path": null,
            "file": {
              "id": "src/gui/text/qstatictext.cpp",
              "path": "src/gui/text/qstatictext.cpp",
              "original_path": "src/gui/text/qstatictext.cpp"
            },
            "line": 626,
            "column": 35,
            "message": "result of integer division used in a floating point context; possible loss of precision",
            "checker_name": "bugprone-integer-division",
            "severity": "MEDIUM",
            "report_hash": "739c8d620903d12675c54b835e4f0e29",
            "analyzer_name": "clang-tidy",
            "category": null,
            "type": null,
            "source_code_comments": [],
            "review_status": "unreviewed",
            "bug_path_events": [
              {
                "file": {
                  "id": "src/gui/text/qstatictext.cpp",
                  "path": "src/gui/text/qstatictext.cpp",
                  "original_path": "src/gui/text/qstatictext.cpp"
                },
                "line": 626,
                "column": 35,
                "message": "result of integer division used in a floating point context; possible loss of precision",
                "range": null
              }
            ],
            "bug_path_positions": [],
            "notes": [],
            "macro_expansions": []
          },
      

      OLD

       [
        {
          "runId": 273,
          "checkerId": "cppcoreguidelines-special-member-functions",
          "bugHash": "0dd7e6279a73523c1bcb74eb443b350e",
          "checkedFile": "src/corelib/io/qiodevicebase.h",
          "checkerMsg": "class 'QIODeviceBase' defines a default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator",
          "reportId": 597978,
          "fileId": 8629,
          "line": 47,
          "column": 7,
          "severity": 20,
          "reviewData": {
            "status": 0,
            "comment": null,
            "author": null,
            "date": null
          },
          "detectionStatus": 0,
          "detectedAt": "2021-11-19 02:29:21.370453",
          "fixedAt": null,
          "bugPathLength": 1,
          "details": null,
          "analyzerName": "clang-tidy"
        },
      

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jimis Dimitrios Apostolou
            jimis Dimitrios Apostolou
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes