Skip to content

Commit

Permalink
Add test to ensure QgsScrollArea is used instead of QScrollArea in ui…
Browse files Browse the repository at this point in the history
… files

(cherry picked from commit 8409f7f)
  • Loading branch information
nyalldawson committed Jan 25, 2022
1 parent 364bf43 commit c96000f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/code_layout.yml
Expand Up @@ -92,6 +92,14 @@ jobs:
- name: Def Window Title Test
run: ./tests/code_layout/test_defwindowtitle.sh

qgsscrollarea_check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run QgsScrollArea check
run: ./tests/code_layout/test_qgsscrollarea.sh

qvariant_no_brace_init:
runs-on: ubuntu-latest
steps:
Expand Down
28 changes: 28 additions & 0 deletions tests/code_layout/test_qgsscrollarea.sh
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# This test checks for use of QScrollArea in .ui files and suggests using QgsScrollArea instead

RES=
DIR=$(git rev-parse --show-toplevel)

pushd "${DIR}" > /dev/null || exit

FOUND=$(git grep "class=\"QScrollArea\"" -- 'src/*.ui' | grep --invert-match skip-keyword-check)

if [[ ${FOUND} ]]; then
echo "Base QScrollArea class used in .ui file!"
echo " -> Use QgsScrollArea class instead"
echo
echo "${FOUND}"
echo
RES=1
fi


popd > /dev/null || exit

if [ $RES ]; then
echo " *** Found QScrollArea use in ui files"
exit 1
fi

0 comments on commit c96000f

Please sign in to comment.