Skip to content
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

lint: add script to check for https violations #2491

Merged
Merged
Show file tree
Hide file tree
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
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}