Returns the CPP variable that should be used as a header guard. Args: filename: The name of a C++ header file. Returns: The CPP variable that should be used as a header guard in the named file.
(filename)
| 1109 | |
| 1110 | |
| 1111 | def GetHeaderGuardCPPVariable(filename): |
| 1112 | """Returns the CPP variable that should be used as a header guard. |
| 1113 | |
| 1114 | Args: |
| 1115 | filename: The name of a C++ header file. |
| 1116 | |
| 1117 | Returns: |
| 1118 | The CPP variable that should be used as a header guard in the |
| 1119 | named file. |
| 1120 | |
| 1121 | """ |
| 1122 | |
| 1123 | # Restores original filename in case that cpplint is invoked from Emacs's |
| 1124 | # flymake. |
| 1125 | filename = re.sub(r'_flymake\.h$', '.h', filename) |
| 1126 | filename = re.sub(r'/\.flymake/([^/]*)$', r'/\1', filename) |
| 1127 | |
| 1128 | fileinfo = FileInfo(filename) |
| 1129 | file_path_from_root = fileinfo.RepositoryName() |
| 1130 | if _root: |
| 1131 | file_path_from_root = re.sub('^' + _root + os.sep, '', file_path_from_root) |
| 1132 | return re.sub(r'[-./\s]', '_', file_path_from_root).upper() + '_' |
| 1133 | |
| 1134 | |
| 1135 | def CheckForHeaderGuard(filename, lines, error): |
no test coverage detected