File tree Expand file tree Collapse file tree 2 files changed +90
-0
lines changed Expand file tree Collapse file tree 2 files changed +90
-0
lines changed Original file line number Diff line number Diff line change 1212 # Don't use more features like "gdnative_bindings_generator/debug" to keep CI truly minimal
1313 GDRUST_FEATURES : " gdnative/async,gdnative/serde"
1414
15+ RIPGREP_VERSION : " 13.0.0"
16+
1517on :
1618 pull_request :
1719 branches :
5254 - name : " Check clippy"
5355 run : cargo clippy --workspace --features ${GDRUST_FEATURES} -- -D clippy::style -D clippy::complexity -D clippy::perf -D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented
5456
57+ check-todo :
58+ runs-on : ubuntu-latest
59+ steps :
60+ - uses : actions/checkout@v3
61+ - name : " Install ripgrep"
62+ run : |
63+ cd /tmp
64+ wget --no-verbose https://github.com/BurntSushi/ripgrep/releases/download/${RIPGREP_VERSION}/ripgrep-${RIPGREP_VERSION}-x86_64-unknown-linux-musl.tar.gz -O ripgrep.tar.gz
65+ tar -zxvf ripgrep.tar.gz
66+ sudo mv ripgrep-${RIPGREP_VERSION}-x86_64-unknown-linux-musl/rg /usr/bin
67+ - name : " Look for TODO comments without issue numbers attached to them"
68+ run : bash tools/detect-todo.sh
69+
5570 unit-test :
5671 runs-on : ubuntu-latest
5772 steps :
Original file line number Diff line number Diff line change 1+ #! /usr/bin/bash
2+
3+ # Small utility to detect todo comments
4+ # Used by godot-rust developers
5+
6+ REGEX=' (?<!clippy::)(TODO|FIXME)(?!!\(\)|[a-zA-Z]|\((#|(\w+/)+)\d+\))'
7+
8+ # Self test
9+
10+ TEST_OUTPUT=$( rg -i --pcre2 " $REGEX " << EOF
11+ # Should hit - Naive
12+
13+ todo
14+ TODO
15+ fixme
16+ FiXmE
17+ reallytodo
18+ trulyfixme
19+
20+ # Should hit - Malformed
21+
22+ todo123
23+ fixme123
24+ TODO(123)
25+ TODO(/////)
26+ TODO(T123)
27+
28+ # Should not hit - With issue numbers
29+
30+ todo(#123)
31+ todo(foo/bar/123)
32+ fixme(#123)
33+ fixme(foo/bar/123)
34+
35+ # Should not hit - Other uses of the words
36+
37+ clippy::todo
38+ todo!()
39+
40+ # Should not hit - Words merely containing the keywords
41+
42+ mastodon
43+ ictodosaur
44+ EOF
45+ )
46+
47+ diff -u --color <( printf ' %s\n' " $TEST_OUTPUT " ) <( cat << EOF
48+ todo
49+ TODO
50+ fixme
51+ FiXmE
52+ reallytodo
53+ trulyfixme
54+ todo123
55+ fixme123
56+ TODO(123)
57+ TODO(/////)
58+ TODO(T123)
59+ EOF
60+ )
61+
62+ if [[ $? -ne 0 ]]
63+ then
64+ echo ' Test run of detection regex failed.'
65+ exit 1
66+ fi
67+
68+ # Actual run
69+
70+ rg -iTh -Tsh --pcre2 " $REGEX "
71+ if [[ $? -eq 0 ]]
72+ then
73+ echo ' Found TODO comments without issue numbers.'
74+ exit 1
75+ fi
You can’t perform that action at this time.
0 commit comments