File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ IF(WITH_ASTYLE)
2
2
ADD_TEST (qgis_indentation ${CMAKE_SOURCE_DIR} /scripts/verify-indentation.sh )
3
3
ENDIF (WITH_ASTYLE )
4
4
5
+ ADD_TEST (qgis_banned_keywords ${CMAKE_SOURCE_DIR} /tests/code_layout/test_banned_keywords.sh )
5
6
ADD_TEST (qgis_licenses ${CMAKE_SOURCE_DIR} /tests/code_layout/test_licenses.sh )
6
7
ADD_TEST (qgis_spelling ${CMAKE_SOURCE_DIR} /scripts/spell_check/spell_test.sh )
7
8
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # This test checks for use of deprecated/outdated methods and suggests their replacement
4
+
5
+ declare -a KEYWORDS=()
6
+ declare -a HINTS=()
7
+
8
+ KEYWORDS[0]=" DBL_MAX"
9
+ HINTS[0]=" Use the type-safe method std::numeric_limits<double>::max() instead"
10
+
11
+ KEYWORDS[1]=" DBL_MIN"
12
+ HINTS[1]=" Use the type-safe method std::numeric_limits<double>::lowest() instead"
13
+
14
+ KEYWORDS[2]=" DBL_EPSILON"
15
+ HINTS[2]=" Use the type-safe method std::numeric_limits<double>::epsilon() instead"
16
+
17
+ RES=
18
+ DIR=$( git rev-parse --show-toplevel)
19
+
20
+ pushd " ${DIR} " > /dev/null || exit
21
+
22
+ for i in " ${! KEYWORDS[@]} "
23
+ do
24
+ FOUND=$( git grep " ${KEYWORDS[$i]} " -- ' src/*.h' ' src/*.cpp' )
25
+
26
+ if [[ ${FOUND} ]]; then
27
+ echo " Found source files with banned keyword: ${KEYWORDS[$i]} !"
28
+ echo " -> ${HINTS[$i]} "
29
+ echo
30
+ echo " ${FOUND} "
31
+ echo
32
+ RES=1
33
+ fi
34
+
35
+ done
36
+
37
+ popd > /dev/null || exit
38
+
39
+ if [ $RES ]; then
40
+ echo " *** Found banned keywords"
41
+ exit 1
42
+ fi
43
+
You can’t perform that action at this time.
0 commit comments