From d0c43eb872685988ed9979788f6d143c931f4512 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Thu, 26 Oct 2023 21:03:36 +0200 Subject: [PATCH] Add basic qml linter config --- .ci/format.sh | 9 +++++++ .gitlab-ci.yml | 2 +- .qmllint.ini | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 .qmllint.ini diff --git a/.ci/format.sh b/.ci/format.sh index cc4a3b82..20c1d126 100755 --- a/.ci/format.sh +++ b/.ci/format.sh @@ -8,6 +8,7 @@ set -eu FILES=$(find src -type f \( -iname "*.cpp" -o -iname "*.h" \)) +QML_FILES=$(find resources/qml -type f \( -iname "*.qml" \)) for f in $FILES do @@ -15,3 +16,11 @@ do done; git diff --exit-code + +if command -v /usr/lib64/qt6/bin/qmllint &> /dev/null; then + /usr/lib64/qt6/bin/qmllint $QML_FILES +elif command -v /usr/lib/qt6/bin/qmllint &> /dev/null; then + /usr/lib/qt6/bin/qmllint $QML_FILES +else + echo "No qmllint found, skipping check!" +fi diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c345883d..0a15fa33 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -312,7 +312,7 @@ linting: image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:latest tags: [docker] before_script: - - apk update && apk add make git python3 py3-pip + - apk update && apk add make git python3 py3-pip qt6-qtdeclarative-dev - apk add clang-extra-tools --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main - export PATH="$PATH:/root/.local/bin" - pip3 install --user reuse diff --git a/.qmllint.ini b/.qmllint.ini new file mode 100644 index 00000000..4781a741 --- /dev/null +++ b/.qmllint.ini @@ -0,0 +1,67 @@ +[General] +AdditionalQmlImportPaths= +DisableDefaultImports=false +DisablePlugins= +OverwriteImportTypes= +ResourcePath= + +[Warnings] +#AccessSingletonViaObject=warning +#AttachedPropertyReuse=disable +#BadSignalHandlerParameters=warning +#CompilerWarnings=disable +#Deprecated=warning +#DuplicatePropertyBinding=warning +#DuplicatedName=warning +#ImportFailure=warning +#IncompatibleType=warning +#InheritanceCycle=warning +#InvalidLintDirective=warning +#LintPluginWarnings=disable +#MissingProperty=warning +#MissingType=warning +#MultilineStrings=info +#NonListProperty=warning +#PrefixedImportType=warning +#PropertyAliasCycles=warning +#ReadOnlyProperty=warning +#RequiredProperty=warning +#RestrictedType=warning +#TopLevelComponent=warning +#UncreatableType=warning +#UnqualifiedAccess=warning +#UnresolvedType=warning +#UnusedImports=info +#UseProperFunction=warning +#VarUsedBeforeDeclaration=warning +#WithStatement=warning + +AccessSingletonViaObject=disable +AttachedPropertyReuse=disable +BadSignalHandlerParameters=disable +CompilerWarnings=disable +Deprecated=disable +DuplicatePropertyBinding=disable +DuplicatedName=disable +ImportFailure=disable +IncompatibleType=disable +InheritanceCycle=disable +InvalidLintDirective=disable +LintPluginWarnings=disable +MissingProperty=disable +MissingType=disable +MultilineStrings=info +NonListProperty=disable +PrefixedImportType=disable +PropertyAliasCycles=disable +ReadOnlyProperty=disable +RequiredProperty=disable +RestrictedType=disable +TopLevelComponent=disable +UncreatableType=disable +UnqualifiedAccess=disable +UnresolvedType=disable +UnusedImports=info +UseProperFunction=disable +VarUsedBeforeDeclaration=disable +WithStatement=disable