SINGA-21 Code review modify the header guard style in cpplint -- change from INCLUDE_PATH to SINGA_PATH
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/b0483f21 Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/b0483f21 Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/b0483f21 Branch: refs/heads/master Commit: b0483f21cfd6a9a95fc11dc0a6ba07db81f99725 Parents: 56d32e8 Author: wang sheng <[email protected]> Authored: Mon Jun 22 16:14:09 2015 +0800 Committer: wang wei <[email protected]> Committed: Wed Jun 24 16:57:59 2015 +0800 ---------------------------------------------------------------------- tool/cpplint.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/b0483f21/tool/cpplint.py ---------------------------------------------------------------------- diff --git a/tool/cpplint.py b/tool/cpplint.py index ccc25d4..edc64d1 100755 --- a/tool/cpplint.py +++ b/tool/cpplint.py @@ -1666,12 +1666,16 @@ def GetHeaderGuardCPPVariable(filename): filename = re.sub(r'/\.flymake/([^/]*)$', r'/\1', filename) # Replace 'c++' with 'cpp'. filename = filename.replace('C++', 'cpp').replace('c++', 'cpp') - + fileinfo = FileInfo(filename) file_path_from_root = fileinfo.RepositoryName() if _root: file_path_from_root = re.sub('^' + _root + os.sep, '', file_path_from_root) - return re.sub(r'[^a-zA-Z0-9]', '_', file_path_from_root).upper() + '_' + # return re.sub(r'[^a-zA-Z0-9]', '_', file_path_from_root).upper() + '_' + + # [email protected]: change INCLUDE to SINGA + singa_path = re.sub(r'[^a-zA-Z0-9]', '_', file_path_from_root).upper() + '_' + return singa_path.replace("INCLUDE", "SINGA") def CheckForHeaderGuard(filename, clean_lines, error): @@ -4794,7 +4798,7 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension, # Make Windows paths like Unix. fullname = os.path.abspath(filename).replace('\\', '/') - + # Perform other checks now that we are sure that this is not an include line CheckCasts(filename, clean_lines, linenum, error) CheckGlobalStatic(filename, clean_lines, linenum, error) @@ -6034,7 +6038,7 @@ def ProcessFileData(filename, file_extension, lines, error, nesting_state.CheckCompletedBlocks(filename, error) CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error) - + # Check that the .cc file has included its header if it exists. if file_extension == 'cc': CheckHeaderFileIncluded(filename, include_state, error)
