Skip to content

Commit

Permalink
KAZOO-4362: make less calls to git-grep in check-app-registered.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
fenollp committed Jan 26, 2016
1 parent 42ef375 commit 3a6ddb3
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions scripts/check-app-registered.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

# Usage: $0 ‹path to an app›

patterns=( ":start_link\\(\\{'local',\\s*" ":start_link\\(\\{local,\\s*" ':start_link\(' ':start_child\(' ':which_children\(' ':terminate_child\(' ':delete_child\(' ':call\(' ':cast\(' 'gen_listener:[^:\(]+\(' )


[[ $# -eq 0 ]] && exit

patterns=( ":start_link\\(\\{'local',\\s*" ":start_link\\(\\{local,\\s*" ':start_link\(' ':start_child\(' ':which_children\(' ':terminate_child\(' ':delete_child\(' ':call\(' ':cast\(' 'gen_listener:[^:\(]+\(' )
re='('
for pattern in ${patterns[@]}; do
re="$re"$pattern'|'
done
re=${re%%|}')'

function registered() {
local app="${1%%/}"
local errors=0
Expand All @@ -17,11 +21,9 @@ function registered() {
((errors += 1))
fi

for pattern in ${patterns[@]}; do
git grep -InE $pattern'\?MODULE' -- $app/src
local count=0; [[ $? -eq 0 ]] && count=$(git grep -InE $pattern'\?MODULE' -- $app/src | wc -l)
((errors += $count))
done
git grep -InE $re'\?MODULE' -- $app/src
local count=0; [[ $? -eq 0 ]] && count=$(git grep -InE $re'\?MODULE' -- $app/src | wc -l)
((errors += $count))

local app_src=$app/src/*.app.src
git grep -InE '\{registered, \[\]\}' -- $app_src >/dev/null
Expand Down

0 comments on commit 3a6ddb3

Please sign in to comment.