aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlformat
Commit message (Collapse)AuthorAgeFilesLines
* qmlformat: Add argument to output available optionsXavier BESSON2025-10-301-0/+3
| | | | | | Task-number: QTCREATORBUG-33305 Change-Id: I9e23a755da0354ab1d64b7f50ff6f9cc7acbe85a Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* qmlformat: expand OutWriter's constructorSemih Yavuz2025-10-011-18/+1
| | | | | | | | | | | | | | | | code and comment location information is needed by OutWriter to scan format directives. Allow these to be created at OutWriters' construction. Get this informations through ExternalOwningItem interface. Unfortunately, ExternalOwningItem interface won't provide comment() or engine(). Use derived types to get that information for JSFile and QmlFile. Task-number: QTBUG-97796 Change-Id: I57ef2a3a52579dd5698219a6e6ac9449c113d080 Reviewed-by: Dmitrii Akshintsev <dmitrii.akshintsev@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* qmlformat: Disable WriteOutCheck at runtimeSemih Yavuz2025-10-011-6/+2
| | | | | | | | | | | - WriteOutCheck is now set to None for runtime usage, simplifying logic and avoiding complex DOM comparisons and exceptions. It is already disabled for several cases. - The check remains available for test purposes. Task-number: QTBUG-97796 Change-Id: I259511f84cf8a71f46fc3df698cb9a8a462dc559 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Add security header for src/qmlformatSemih Yavuz2025-09-171-0/+1
| | | | | | | | | | | There is no security critic code in qmlformat. Everything remains at the default "signicant" security level. QUIP: 23 Fixes: QTBUG-136198 Pick-to: 6.10 6.9 6.8 Change-Id: Iac1c84748bc98a9c921fc8ae895a2dcd53d01270 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmltoolings add --dry-run option for qmlformat and qmllintSemih Yavuz2025-08-141-0/+5
| | | | | | | | | | | | | Add reportConfigForFiles to generic tooling class. It will perform the search for the given files. Use stdout to report. qmllint had already an option --dry-run for printing the fixed codes, but we can still allow this to use that option name. For qmlls, report the path if verbose option is set. Fixes: QTBUG-137874 Change-Id: I6bd43866073b3df832b6fd89d477bced869d74c0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: move configuration functions into librarySemih Yavuz2025-01-291-143/+3
| | | | | | | | | | ...Then we can add tests for them. More tests to be added in the next commit. Pick-to: 6.8 6.9 Task-number: QTBUG-133225 Change-Id: I3f40ddc3d0895a785d6bce359c63ad6ad4d70606 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* qmlformat: remove non-existing data from buildCommandlineOptionsSemih Yavuz2025-01-291-6/+2
| | | | | | | | | | We no longer have Options{} data structure. Use QQmlFormatOptions instead. Pick-to: 6.8 6.9 Task-number: QTBUG-133225 Change-Id: I0a3625a4e41948c4fd010a52d71b8c5fb352ba82 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* qmlformat: simplify getSettingsSemih Yavuz2025-01-291-12/+4
| | | | | | | Pick-to: 6.8 6.9 Task-number: QTBUG-133225 Change-Id: I7b282e13e3767787d9b9e94f3a74702876531068 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* qmlformat: Reorder imports alphabeticallyOvidiu Tepescu2025-01-131-1/+7
| | | | | | | | | | | Reorder imports alphabetically. [ChangeLog][qmlformat] qmlformat now supports sorting of imports, there is a new commandline option -S that is used to sort imports. Fixes: QTBUG-132061 Change-Id: Ic163456d2beed84833f7aadef0688d37292ef0f2 Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
* qmlformat: fix error message outputSemih Yavuz2025-01-091-2/+0
| | | | | | | | | | | | | | We don't need m_valid to check if there is an error. Do validity check by m_error.isEmpty(). Prior to this commit, an invalid command line option given to qmlformat wouldn't spit out the error message and qmlformat would silently ignore the error and run with default settings. For example, the command qmlformat -W -342523 <filepath> should error out with this commit since a negative line length is given. Change-Id: Ie7d07e3b2b3714793f9abed4558003cc5ad77b34 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* qmlformat: use indenting line writer if column break is in useSemih Yavuz2024-12-051-5/+6
| | | | | | Task-number: QTBUG-113590 Change-Id: I24e1d8df81736b63d8b2eb25aa8625b9e22b211a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: allow customizable line breakSemih Yavuz2024-12-051-0/+16
| | | | | | | | | Set line break width from commandline or settings file. Introduce -W option to set the maximum line width. Task-number: QTBUG-113590 Change-Id: Ieb0c4bd728139eec6dacaf629a640a0f2c88557f Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* qmlformat: Pass QQmlFormatOptions by const refUlf Hermann2024-10-071-6/+12
| | | | | | | | | | | There actually is a code path that returns it as-is and that saves a copy this way. Coverity-Id: 469518 Coverity-Id: 469514 Change-Id: I50bcfe6c30648baba192233003d4a77fb8a4d048 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* qmlformat: extract settings logic into librarySami Shalayel2024-09-202-190/+3
| | | | | | | | | | Move the code from tools/qmlformat.cpp that parses .qmlformat.ini files into a newly created qmlformat library under src/qmlformat. This would allow qmlls to reuse the same code. Task-number: QTBUG-128866 Change-Id: Ibf7e52be744ea11c235d0b853ffa80f778c14a2b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: refactor qmlformat.ini readingSami Shalayel2024-09-201-137/+221
| | | | | | | | | | | | | | | | Move the Options to QQmlFormatOptions and make it reuse the fields from LineWriteOptions via setters and getters instead of duplicating them. Create a QQmlFormatSettings class that is a QQmlToolingSettings with qmlformat fields, and that contains the static keys of the settings it contains. Those classes will be moved to a separate library and reused by qmlls in a later commit. Task-number: QTBUG-128866 Change-Id: I90057fedbae57e487e64fb98181ae26730008f67 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QML Tools: add some checks for QFile::open failuresGiuseppe D'Angelo2024-03-261-7/+9
| | | | | Change-Id: Ic95509efbd7ce33d6e98a52eef3dd319cd328306 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* DOM refactoring. Remove LoadOptionsDmitrii Akshintsev2024-01-301-8/+6
| | | | | | | | | Only defaultLoad is being used, hence it doesn't make sense to have them at all at the current stage Task-number: QTBUG-119550 Change-Id: I761e7c55d6aaafa29d234ace4b4b65bcc46a9855 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Avoid various inefficienciesUlf Hermann2024-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | Coverity-Id: 435555 Coverity-Id: 435556 Coverity-Id: 435557 Coverity-Id: 435559 Coverity-Id: 435561 Coverity-Id: 435562 Coverity-Id: 435563 Coverity-Id: 435564 Coverity-Id: 435565 Coverity-Id: 435566 Coverity-Id: 435567 Coverity-Id: 435568 Coverity-Id: 435569 Change-Id: If482bde0189b72297f09e3ff28c825364d68fd89 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QQmlJS::Dom::OutWriter. RefactoringDmitrii Akshintsev2024-01-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The refactoring consists of: - Changing writeOut & writeOutForFile API to return boolean instead of MutableDomItem, which better reflects the existing usecases improving consistency of the data model* Moreover, previous API was exposing DomItem, which was not "committed to base" (MutableDomItem.commitToBase()), meaning it was exposing the "unmerged" Item alongside with the "temporary environment" - Refactoring & renaming OutWriter::updatedFile breaking it into smaller chunks preserving only necessary functionality - Adding some comments / documentation Before this commit, the writeOut API was "exposing",so called, "updatedFile", which is basically the copy of the original fileItem + renewed scriptExpressions which were modified during the writeOut of the original fileItem. The idea behind the "mutating" Dom API is that one has to create a MutableDomItem, do some changes to it and then "commit" them. This process is also facilitated by the creation of separate Env. (git analogy might be handy here: We create a separate branch, where all the mutation will happen and then we "merge" this branch) However, in the writeOutForFile usecase this "updatedFile" was needed only for the verifying of the consistency of the "writtenOut" DOM, however the API was exposing it further back to the caller sites, without "committing". The potential issue here is inconsistency of the data Model. On one side we have an original File Item owned by the Base Env, on the other side we have an "updatedFile" which is owned by another Env. Taking into account that there are no usecases requiring "exposing" "updatedFile", but also no need for "committing" the changes, It's arguably better to keep that temporary "updatedFile" locally, not exposing it outside the writeOutForFile function. Thereby improving consistency of the data model. Change-Id: If45eca4b4d6d703e2a76d0580f124d0292af5ed8 Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
* QmlFormat. Minor refactoring of the qmlformat.cppDmitrii Akshintsev2024-01-231-39/+83
| | | | | | | | Breaking main (qmlformat.cpp) into smaller chunks, providing better separation of concerns and improving readability Change-Id: Iadc236d73d3da5e150cdfd41a34baa12d63da6a8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* DOM refactoring. Move loadPendingDependencies to DomEnvironmentDmitrii Akshintsev2024-01-181-2/+1
| | | | | | | | | | | | | | | | | | | One of the goals of this refactoring is to move DomTop specific functionality from DomItem API to the corresponding DomEnvironment and DomUniverse. This commit moves loading of the dependencies (which are added to the pending load queue implicitly as part of the callbacks of the loadFile when DomEnv is created without the flag "NoDependencies") to the DomEnvironment interface Moreover, once work with dependencies is happening through the DomEnvironment explicitly, it allows us to get rid of "self" parameter. Task-number: QTBUG-119550 Change-Id: Ib3deb97eabe091ffded8c8c782ee08f8024468f2 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* DOM refactoring. Remove DomItem::loadItem. enable_shared_from_this for DomEnv*Dmitrii Akshintsev2024-01-181-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | As it was mentioned in the previous commits in the chain one of the goals of the refactoring is to introduce clearer separation of concerns. Only DomTop types are allowed to load files, hence it's arguable should be reflected in the interfaces explicitly. With the help of previous commits the relevant pieces of this function were moved to the corresponding DomEnvironment and DomUniverse types. This commit finally removes loadFile from the DomItem API. *It's also worth noting that in order to minimaze refactoring efforts and to keep the public API simple (not requiring DomItem &self argument on the top level), this commit also makes DomEnvironment a child of the std::enable_shared_from_this. This somewhat "breaks" the initial design approach inscribed in the DOM API allowing DomEnvironemt to get a shared_ptr to itself bypassing corresponding DomItem.ownerAs<> API. However, in the tradeoff of preserving consistency of the previous design and the explicitness of the interface, I would value the latter, hence I find this change acceptable. Change-Id: Ic2ce3fc80876be6bdbec93e4d273e4c6b7a2b218 Task-number: QTBUG-119550 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: fix formatting with -F optionSemih Yavuz2023-10-161-0/+4
| | | | | | | | | | qmlformat accepts -F option to format a list of files given in another file. That should supposed to be inplace, but qmlformat would send output to stdout. To fix this, force inplace formatting if the options.files are not empty. Change-Id: If62dd3edde91460eba5812b1d7aea1b7422f46bf Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QmlDom: Don't pass ErrorMessage by valueUlf Hermann2023-09-151-1/+1
| | | | | | | | | When iterating, pass it by const ref. When "adding" pass it by rvalue ref. In the few places where that clashes, copy it explicitly. Coverity-Id: 417092 Change-Id: I93b2d671c38a2f44334929fd7ec9c2f1a18caac8 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Remove DomItem::loadFile code-duplication and use correct environmentsSami Shalayel2023-03-291-1/+1
| | | | | | | | | | | | | | | | | | The loadFile overload (in DomItem, DomEnvironment and DomUnivers) for different files (in-memory files and files that needs to be loaded from disk) are either copypasted or just calling the other overload. Encapsulate the file-related arguments of all loadFile overloads into a new struct called FileToLoad, such that the copypasted overloads can be removed. Use the static factory function FileToLoad::fromMemory and FileToLoad::fromFileSystem to create the FileToLoad struct. In addition, FileToLoad allows to specify the environment in which a file should be loaded. Prior this commit, myEnv.loadFile() was creating a new environment for each loaded file. Change-Id: I3b6acb681cb77faefdaa447d985bdfbe4f6a9ce2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlls: move into own private static librarySami Shalayel2023-02-072-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qmlls was completely implemented in the ./tools directory, which made its code complicated to test and try out. Also, it required some "dirty" hacks in the actual tests (including files from others targets to be able to use them) and made testing new features for qmlls more complicated. To remedy this, the qmlls code was split into a tool (qmlls) and a static library (QmlLSPrivate). The tool only contains tools/qmlls/qmllanguageservertool.cpp (which has the qmlls main method) and links to QmlLSPrivate, that contains all the other qmlls-related code. This way, the tests can also link to QmlLSPrivate and test out individual functions there without needing to include files from other targets. Also rename all the files to make syncqt happy (adding "_p" to headers and prepending "q" to headers and files and includeguards), and use QString::fromUtf8() to silence the QString()-constructor deprecation warnings. On the way, move tools/shared/qqmltoolingsettings.* into its own private static library, instead of recompiling it for each tool that requires it. Move the qqmltoolingsettings stuff into the qt namespace to be usable. Also, add qmlls as a dependency to the qmlls tests to avoid testing an outdated qmlls-binary. This commit prepares qmlls's code to implement the go-to and find-usages features. Task-number: QTBUG-109006 Change-Id: I91eed689c68a0c53fb88006de335b0f852cc1a83 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: add 'ensure new line between functions' optionXavier BESSON2022-11-241-0/+11
| | | | | | Fixes: QTBUG-108659 Change-Id: I3e21727bd946089d89ce9c42f640f05230de8c8e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: add 'ensure new line between objects' optionXavier BESSON2022-11-141-0/+12
| | | | | | | | This option allows to format files into more 'refreshing' ones. It improves readability thanks to a clearer visualization of objects inside files. Change-Id: Ic3592e87ae16d14d70317d09d819cc5d331be822 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: do not generate backup filesSemih Yavuz2022-10-241-1/+2
| | | | | | | | | | qmlformat used to backup the original input file up to 2 copies when used with --inplace mode. Change this hardcoded number into 0 and generate no backup file. Fixes: QTBUG-107685 Change-Id: Ifca86968fa65be0fd678012fc2e41b9ed8601d21 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-09-071-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: Id89ed14990804a5024183e75382cc539d4293da1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Don't use PUBLIC_LIBRARIES for executablesAlexandru Croitor2022-07-211-1/+1
| | | | | Change-Id: I346ea4eac1dfbfb7fb81609307f5f7c4716bb8d1 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Add license headers to cmake filesLucie Gérard2022-07-081-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I72c89a98c42bbc9234d8495e9e503bec81d11037 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-111-27/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* qmlformat: Implement settings fileMaximilian Goldstein2021-10-262-2/+67
| | | | | | | | | | | | | Implements controlling qmlformat via a settings file as can be done for qmllint. [ChangeLog][General][qmlformat] Adds the ability to set linting options via a settings file rather than using command line parameters. Use --write-defaults to generate a template with default values for editing. Use --ignore-settings to disable this feature. Fixes: QTBUG-86415 Change-Id: I282c3b994ca6cc491a27b45f531f1ba1c2652ef7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Skip unnecessary commands when cross-building toolsJoerg Bornemann2021-10-081-0/+1
| | | | | | | | | | Call qt_internal_return_unless_building_tools() directly after qt_internal_add_tool() to avoid having to special-case code for when this function only creates imported targets in cross-builds. Task-number: QTBUG-85084 Change-Id: I5c8f2ecdf4936cfd15cb530e896bc4e5b5531620 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* replace devtools library with QtQmlFawzi Mohamed2021-07-021-1/+0
| | | | | | | | | | | | | | | qmldevtools was needed when building with qmake, and to avoid circular dependencies in the tools (before making QtQml minimal). Now it can be avoided. This change will make qmldom, qmlformat, qmlimportscanner and qmllint depend on QtQml (just like the other Qml tools) and not be always completely static (qmldevtools was always a static library, QtQml normally isn't). Change-Id: Idfa0a70e51f0d4999fb9753121c6c228ae69c9bb Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* qmlformat: Use the Qt version instead of 1.0Maximilian Goldstein2021-06-221-1/+1
| | | | | | | | This makes way more sense than just sticking to 1.0 forever or introducing our own tooling versioning and is consistent with qmllint. Pick-to: 6.2 Change-Id: Id797191e6b343b97831409e8d5f888761f91b1d5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: use QmlDomFawzi Mohamed2021-06-058-2383/+104
| | | | | | | | Replace qmlformat with the formatter using qml dom Change-Id: Ie90814260f2d3b9e589ce04381d5ad1880c5b519 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Remove unneeded *.pro and .prev_CMakeLists.txt filesCraig Scott2021-05-191-21/+0
| | | | | | | | | | The .pro files corresponding to the .prev_CMakeLists.txt files have already been removed. Change-Id: I254eafe4c7de1a516e33bd9cb3d9879e73fa83b4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* qmlformat: fix QFSFileEngine::open: No file name specifiedEvgeniy A. Dushistov2021-04-141-11/+13
| | | | | | | | | | | | | | | | Since commit d48b87450327e710f7b0a843627624aa67cae116 qmlformat prints the message: QFSFileEngine::open: No file name specified on normal usage like: qmlformat path/to/qml qmlformat -i path/to/qml This is because it tries to open the file specific by the "files" option event if no such option was passed. Pick-to: 6.0 6.1 Change-Id: Id14247210fc77a3f10dc25866607a9952fe81dfa Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Implement optional chainingMaximilian Goldstein2021-04-131-3/+3
| | | | | | | | | | | | | | | | | This change implements optional chaining (https://github.com/tc39/proposal-optional-chaining) by adding a new type of optional lookup with an offset to the end of a chain. If `undefined` or `null` is encountered during an access marked as optional, we jump to that end offset. Features: - Full support for all kinds of optional chain - With some codegen overhead but zero overhead during normal non-optional FieldMemberExpression resolution - Properly retains this contexts and does not need to resolve anything twice (this has been an issue previously) - No extra AST structures, just flags for existing ones [ChangeLog][QtQml] Added support for optional chaining (https://github.com/tc39/proposal-optional-chaining) Fixes: QTBUG-77926 Change-Id: I9a41cdc4ca272066c79c72b9b22206498a546843 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove using directive in headersFabian Kosmale2021-03-196-87/+86
| | | | | | | | | Having those in tooling headers is not really critical, but avoids some CodeChecker warnings. Change-Id: I33e54ca3519b79a00d582970770e8ab0b06ca742 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Uniformly support shebangFawzi Mohamed2021-02-152-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | The "qml" tool was the only way of loading QML files that would respect a shebang line. This is problematic as this way you cannot load such files programatically using QQmlComponent, limiting their re-use. Common tools like Qt Creator, but also qmllint, qmlformat, qmlcachegen, etc would not recognize files with shebangs. By moving she-bang support directly in the lexer all tools implicitly support it. Note that we could just as easily support '#' as extra comment character along with //, but here we narrowly add support for in the first line only, as node does (this means that javascript files using she-bang accepted by node, are now accepted also by qml). The only tool needing some adjustments is qmlformat, that has to emit the she-bang again as she-bang and as first line. Add tests for qmlformat, and sprinkle some she-bangs in the other tests just to be sure it doesn't affect anything. Change-Id: I1f6d881c7438bdb23163b5dbe829d59a35d11132 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* qmlformat: Use a struct to hold the command line optionsFurkan Uzumcu2021-02-101-80/+112
| | | | | | | | | | | | | | | Keeping the parser and the code that uses the command line options in the same function increases the number of lines for the same function, making it harder to read, and the number of arguments for parseFile function, makes it harder to understand and maintain. This commit adds an `Options` struct to hold on to the command line options and a build function to create the `Options` object. Pick-to: 6.1 Change-Id: I5dec0a5a5e990f413ee65bf2eba2ea1087e0ea28 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove the qmake project filesFabian Kosmale2021-01-151-17/+0
| | | | | | | | | Remove all qmake project files, except for examples which are used to test that qmake continues to work. Change-Id: Ic4abb72dc2dcd75df7a797c56056b6b3c5fe62ac Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: Remove import sortingMaximilian Goldstein2020-12-113-52/+6
| | | | | | | | | | | Remove import sorting due to the fact that sorting imports can break code. [ChangeLog][QML Tooling][qmlformat] Remove import sorting and the (now obsolete) -n parameter to disable it Fixes: QTBUG-89295 Pick-to: 6.0 Change-Id: I5ff13d0ae3c715db7645b412152aadb31811ce5a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: Add indent optionsMaximilian Goldstein2020-11-243-12/+41
| | | | | | | | | | | | Adds the ability to use tabs or any amount of spaces for indentation instead of the default of 4 spaces. [ChangeLog][QML][qmlformat] Added option to customize indentation. Fixes: QTBUG-86413 Change-Id: I3c370dda2d0069ef61202a2d862ce15bc513e55e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: Make arrow functions one linersMaximilian Goldstein2020-10-081-4/+16
| | | | | | Fixes: QTBUG-87179 Change-Id: Ieb7dffab59923bcb2ce8745c499eff7de44134b1 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: Make empty objects one linersMaximilian Goldstein2020-10-071-0/+4
| | | | | | Fixes: QTBUG-87181 Change-Id: Ic8b7f69b4f9faf907ec75f27b689ba3686eb013f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: Fix computed property namesMaximilian Goldstein2020-10-071-1/+5
| | | | | | | Fixes: QTBUG-87222 Pick-to: 5.15 Change-Id: If1da02d503041009b82651e1087fb4a1bdd79d59 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>