summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexander Batischev <eual.jp@gmail.com> 2021-03-17 16:11:55 +0300
committerGravatar Alexander Batischev <eual.jp@gmail.com> 2021-03-20 15:55:39 +0300
commit296afc1646c04315b07176d23f47479727197539 (patch)
treee69e2ccfc58f15c03a11ebb5af6e0608a8bb6857
parent25a7a4c76cf238d238fbc2d5dd372b9c81cfb30d (diff)
downloadnewsboat-296afc1646c04315b07176d23f47479727197539.tar.gz
newsboat-296afc1646c04315b07176d23f47479727197539.tar.zst
newsboat-296afc1646c04315b07176d23f47479727197539.zip
CI: check for dbg! macro
This macro prints even in the release mode, so we should avoid it. For now, the check is not very constrained: it examines all files, not just the Rust code, and the simplistic regex can be triggered even by a comment. OTOH I'm pretty sure this check *can't* miss a legitimate dbg! call, so I prefer not to make it any more complicated at this time.
-rw-r--r--.cirrus.yml21
1 files changed, 21 insertions, 0 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
index 1de85084..7534843f 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -422,3 +422,24 @@ i18nspector_task:
# an exclamation mark. This fails the build if the log contains errors or
# warnings.
script: make run-i18nspector | tee i18nspector.log && ! egrep --silent "^(E|W):" i18nspector.log
+
+no_dbg_macros_task:
+ name: "No dbg! macros in Rust code"
+
+ container:
+ cpu: 1
+ memory: 512MB
+ image: alpine:3.10.2
+
+ script:
+ # Alpine uses BusyBox, so grep there doesn't support long options.
+ #
+ # -E -- extended regex, which supports beginning-of-word marker
+ # -r -- recursive
+ # -n -- show line numbers
+ #
+ # `!` in front of the command negates its exit code: this script will now
+ # exit with 0 if no matches were found, and with 1 if there are matches.
+ # We need parentheses to prevent YAML parser from eating up the
+ # exclamation mark.
+ - ( ! grep -Ern '\<dbg!' * )