#!/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$'
        '(^|/)testdata\/'
        '(^|/)vendor\/'
        '(^|/)Pipfile$'
        '(^|/)Pipfile\.lock$'
    )

    local filter
    filter=$(local IFS='|' ; echo "${excluded_files[*]}")

    read -ra 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
}

#!/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$'
    )

    local filter
    filter=$(local IFS='|' ; echo "${excluded_files[*]}")

    read -ra 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
}

Add NOTICE to license ignore list
Add NOTICE to license ignore list

Signed-off-by: Brett Logan <27f2994114a86935bdf785c1c695cc77f5f5dd0b@ibm.com>
