diff --git a/scripts/pr_check.sh b/scripts/pr_check.sh index 837be9f058..cea49c9bb5 100755 --- a/scripts/pr_check.sh +++ b/scripts/pr_check.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2023 Intel Corporation. All Rights Reserved. +# Copyright 2024 Intel Corporation. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -29,6 +29,8 @@ fixed=0 license_file=$PWD/../LICENSE +year_format="[[:digit:]][[:digit:]][[:digit:]][[:digit:]]" + function check_folder { for filename in $(find $1 -type f \( -iname \*.cpp -o -iname \*.h -o -iname \*.hpp -o -iname \*.js -o -iname \*.bat -o -iname \*.sh -o -iname \*.txt -o -iname \*.py \)); do @@ -43,7 +45,8 @@ function check_folder { if [[ ! $filename == *"usbhost"* ]]; then # Only check files that are not .gitignore-d if [[ $(git check-ignore $filename | wc -l) -eq 0 ]]; then - if [[ $(grep -oP "Copyright 2023 Intel Corporation. All Rights Reserved" $filename | wc -l) -eq 0 || + if [[ $(grep -oP "Copyright $year_format Intel Corporation. All Rights Reserved" $filename | wc -l) -eq 0 && + $(grep -oP "Copyright $year_format-$year_format Intel Corporation. All Rights Reserved" $filename | wc -l) -eq 0 || $(grep -oP "Licensed under the Apache License, Version 2.0" $filename | wc -l) -eq 0 ]]; then echo "[ERROR] $filename is missing the copyright/license notice"