Skip to content

Commit 34f3319

Browse files
committed
MQE-431: Automatically check for copyright at the top of every framework file
- Refactor, rename, add comment to blacklist file
1 parent 6440539 commit 34f3319

File tree

3 files changed

+24
-16
lines changed

3 files changed

+24
-16
lines changed

bin/blacklist.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Specify directories or files for the copyright-check to ignore.
2+
#
3+
# e.g.
4+
# path/to/directory
5+
# path/to/file.php
6+
#
7+
# THIS FILE CANNOT CONTAIN BLANK LINES
8+
#
9+
dev/tests/static/Magento/Sniffs/Annotations

bin/copyright-check

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
#!/bin/bash
22

3-
IGNORE_PATH='bin/copyright-ignore.txt'
4-
FILE_EXTENSIONS_TO_CHECK='.php\|.xml\|.xsd'
5-
3+
FILE_EXTENSIONS='.php\|.xml\|.xsd'
4+
BLACKLIST='bin/blacklist.txt'
65
RESULT=''
76

8-
# Iterate through all php, xml, and xsd files that are part of the Git repo
9-
# (excluding any matching lines from the ignore file)
10-
for i in `git ls-tree --full-tree -r --name-only HEAD | grep $FILE_EXTENSIONS_TO_CHECK | grep -v -f $IGNORE_PATH`
7+
# Iterate through the list of tracked files
8+
# that have the expected extensions
9+
# that are not ignored
10+
for i in `git ls-tree --full-tree -r --name-only HEAD | grep $FILE_EXTENSIONS | grep -v -f $BLACKLIST`
1111
do
12-
if echo `cat $i` | grep -q -v "Copyright © Magento, Inc. All rights reserved."; then
13-
# Copyright is missing
14-
RESULT+="$i\n"
15-
fi
12+
if echo `cat $i` | grep -q -v "Copyright © Magento, Inc. All rights reserved."; then
13+
# Copyright is missing
14+
RESULT+="$i\n"
15+
fi
1616
done
1717

1818
if [[ ! -z $RESULT ]]; then
19-
printf "\nTHE FOLLOWING FILES ARE MISSING THE MAGENTO COPYRIGHT:\n\n"
20-
printf " Copyright © Magento, Inc. All rights reserved.\n"
21-
printf " See COPYING.txt for license details.\n\n"
22-
printf "$RESULT\n"
23-
exit 1
19+
printf "\nTHE FOLLOWING FILES ARE MISSING THE MAGENTO COPYRIGHT:\n\n"
20+
printf " Copyright © Magento, Inc. All rights reserved.\n"
21+
printf " See COPYING.txt for license details.\n\n"
22+
printf "$RESULT\n"
23+
exit 1
2424
fi
2525

2626
# Success!

bin/copyright-ignore.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)