From 2f133eff1d4682fe21fee6f28fbe5af4988f1f52 Mon Sep 17 00:00:00 2001 From: SeeLook <seelook@gmail.com> Date: Sat, 8 Feb 2025 16:37:18 +0100 Subject: [PATCH] Tricky script to find wrong Connections statements --- spare_parts/qml_connections_check.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 spare_parts/qml_connections_check.sh diff --git a/spare_parts/qml_connections_check.sh b/spare_parts/qml_connections_check.sh new file mode 100644 index 00000000..5809086c --- /dev/null +++ b/spare_parts/qml_connections_check.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Find all .qml files +find . -type f -name "*.qml" | while read -r file; do + inside_connections=0 + while IFS= read -r line || [[ -n "$line" ]]; do + ((line_number++)) + + # Detect the start of a Connections block + if [[ $line =~ "Connections"[[:space:]]*\{ ]]; then + inside_connections=1 + fi + + # Detect the end of a Connections block + if [[ $inside_connections -eq 1 && $line =~ \} ]]; then + inside_connections=0 + fi + + # Check for incorrect signal handlers inside Connections {} + if [[ $inside_connections -eq 1 && $line =~ ^[[:space:]]*on[A-Z] ]]; then + echo "Incorrect signal handler in $file at line $line_number: $line" + fi + done < "$file" + line_number=0 +done -- GitLab