projects
/
platform
/
upstream
/
nodejs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0693d22
)
tools: add check-imports.sh script
author
Ben Noordhuis
<info@bnoordhuis.nl>
Fri, 5 Jul 2013 20:42:06 +0000
(22:42 +0200)
committer
Ben Noordhuis
<info@bnoordhuis.nl>
Sat, 6 Jul 2013 15:44:45 +0000
(17:44 +0200)
Checks that `using` statements in src/*.cc are properly sorted and
actually used.
tools/check-imports.sh
[new file with mode: 0755]
patch
|
blob
diff --git a/tools/check-imports.sh
b/tools/check-imports.sh
new file mode 100755
(executable)
index 0000000..
54cba93
--- /dev/null
+++ b/
tools/check-imports.sh
@@ -0,0
+1,15
@@
+#!/bin/sh
+
+cd `dirname "$0"`/../
+
+for FILE in src/*.cc; do
+ sed -rne 's/^using (\w+::\w+);$/\1/p' $FILE | sort -c || echo "in $FILE"
+done
+
+for FILE in src/*.cc; do
+ for IMPORT in `sed -rne 's/^using (\w+)::(\w+);$/\2/p' $FILE`; do
+ if ! sed -re '/^using (\w+)::(\w+);$/d' $FILE | grep -q "$IMPORT"; then
+ echo "$IMPORT unused in $FILE"
+ fi
+ done
+done