Skip to content

Commit

Permalink
scripts: add clean_perl_imports.sh
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Efremov <efremov@linux.com>
  • Loading branch information
evdenis committed May 6, 2020
1 parent aa28a38 commit 7c5998d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions scripts/clean_perl_imports.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

for i in `find . -type f -name *.pm`;
do
use=$(grep -Poe '^use\h+[^(]+\(\K[^)]+' $i)
for u in $use
do
u=`echo $u | tr -d ':%$@'`
if [[ $u == 'import' || $u == 'RE' || $u == 'config' || $u == 'no_getopt_compat' || $u == 'permute' || $u == 'pass_through' || $u == 'gnu_compat' ]]
then
continue
fi
if ! grep -Pv '^use\b' $i | grep -qP "\b$u\b"
then
echo "No $u in $i"
fi
done
done

0 comments on commit 7c5998d

Please sign in to comment.