Skip to content

sanity check: fix copyright year parsing #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions scripts/sanity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
set -eu
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

function replace_acceptable_years() {
# this needs to replace all acceptable forms with 'YEARS'
sed -e 's/20[12][0-9]-20[12][0-9]/YEARS/' -e 's/2019/YEARS/' -e 's/2020/YEARS/'
}

printf "=> Checking linux tests... "
FIRST_OUT="$(git status --porcelain)"
ruby "$here/../scripts/generate_linux_tests.rb" > /dev/null
Expand Down Expand Up @@ -58,7 +63,7 @@ for language in swift-or-c bash dtrace; do
//
// This source file is part of the AsyncHTTPClient open source project
//
// Copyright (c) 2018-2019 Apple Inc. and the AsyncHTTPClient project authors
// Copyright (c) YEARS Apple Inc. and the AsyncHTTPClient project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -77,7 +82,7 @@ EOF
##
## This source file is part of the AsyncHTTPClient open source project
##
## Copyright (c) 2018-2019 Apple Inc. and the AsyncHTTPClient project authors
## Copyright (c) YEARS Apple Inc. and the AsyncHTTPClient project authors
## Licensed under Apache License v2.0
##
## See LICENSE.txt for license information
Expand All @@ -96,7 +101,7 @@ EOF
*
* This source file is part of the AsyncHTTPClient open source project
*
* Copyright (c) 2018-2019 Apple Inc. and the AsyncHTTPClient project authors
* Copyright (c) YEARS Apple Inc. and the AsyncHTTPClient project authors
* Licensed under Apache License v2.0
*
* See LICENSE.txt for license information
Expand All @@ -121,9 +126,9 @@ EOF
\( \! -path './.build/*' -a \
\( "${matching_files[@]}" \) -a \
\( \! \( "${exceptions[@]}" \) \) \) | while read line; do
if [[ "$(cat "$line" | head -n $expected_lines | shasum)" != "$expected_sha" ]]; then
if [[ "$(cat "$line" | replace_acceptable_years | head -n $expected_lines | shasum)" != "$expected_sha" ]]; then
printf "\033[0;31mmissing headers in file '$line'!\033[0m\n"
diff -u <(cat "$line" | head -n $expected_lines) "$tmp"
diff -u <(cat "$line" | replace_acceptable_years | head -n $expected_lines) "$tmp"
exit 1
fi
done
Expand Down