forked from hyperledger/fabric-private-chaincode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.sh
executable file
·53 lines (49 loc) · 1.21 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
51
52
53
#!/bin/bash
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
# Note: This file is adapted from hyperledger/fabric scripts/functions.sh (ec81f3e74)
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$'
'samples/deployment/test-network/fabric-samples/'
)
local filter
filter=$(local IFS='|' ; echo "${excluded_files[*]}")
files=($@)
for f in "${files[@]}"; do
file=$(echo "$f" | grep -Ev "$filter" | sort -u)
if [ -n "$file" ]; then
head -n2 "$file" | grep -qE '// Code generated by' || echo "$file"
fi
done
}