Skip to content

Commit 726d0c6

Browse files
authored
sanity check: fix copyright year parsing (#142)
1 parent 48e284d commit 726d0c6

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Diff for: scripts/sanity.sh

+10-5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
set -eu
1717
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1818

19+
function replace_acceptable_years() {
20+
# this needs to replace all acceptable forms with 'YEARS'
21+
sed -e 's/20[12][0-9]-20[12][0-9]/YEARS/' -e 's/2019/YEARS/' -e 's/2020/YEARS/'
22+
}
23+
1924
printf "=> Checking linux tests... "
2025
FIRST_OUT="$(git status --porcelain)"
2126
ruby "$here/../scripts/generate_linux_tests.rb" > /dev/null
@@ -58,7 +63,7 @@ for language in swift-or-c bash dtrace; do
5863
//
5964
// This source file is part of the AsyncHTTPClient open source project
6065
//
61-
// Copyright (c) 2018-2019 Apple Inc. and the AsyncHTTPClient project authors
66+
// Copyright (c) YEARS Apple Inc. and the AsyncHTTPClient project authors
6267
// Licensed under Apache License v2.0
6368
//
6469
// See LICENSE.txt for license information
@@ -77,7 +82,7 @@ EOF
7782
##
7883
## This source file is part of the AsyncHTTPClient open source project
7984
##
80-
## Copyright (c) 2018-2019 Apple Inc. and the AsyncHTTPClient project authors
85+
## Copyright (c) YEARS Apple Inc. and the AsyncHTTPClient project authors
8186
## Licensed under Apache License v2.0
8287
##
8388
## See LICENSE.txt for license information
@@ -96,7 +101,7 @@ EOF
96101
*
97102
* This source file is part of the AsyncHTTPClient open source project
98103
*
99-
* Copyright (c) 2018-2019 Apple Inc. and the AsyncHTTPClient project authors
104+
* Copyright (c) YEARS Apple Inc. and the AsyncHTTPClient project authors
100105
* Licensed under Apache License v2.0
101106
*
102107
* See LICENSE.txt for license information
@@ -121,9 +126,9 @@ EOF
121126
\( \! -path './.build/*' -a \
122127
\( "${matching_files[@]}" \) -a \
123128
\( \! \( "${exceptions[@]}" \) \) \) | while read line; do
124-
if [[ "$(cat "$line" | head -n $expected_lines | shasum)" != "$expected_sha" ]]; then
129+
if [[ "$(cat "$line" | replace_acceptable_years | head -n $expected_lines | shasum)" != "$expected_sha" ]]; then
125130
printf "\033[0;31mmissing headers in file '$line'!\033[0m\n"
126-
diff -u <(cat "$line" | head -n $expected_lines) "$tmp"
131+
diff -u <(cat "$line" | replace_acceptable_years | head -n $expected_lines) "$tmp"
127132
exit 1
128133
fi
129134
done

0 commit comments

Comments
 (0)