Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-22432

Some json wizard are not valid json files

    XMLWordPrintable

Details

    • 3b596eef4029a58eff8189851e6200437ee42700 (qt-creator/qt-creator/master)

    Description

      using this very simple script:

      
      import json
      import sys
      
      for f in sys.argv[1:]:
          print(f"Loading \{f}")
              with open(f) as fp:
                  try:
                      json.load(fp)
                  except Exception as e:
                     print(str(e))
      

      and this command:

      find share/qtcreator/templates/wizards/ -name '*.json' | xargs python3 ../load-json.py
      

      I get 2 invalid json files:

      Loading share/qtcreator/templates/wizards/projects/vcs/git/wizard.json
      Invalid \escape: line 16 column 59 (char 574)
      Loading share/qtcreator/templates/wizards/files/java/wizard.json
      Invalid \escape: line 12 column 137 (char 466)
      

      the curlprint is

      "options": [ { "key": "ClassName", "value": "%{JS: value('FileName').charAt(0).toUpperCase() + value('FileName').substr(1).replace(/\.java$/,'')}" } ],
      

      and

      { "key": "SR", "value": "%{JS: '%{Repo}'.replace(/\.git$/, '') }"},
      

      The question is that is it as easy to fix as escaping the backslash? How to validate that the change won't break anything?

      Is it possible to add this sort of checks somewhere in the test subsystem?

      Attachments

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

        Activity

          People

            cstenger Christian Stenger
            christian_gagneraud_navico Christian Gagneraud
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes