aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/copyright_checking.py
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-11-22 08:49:05 +0000
committersaturneric <[email protected]>2024-11-22 08:49:05 +0000
commit5c8eadade53fcdd5703b0ac7c1fad616f9aa5790 (patch)
treeeb45785d25943ea69e9b3ae694fa49cb11deaaf4 /scripts/copyright_checking.py
parentfeat: improve nightly and other workflows (diff)
downloadGpgFrontend-5c8eadade53fcdd5703b0ac7c1fad616f9aa5790.tar.gz
GpgFrontend-5c8eadade53fcdd5703b0ac7c1fad616f9aa5790.zip
fix: clean up files
Diffstat (limited to 'scripts/copyright_checking.py')
-rw-r--r--scripts/copyright_checking.py33
1 files changed, 18 insertions, 15 deletions
diff --git a/scripts/copyright_checking.py b/scripts/copyright_checking.py
index c03ca558..72f28874 100644
--- a/scripts/copyright_checking.py
+++ b/scripts/copyright_checking.py
@@ -29,7 +29,7 @@ copyright_text_source = """/**
*
*/"""
- # copyright text for script files
+# copyright text for script files
copyright_text_script = """# Copyright (C) 2021-2024 Saturneric <[email protected]>
#
# This file is part of GpgFrontend.
@@ -56,20 +56,23 @@ copyright_text_script = """# Copyright (C) 2021-2024 Saturneric <[email protected]>
# SPDX-License-Identifier: GPL-3.0-or-later
"""
+
def check_copright_by_path(path, copyright_text, suffix):
- for root, _, files in os.walk(path):
- for file in files:
- if file.endswith(suffix):
- file_path = os.path.join(root, file)
- with open(file_path, 'r', encoding='utf-8') as f:
- content = f.read()
- if copyright_text not in content:
- print(f"copyright declaration missing: {file_path}")
+ for root, _, files in os.walk(path):
+ for file in files:
+ if file.endswith(suffix):
+ file_path = os.path.join(root, file)
+ with open(file_path, "r", encoding="utf-8") as f:
+ content = f.read()
+ if copyright_text not in content:
+ print(f"copyright declaration missing: {file_path}")
+
+
+check_copright_by_path("src", copyright_text_source, (".c", ".cpp", ".h", ".hpp"))
+check_copright_by_path("src", copyright_text_script, (".txt"))
+check_copright_by_path("src", copyright_text_script, (".txt"))
+check_copright_by_path("modules", copyright_text_source, (".c", ".cpp", ".h", ".hpp"))
+check_copright_by_path("modules", copyright_text_script, (".txt"))
-check_copright_by_path("src", copyright_text_source, ('.c', '.cpp', '.h', '.hpp'))
-check_copright_by_path("src", copyright_text_script, ('.txt'))
-check_copright_by_path("src", copyright_text_script, ('.txt'))
-check_copright_by_path("modules", copyright_text_script, ('.txt'))
-check_copright_by_path("modules", copyright_text_script, ('.c', '.cpp', '.h', '.hpp'))
-print("check done") \ No newline at end of file
+print("copyright check done")