From 78a23bbd696020359f5a5547e046043c09771cf8 Mon Sep 17 00:00:00 2001 From: Pascal Kesseli Date: Mon, 19 Jun 2017 17:59:15 +0100 Subject: [PATCH] Fix removal of first component Removal of first component for header guard suggestion is hard-coded to remove 4 characters ("src/"). This doesn't work with all directory names ("unit/"). --- scripts/cpplint.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/cpplint.py b/scripts/cpplint.py index 64fab3758f9..6f8797445ef 100755 --- a/scripts/cpplint.py +++ b/scripts/cpplint.py @@ -1967,7 +1967,9 @@ def GetHeaderGuardCPPVariable(filename): fileinfo = FileInfo(filename) file_path_from_root = fileinfo.RepositoryName() - file_path_from_root = 'CPROVER_' + file_path_from_root[4:] + # Remove first path component + offset=len(file_path_from_root.split(os.path.sep)[0])+1 + file_path_from_root = 'CPROVER_' + file_path_from_root[offset:] if _root: suffix = os.sep # On Windows using directory separator will leave us with