Skip to content

Commit 2868549

Browse files
authored
Add more checks for missing keywords (#1293)
Hopefully this will stop missing keywords from accumulating. See also #1107
1 parent 42a7456 commit 2868549

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

.ci/butler.sh

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ echo "No subjects with leading lower case characters<br>" > leading_lowercases.t
99
echo "No subjects with trailing periods<br>" > trailing_periods.txt
1010
echo "No body lines are too wide<br>" > too_long_body_lines.txt
1111
echo "No keywords are missing in keywords.txt<br>" > missing_keywords.txt
12+
echo "No keywords in code that don't exist in keywords.txt<br>" > missing_keywords_2.txt
13+
echo "No keywords in code that don't have Doxygen comments and aren't blacklisted in keywords.txt<br>" > missing_keywords_3.txt
14+
echo "No lines in keywords.txt using spaces instead of TAB (the Arduino IDE doesn't support space)<br>" > tab_spaces_keywords.txt
1215
echo "No occurences of the deprecated boolean data type<br>" >> booleans.txt
1316

1417
too_long_subjects=`awk 'length > 72' subjects.txt`
@@ -49,6 +52,33 @@ if [ -n "$missing_keywords" ]; then
4952
result=1
5053
fi
5154

55+
missing_keywords_2=$(SOURCE_FILES="core/ drivers/ hal/ examples/ examples_linux/ MyConfig.h MySensors.h"; for keyword in $(grep -whore 'MY_[A-Z][A-Z_0-9]*' $SOURCE_FILES | sort -u ); do grep -q $keyword keywords.txt || echo $keyword; done)
56+
if [ -n "$missing_keywords_2" ]; then
57+
echo "<b>Keywords in code that don't exist in keywords.txt:</b>" > missing_keywords_2.txt
58+
echo "If keywords aren't in keywords.txt, they will not be highlighted in the Arduino IDE. Highlighting makes the code easier to follow and helps spot spelling mistakes." > missing_keywords_2.txt
59+
echo "$missing_keywords_2" >> missing_keywords_2.txt
60+
sed -i -e 's/$/<br>/' missing_keywords_2.txt
61+
result=1
62+
fi
63+
64+
missing_keywords_3=$(SOURCE_FILES="core/ drivers/ hal/ examples/ examples_linux/ MyConfig.h MySensors.h"; for keyword in $(grep -whore 'MY_[A-Z][A-Z_0-9]*' $SOURCE_FILES | sort -u ); do grep -q $keyword keywords.txt || echo $keyword; done)
65+
if [ -n "$missing_keywords_3" ]; then
66+
echo "<b>Keywords in code that don't have Doxygen comments and aren't blacklisted in keywords.txt:</b>" > missing_keywords_3.txt
67+
echo "If keywords don't have Doxygen comments, they will not be available at https://www.mysensors.org/apidocs/index.html Add Doxygen comments to make it easier for users to find and understand how to use the new keywords." > missing_keywords_3.txt
68+
echo "$missing_keywords_3" >> missing_keywords_3.txt
69+
sed -i -e 's/$/<br>/' missing_keywords_3.txt
70+
result=1
71+
fi
72+
73+
74+
tab_spaces_keywords=$(grep -e '[[:space:]]KEYWORD' -e '[[:space:]]LITERAL1' keywords.txt | grep -v -e $'\tLITERAL1' -e $'\tKEYWORD')
75+
if [ -n "$tab_spaces_keywords" ]; then
76+
echo "<b>Keywords that use space instead of TAB in keywords.txt:</b>" > tab_spaces_keywords.txt
77+
echo "$tab_spaces_keywords" >> tab_spaces_keywords.txt
78+
sed -i -e 's/$/<br>/' tab_spaces_keywords.txt
79+
result=1
80+
fi
81+
5282
# Evaluate if there exists booleans in the code tree (not counting this file)
5383
if git grep -q boolean -- `git ls-files | grep -v butler.sh`; then
5484
echo "<b>You have added at least one occurence of the deprecated boolean data type. Please use bool instead.</b><br>" > booleans.txt
@@ -57,7 +87,7 @@ fi
5787
5888
printf "%s" "<html>" > butler.html
5989
echo "Greetings! Here is my evaluation of your pull request:<br>" >> butler.html
60-
awk 'FNR==1{print "<br>"}1' too_long_subjects.txt leading_lowercases.txt trailing_periods.txt too_long_body_lines.txt missing_keywords.txt booleans.txt >> butler.html
90+
awk 'FNR==1{print "<br>"}1' too_long_subjects.txt leading_lowercases.txt trailing_periods.txt too_long_body_lines.txt missing_keywords.txt missing_keywords_2.txt missing_keywords_3.txt tab_spaces_keywords.txt booleans.txt >> butler.html
6191
echo "<br>" >> butler.html
6292
if [ $result -ne 0 ]; then
6393
echo "<b>I am afraid there are some issues with your commit messages and/or use of keywords.</b><br>" >> butler.html

keywords.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,3 +356,20 @@ MY_ESP8266_SERIAL_MODE LITERAL1
356356
# MY_XYZ_POWER_PIN
357357
# MY_MQTT_TOPIC_PREFIX
358358

359+
# Blacklist - listed in https://github.com/mysensors/MySensors/issues/1107
360+
# Since no-one can take responsibility for them, we blacklist them so
361+
# we can get warnings when new items are added.
362+
# MY_AVR_TEMPERATURE_GAIN
363+
# MY_AVR_TEMPERATURE_OFFSET
364+
# MY_CRYPTO_SHA256_ASM
365+
# MY_ESP32_TEMPERATURE_GAIN
366+
# MY_ESP32_TEMPERATURE_OFFSET
367+
# MY_NRF5_RX_BUFFER_SIZE
368+
# MY_SAMD_TEMPERATURE_GAIN
369+
# MY_SAMD_TEMPERATURE_OFFSET
370+
# MY_STM32F1_TEMPERATURE_GAIN
371+
# MY_STM32F1_TEMPERATURE_OFFSET
372+
# MY_TRANSPORT_ENCRYPTION
373+
# MY_OTA_I2C_ADDR
374+
# MY_RF69_DIO5
375+
# MY_SERIALDEVICE

0 commit comments

Comments
 (0)