Files
elasticsearch-js/scripts/check-spdx
Josh Mock 461f9b7f66 SPDX license format (#2667)
* Switch to SPDX license format for all non-codegen files

* Add test to ensure all committed JS files have SPDX header
2025-03-21 12:31:38 -05:00

28 lines
522 B
Bash
Executable File

#!/usr/bin/env bash
# Copyright Elasticsearch B.V. and contributors
# SPDX-License-Identifier: Apache-2.0
correct='/*
* Copyright Elasticsearch B.V. and contributors
* SPDX-License-Identifier: Apache-2.0
*/'
the_exit=0
check_file() {
if $(diff <(head -n4 "$1") <(echo "$correct") &>/dev/null); then
echo "Correct: $1"
else
echo "Incorrect: $1"
the_exit=1
fi
}
echo "SPDX license header check"
for file in $(git ls-files | grep -E '\.(ts|js|mjs)$'); do
check_file "$file"
done
exit "$the_exit"