github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/tests/suites/static_analysis/copyright.sh (about)

     1  run_copyright() {
     2  	OUT=$(find . -name '*.go' | grep -v -E "(./vendor|./acceptancetests|./provider/azure/internal|./cloudconfig|./cmd/output/progress|./_deps)" | sort | xargs grep -L -E '// (Copyright|Code generated)' || true)
     3  	LINES=$(echo "${OUT}" | wc -w)
     4  	if [ "$LINES" != 0 ]; then
     5  		echo ""
     6  		echo "$(red 'Found some issues:')"
     7  		echo -e '\nThe following files are missing copyright headers'
     8  		echo "${OUT}"
     9  		exit 1
    10  	fi
    11  }
    12  
    13  test_copyright() {
    14  	if [ "$(skip 'test_copyright')" ]; then
    15  		echo "==> TEST SKIPPED: static copyright analysis"
    16  		return
    17  	fi
    18  
    19  	(
    20  		set_verbosity
    21  
    22  		cd .. || exit
    23  
    24  		# Check for copyright notices
    25  		run_linter "run_copyright"
    26  	)
    27  }