File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ supports_colors () {
4+ if [[ -z ${TERM} ]] || [[ ${TERM} == " " ]] || [[ ${TERM} == " dumb" ]]; then
5+ echo " NO"
6+ return
7+ fi
8+ if which tput > /dev/null 2>&1 ; then
9+ # shellcheck disable=SC2046
10+ if [[ $( tput colors) -gt 1 ]]; then
11+ echo " YES"
12+ return
13+ fi
14+ fi
15+ echo " NO"
16+ }
17+
18+ red () {
19+ if [[ " $( supports_colors) " == " YES" ]]; then
20+ tput sgr0
21+ echo " $( tput setaf 1) ${1} $( tput sgr0) "
22+ return
23+ fi
24+ echo " ${1} "
25+ }
26+
27+ run_copyright () {
28+ OUT=$( find . -name ' *.py' | grep -v -E " ./(docs|scripts|debian|juju-egg-info|.tox|.git|juju/client)|__init__" | sort | xargs grep -L -E ' # (Copyright|Code generated)' || true)
29+ LINES=$( echo " ${OUT} " | wc -w)
30+ if [ " $LINES " != 0 ]; then
31+ echo " "
32+ echo " $( red ' Found some issues:' ) "
33+ echo -e ' \nThe following files are missing copyright headers'
34+ echo " ${OUT} "
35+ exit 1
36+ fi
37+ }
38+
39+ test_copyright () {
40+ echo " ==> Copyright analysis"
41+
42+ (
43+ # cd .. || exit
44+
45+ # Check for copyright notices
46+ run_copyright
47+ )
48+ }
49+
50+ test_copyright
You can’t perform that action at this time.
0 commit comments