github.com/aristanetworks/goarista@v0.0.0-20240514173732-cca2755bbd44/check_copyright_notice.sh (about)

     1  #!/bin/sh
     2  # Copyright (c) 2017 Arista Networks, Inc.
     3  # Use of this source code is governed by the Apache License 2.0
     4  # that can be found in the COPYING file.
     5  
     6  # egrep that comes with our Linux distro doesn't like \d, so use [0-9]
     7  notice='Copyright \(c\) 20[0-9][0-9] Arista Networks, Inc.'
     8  files=`git diff-tree --no-commit-id --name-only --diff-filter=ACMR -r HEAD | \
     9  	egrep '\.(go|proto|py|sh)$' | grep -v '\.pb\.go$'`
    10  status=0
    11  
    12  for file in $files; do
    13  	if ! egrep -q "$notice" $file; then
    14  		echo "$file: missing or incorrect copyright notice"
    15  		status=1
    16  	fi
    17  done
    18  
    19  exit $status