@@ -40,18 +40,18 @@ def exclude_untracked_files(path):
4040 cmd_result = subprocess .check_output (['git' , 'ls-files' , '-o' ], universal_newlines = True )
4141 cmd_result = cmd_result .split ('\n ' )
4242 cmd_result .remove ('' )
43- if not path .endswith ("/ " ):
44- path += "/ "
43+ if not path .endswith (f" { os . sep } " ):
44+ path += f" { os . sep } "
4545 cmd_result = [file .replace (path , '' , 1 ) for file in cmd_result ]
4646 DEFAULT_EXCLUDE_EXTENSION_FILES .extend (cmd_result )
4747 except Exception as ex :
4848 logger .error (f"Error to get git untracked files : { ex } " )
4949
5050
51- def exclude_gitignore_files (path ):
51+ def exclude_gitignore_files (current_path , path ):
5252 global DEFAULT_EXCLUDE_EXTENSION_FILES
5353 try :
54- root_path = VCSStrategyGit .find_root (path )
54+ root_path = VCSStrategyGit .find_root (current_path )
5555 if os .path .isfile (os .path .join (root_path , '.gitignore' )):
5656 cmd_result = subprocess .check_output (['git' ,
5757 'ls-files' ,
@@ -60,8 +60,8 @@ def exclude_gitignore_files(path):
6060 universal_newlines = True )
6161 cmd_result = cmd_result .split ('\n ' )
6262 cmd_result .remove ('' )
63- if not path .endswith ("/ " ):
64- path += "/ "
63+ if not path .endswith (f" { os . sep } " ):
64+ path += f" { os . sep } "
6565 cmd_result = [file .replace (path , '' , 1 ) for file in cmd_result ]
6666 DEFAULT_EXCLUDE_EXTENSION_FILES .extend (cmd_result )
6767 else :
@@ -80,7 +80,7 @@ def exclude_git_related_files(path):
8080 # Exclude untracked files
8181 exclude_untracked_files (path )
8282 # Exclude ignore files
83- exclude_gitignore_files (path )
83+ exclude_gitignore_files (current_path , path )
8484
8585 # Restore path
8686 os .chdir (current_path )
@@ -244,14 +244,14 @@ def precheck_for_project(path_to_find, mode='lint'):
244244
245245 # File list that missing license text
246246 missing_license = [str (sub ) for sub in set (report .files_without_licenses )]
247- if not path_to_find .endswith ("/ " ):
248- path_to_find += "/ "
247+ if not path_to_find .endswith (f" { os . sep } " ):
248+ path_to_find += f" { os . sep } "
249249 missing_license = [sub .replace (path_to_find , '' ) for sub in missing_license ]
250250
251251 # File list that missing copyright text
252252 missing_copyright = [str (sub ) for sub in set (report .files_without_copyright )]
253- if not path_to_find .endswith ("/ " ):
254- path_to_find += "/ "
253+ if not path_to_find .endswith (f" { os . sep } " ):
254+ path_to_find += f" { os . sep } "
255255 missing_copyright = [sub .replace (path_to_find , '' ) for sub in missing_copyright ]
256256 except Exception as ex :
257257 dump_error_msg (f"Error prechecker lint: { ex } " , True )
0 commit comments