Skip to content

Commit

Permalink
lint: add script to check https violations
Browse files Browse the repository at this point in the history
Rationale:
    During refactors/ports involving upstream, it's not unlikely that
    some headers will be directly taken from upstream without changing
    the protocol in the copyright header. This lint checks for cases
    like these.
  • Loading branch information
div72 committed Apr 17, 2022
1 parent 87d5db4 commit d9280bd
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/lint/lint-copyright-https.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
#
# Copyright (c) 2022 The Gridcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/licenses/mit-license.php.

export LC_ALL=C
set -e

if [[ -z "${COMMIT_RANGE}" ]]; then
echo "USAGE: COMMIT_RANGE=\"FIRST..LAST\" $0"
exit 0
fi

EXIT_CODE=0
while read f; do
if grep -E "http://(www\.)?opensource.org" "$f" > /dev/null; then
EXIT_CODE=1
echo "$f: needs https correction for the copyright header."
fi
done < <(git diff --name-only "${COMMIT_RANGE}")

exit ${EXIT_CODE}

0 comments on commit d9280bd

Please sign in to comment.