Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    Unsolved Command line tool for QML/JS Run checks

    QML and Qt Quick
    2
    8
    1952
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Prabha last edited by

      Hi,

      Is there any way i can run QML/JS Run checks from command line. Currently Qt Creator have option in Tools. If we can run from command line, this is will help us to integrate QML/JS check in the CI system.

      p3c0 1 Reply Last reply Reply Quote 0
      • p3c0
        p3c0 Moderators @Prabha last edited by

        Hi @Prabha, You are probably looking for qmllint.

        157

        1 Reply Last reply Reply Quote 0
        • P
          Prabha last edited by

          Hi @p3c0, thanks for the qmllint reference. It looks like it does check syntax errors, and it is helpful.
          However Qt Creator supported, QML/JS Run check does check for errors similar to JSlint also. Looks like it is more elaborate. If we can run this from command line it will be great, to integrate into CI system

          p3c0 1 Reply Last reply Reply Quote 0
          • p3c0
            p3c0 Moderators @Prabha last edited by

            @Prabha On that site they also mention to use other tools like Json_verify and xmllint. You can make use of all these inside a script.
            It could be that similar code is integrated in the QtCreator. You can always check its sources :)

            157

            1 Reply Last reply Reply Quote 0
            • P
              Prabha last edited by

              Thanks @p3c0, By looking into the QtCreator source,

              Code for the QML/JS run checks is in ,
              qmljscheck.cpp
              I can see how to invoke the corresponding function in
              tst_check.cpp

              ViewerContext vContext;
              vContext.flags = ViewerContext::Complete;
              ContextPtr context = Link(snapshot, vContext, LibraryInfo())();
              Check checker(doc, context);
              QList<Message> messages = checker();
              std::sort(messages.begin(), messages.end(), &offsetComparator);
              

              Hopefully by following qmllint and the above files i should be able to create a command line executable, that gives all the results that QML/JS Run checks gives.
              Do you see any problems with this approach.

              p3c0 1 Reply Last reply Reply Quote 0
              • p3c0
                p3c0 Moderators @Prabha last edited by

                @Prabha Using that code will require you to include the dependent files. You must check with their licenses.

                157

                1 Reply Last reply Reply Quote 0
                • P
                  Prabha last edited by

                  Thanks @p3c0, it has Commercial and LGPL license. I hope if the work is open sourced back, there shouldn't be any problem.

                  p3c0 1 Reply Last reply Reply Quote 0
                  • p3c0
                    p3c0 Moderators @Prabha last edited by

                    @Prabha Yes I guess. But again I'm not a lawyer so I don't have complete understanding of how these work. You can try asking it in a separate post. Some one with knowledge may answer.

                    157

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post