Congratulations to our 2022 Qt Champions!

Command line tool for QML/JS Run checks

  • 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.

  • Moderators

    Hi @Prabha, You are probably looking for qmllint.

  • 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

  • Moderators

    @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 :)

  • Thanks @p3c0, By looking into the QtCreator source,

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

    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.

  • Moderators

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

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

  • Moderators

    @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.

Log in to reply