From 99eef72a18d9e65318d281f193c270b8265ab310 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:04:07 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pre_commit_hooks/check_spdx.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pre_commit_hooks/check_spdx.py b/pre_commit_hooks/check_spdx.py index 6bca7855..994600e2 100755 --- a/pre_commit_hooks/check_spdx.py +++ b/pre_commit_hooks/check_spdx.py @@ -1,4 +1,3 @@ - """This script checks for the presence of an SPDX-License-Identifier in the comments of source files.""" from __future__ import annotations @@ -9,17 +8,17 @@ def _load_file(file_path: str) -> str: try: - with open(file_path, 'r', encoding='utf-8') as f: + with open(file_path, encoding='utf-8') as f: return f.read() except Exception as e: - print(f"Error loading file content of {file_path}: {e}") + print(f"Error loading file content of {file_path}: {e}") def _check_spdx(file_content: str) -> bool: for line in file_content: stripped_line = line.strip() - if stripped_line.startswith("#") or stripped_line.startswith("//") or re.match(r"^\s*/\*", stripped_line): - if "SPDX-License-Identifier:" in stripped_line: + if stripped_line.startswith('#') or stripped_line.startswith('//') or re.match(r'^\s*/\*', stripped_line): + if 'SPDX-License-Identifier:' in stripped_line: return True else: break