forked from hyperledger/fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.sh
50 lines (47 loc) · 1.08 KB
/
functions.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
function filterExcludedAndGeneratedFiles {
local excluded_files
excluded_files=(
'\.block$'
'^\.build/'
'^build/'
'(^|/)ci\.properties$'
'(^|/)\.git/'
'\.gen\.go$'
'(^|/)go.mod$'
'(^|/)go.sum$'
'(^|/)Gopkg\.lock$'
'\.html$'
'\.json$'
'\.key$'
'(^|/)LICENSE$'
'\.md$'
'\.pb\.go$'
'\.pem$'
'\.png$'
'\.pptx$'
'\.rst$'
'_sk$'
'\.tx$'
'\.txt$'
'^NOTICE$'
'(^|/)testdata\/'
'(^|/)vendor\/'
'(^|/)Pipfile$'
'(^|/)Pipfile\.lock$'
'(^|/)tox\.ini$'
)
local filter
filter=$(local IFS='|' ; echo "${excluded_files[*]}")
read -rd '' -a files <<<"$@"
for f in "${files[@]}"; do
file=$(echo "$f" | grep -Ev "$filter" | sort -u)
if [ -n "$file" ]; then
head -n8 "$file" | grep -qE '// Code generated by' || echo "$file"
fi
done
}