github.com/pvitto98/fabric@v2.1.1+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          '^build/'
    13          '(^|/)ci\.properties$'
    14          '(^|/)\.git/'
    15          '\.gen\.go$'
    16          '(^|/)go.mod$'
    17          '(^|/)go.sum$'
    18          '(^|/)Gopkg\.lock$'
    19          '\.html$'
    20          '\.json$'
    21          '\.key$'
    22          '(^|/)LICENSE$'
    23          '\.md$'
    24          '\.pb\.go$'
    25          '\.pem$'
    26          '\.png$'
    27          '\.pptx$'
    28          '\.rst$'
    29          '_sk$'
    30          '\.tx$'
    31          '\.txt$'
    32          '(^|/)testdata\/'
    33          '(^|/)vendor\/'
    34          '(^|/)Pipfile$'
    35          '(^|/)Pipfile\.lock$'
    36      )
    37  
    38      local filter
    39      filter=$(local IFS='|' ; echo "${excluded_files[*]}")
    40  
    41      read -ra files <<<"$@"
    42      for f in "${files[@]}"; do
    43          file=$(echo "$f" | grep -Ev "$filter" | sort -u)
    44          if [ -n "$file" ]; then
    45              head -n2 "$file" | grep -qE '// Code generated by' || echo "$file"
    46          fi
    47      done
    48  }