github.com/ldc1995/fabric-ca@v2.0.0-alpha.0.20200422214819-8d49c278c386+incompatible/scripts/functions.sh (about) 1 #!/bin/bash 2 # 3 # Copyright IBM Corp. All Rights Reserved. 4 # 5 # SPDX-License-Identifier: Apache-2.0 6 7 function filterExcludedAndGeneratedFiles() { 8 local excluded_files 9 excluded_files=( 10 '\.block$' 11 '^\.build/' 12 '(^|/)ci\.properties$' 13 '(^|/)\.git/' 14 '\.gen\.go$' 15 '(^|/)Gopkg\.lock$' 16 '\.key$' 17 '(^|/)LICENSE$' 18 '\.md$' 19 '\.pb\.go$' 20 '\.pem$' 21 '\.png$' 22 '\.pptx$' 23 '\.rst$' 24 '_sk$' 25 '\.tx$' 26 '\.txt$' 27 '(^|/)testdata\/' 28 '(^|/)vendor\/' 29 '\.json$' 30 '(^|/)Pipfile$' 31 '(^|/)Pipfile\.lock$' 32 ) 33 34 local filter 35 filter=$( 36 local IFS='|' 37 echo "${excluded_files[*]}" 38 ) 39 40 read -ra files <<<"$@" 41 for f in "${files[@]}"; do 42 file=$(echo "$f" | grep -Ev "$filter" | sort -u) 43 if [[ -n "$file" ]]; then 44 head -n2 "$file" | grep -qE '// Code generated by' || echo "$file" 45 fi 46 done 47 }