File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 1-
21"""This script checks for the presence of an SPDX-License-Identifier in the comments of source files."""
32from __future__ import annotations
43
98
109def _load_file (file_path : str ) -> str :
1110 try :
12- with open (file_path , 'r' , encoding = 'utf-8' ) as f :
11+ with open (file_path , encoding = 'utf-8' ) as f :
1312 return f .read ()
1413 except Exception as e :
15- print (f"Error loading file content of { file_path } : { e } " )
14+ print (f"Error loading file content of { file_path } : { e } " )
1615
1716
1817def _check_spdx (file_content : str ) -> bool :
1918 for line in file_content :
2019 stripped_line = line .strip ()
21- if stripped_line .startswith ("#" ) or stripped_line .startswith ("//" ) or re .match (r" ^\s*/\*" , stripped_line ):
22- if " SPDX-License-Identifier:" in stripped_line :
20+ if stripped_line .startswith ('#' ) or stripped_line .startswith ('//' ) or re .match (r' ^\s*/\*' , stripped_line ):
21+ if ' SPDX-License-Identifier:' in stripped_line :
2322 return True
2423 else :
2524 break
You can’t perform that action at this time.
0 commit comments