diff --git a/.gitlab/templates/linting.yml b/.gitlab/templates/linting.yml index 265f25adba149cf8bfe43acc7e7251f1b132c6ee..7fd2cc92697cbab18ebd3ef58b27cc9f24fe2b8b 100644 --- a/.gitlab/templates/linting.yml +++ b/.gitlab/templates/linting.yml @@ -20,13 +20,15 @@ .check-copyright: image: ${CONTAINER_REGISTRY_PATH}/ci-base:${DOCKER_IMAGE_TAG} script: - - python3 tools/check_copyright.py -c \ + - | + python3 tools/check_copyright.py -c \ "${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$(git merge-base HEAD origin/main)}" .check-style: image: ${CONTAINER_REGISTRY_PATH}/ci-base:${DOCKER_IMAGE_TAG} script: - - python3 tools/check_style.py -c \ + - | + python3 tools/check_style.py -c \ "${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$(git merge-base HEAD origin/main)}" artifacts: when: on_failure @@ -49,7 +51,8 @@ .check-commit-msg: image: ${CONTAINER_REGISTRY_PATH}/ci-base:${DOCKER_IMAGE_TAG} script: - - python3 tools/check_commit_msg.py -c \ + - | + python3 tools/check_commit_msg.py -c \ ${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$(git merge-base HEAD origin/main)} artifacts: paths: diff --git a/tools/check_copyright.py b/tools/check_copyright.py index 326261d848f6c5920af849a167eba3b50047d00e..04b6cc2f7df6635b7c65e44832f8bc9bb04df204 100755 --- a/tools/check_copyright.py +++ b/tools/check_copyright.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Arm SCP/MCP Software -# Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved. +# Copyright (c) 2015-2025, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -165,6 +165,7 @@ def check_copyright(filename, pattern, analysis): def run(commit_hash=get_previous_commit()): print(banner('Checking the copyrights in the code...')) + commit_hash = commit_hash.strip() changed_files = get_changed_files(commit_hash) if changed_files == -1: return False diff --git a/tools/check_style.py b/tools/check_style.py index 18dbe62239000eeae8d899b583e4157aa1d57373..936474d68a9df49ed3dee326c654efb0d105f30d 100755 --- a/tools/check_style.py +++ b/tools/check_style.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Arm SCP/MCP Software -# Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. +# Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -28,6 +28,7 @@ DEFAULT_OUTPUT_FILE = 'code-style.patch' def run(output_file=DEFAULT_OUTPUT_FILE, commit_hash=get_previous_commit()): print(banner(f'Run coding style checks against {commit_hash[:8]}')) + commit_hash = commit_hash.strip() files = get_changed_files(commit_hash) if files == -1: return False