Skip to content

Commit

Permalink
Merge pull request #2491 from div72/lint-copyright-https
Browse files Browse the repository at this point in the history
lint: add script to check for https violations
  • Loading branch information
jamescowens authored Apr 18, 2022
2 parents 931cd89 + d9280bd commit 0e6b2ac
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ci/lint/06_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@

export LC_ALL=C


GIT_HEAD=$(git rev-parse HEAD)
if [ "$EVENT_TYPE" = "pull_request" ]; then
test/lint/commit-script-check.sh $(git rev-parse HEAD~$COMMIT_COUNT)..$GITHUB_SHA
COMMIT_RANGE="$(git rev-parse HEAD~$COMMIT_COUNT)..$GIT_HEAD"
test/lint/commit-script-check.sh "$COMMIT_RANGE"
fi
export COMMIT_RANGE

#test/lint/git-subtree-check.sh src/crypto/ctaes
#test/lint/git-subtree-check.sh src/secp256k1
#test/lint/git-subtree-check.sh src/univalue
Expand Down
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 0e6b2ac

Please sign in to comment.