File tree Expand file tree Collapse file tree 1 file changed +20
-10
lines changed Expand file tree Collapse file tree 1 file changed +20
-10
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- # Copyright © Magento, Inc. All rights reserved.
4- # See COPYING.txt for license details .
3+ # Copyright 2017 Adobe
4+ # All Rights Reserved .
55
66
77FILE_EXTENSIONS=' .php\|.xml\|.xsd'
88BLOCKLIST=' bin/blocklist.txt'
99RESULT=' '
1010
11+ CURRENT_YEAR=$( date +" %Y" )
12+
1113# Iterate through the list of tracked files
1214# that have the expected extensions
1315# that are not ignored
14- for i in ` git ls-tree --full-tree -r --name-only HEAD | grep $FILE_EXTENSIONS | grep -v -f $BLOCKLIST `
15- do
16- if echo ` cat $i ` | grep -q -v " Copyright © Magento, Inc. All rights reserved." ; then
17- # Copyright is missing
18- RESULT+=" $i \n"
16+ for i in $( git ls-tree --full-tree -r --name-only HEAD | grep $FILE_EXTENSIONS | grep -v -f $BLOCKLIST ) ; do
17+ CONTENT=$( cat " $i " )
18+
19+ # Extract year from copyright line
20+ if echo " $CONTENT " | grep -qE " Copyright [0-9]{4} Adobe" ; then
21+ YEAR=$( echo " $CONTENT " | grep -oE " Copyright [0-9]{4} Adobe" | grep -oE " [0-9]{4}" )
22+
23+ if [[ $YEAR -ge 2010 && $YEAR -le $CURRENT_YEAR ]]; then
24+ continue # Valid copyright
25+ else
26+ RESULT+=" $i (Invalid year: $YEAR )\n"
27+ fi
28+ else
29+ RESULT+=" $i (Missing copyright)\n"
1930 fi
2031done
2132
2233if [[ ! -z $RESULT ]]; then
23- printf " \nTHE FOLLOWING FILES ARE MISSING THE MAGENTO COPYRIGHT:\n\n"
24- printf " Copyright © Magento, Inc. All rights reserved.\n"
25- printf " See COPYING.txt for license details.\n\n"
34+ printf " \nTHE FOLLOWING FILES HAVE COPYRIGHT ISSUES:\n\n"
35+ printf " Expected format: Copyright <year> Adobe (year between 2010 and $CURRENT_YEAR )\n\n"
2636 printf " $RESULT \n"
2737 exit 1
2838fi
You can’t perform that action at this time.
0 commit comments