Debian Codegraph @

vendor/wikimedia/parsoid/bin/getattributecheck.sh

raw symbols SCIP
1 #!/bin/bash
2
3 # Ensure that no more uses of $node -> getAttribute creep into our repository...
4 # we should be using DOMCompat::getAttribute( $node )
5
6 BIN=$(dirname $0)
7 # put this string together in a somewhat awkward way so that it doesn't
8 # trigger a match itself.
9 grepPhrase="getAttribute"
10 badWords='$node->'"$grepPhrase"'('
11 grepPhrase="[-]>$grepPhrase[(]"
12
13 # If any of these commands fail, something is wrong!
14 set -ev
15
16 # exclude DOMCompat
17 FILES=$(git grep -l '[-]>')
18
19 # Ensure exactly 1 line is present (in DOMCompat::getAttribute itself)
20 x=`git grep "$grepPhrase" $FILES | wc -l`
21 if [ ! $x -eq 1 ]
22 then
23 echo "Uses of $badWords found! :("
24 git grep -P "$grepPhrase" $FILES
25 exit -1
26 fi
27 echo "No new uses of $badWords found! :)"