github.com/yacovm/fabric@v2.0.0-alpha.0.20191128145320-c5d4087dc723+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          '\.json$'
    20          '\.key$'
    21          '(^|/)LICENSE$'
    22          '\.md$'
    23          '\.pb\.go$'
    24          '\.pem$'
    25          '\.png$'
    26          '\.pptx$'
    27          '\.rst$'
    28          '_sk$'
    29          '\.tx$'
    30          '\.txt$'
    31          '(^|/)testdata\/'
    32          '(^|/)vendor\/'
    33          '(^|/)Pipfile$'
    34          '(^|/)Pipfile\.lock$'
    35      )
    36  
    37      local filter
    38      filter=$(local IFS='|' ; echo "${excluded_files[*]}")
    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  }