Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-141638

.qmlformat.ini "SemicolonRule=essential" is not respected

XMLWordPrintable

    • 282446da4 (dev), 617621657 (6.10)

      Code
      Based on QTBUG-11030:

      import QtQuick
      import QtQml
      
      Window {
          height: 400
          width: 600
          visible: true
          Component.onCompleted: {
              console.log("Assigning constants...")
              let [a, b] = [1, 2]
              console.log(a, b)
      
              console.log("Swapping variables...");;;
              [a, b] = [b, a]
              console.log(a, b)
          }
      }
      
      

       
      Steps to reproduce

      1. Save the code above into Main.qml
      2. In that folder, run qmlformat --write-defaults
      3. Run qmlformat Main.qml
      4. Edit .qmlformat.ini to change SortImports from "false" to "true" and repeat #3
      5. Edit .qmlformat.ini to change SemicolonRule from "always" to "essential" and repeat #3
      6. Run qmlformat --semicolon-rule=essential Main.qml

      Outcomes

      • (Step #3) The import order is not sorted, every line in Console.onCompleted has a single semicolon (Expected)
      • (Step #4) The import order is now sorted (Expected)
      • (Step #5) Same as Step #4 (Not Expected)
      • (Step #6) Only the "Swapping variables..." line has a semicolon (Expected)

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

            semih.yavuz Semih Yavuz
            skoh-qt Sze Howe Koh
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes