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)
| 1386 | |
| 1387 | |
| 1388 | def GetHeaderGuardCPPVariable(filename): |
| 1389 | """Returns the CPP variable that should be used as a header guard. |
| 1390 | |
| 1391 | Args: |
| 1392 | filename: The name of a C++ header file. |
| 1393 | |
| 1394 | Returns: |
| 1395 | The CPP variable that should be used as a header guard in the |
| 1396 | named file. |
| 1397 | |
| 1398 | """ |
| 1399 | |
| 1400 | # Restores original filename in case that cpplint is invoked from Emacs's |
| 1401 | # flymake. |
| 1402 | filename = re.sub(r'_flymake\.h$', '.h', filename) |
| 1403 | filename = re.sub(r'/\.flymake/([^/]*)$', r'/\1', filename) |
| 1404 | |
| 1405 | fileinfo = FileInfo(filename) |
| 1406 | file_path_from_root = fileinfo.RepositoryName() |
| 1407 | if _root: |
| 1408 | file_path_from_root = re.sub('^' + _root + os.sep, '', file_path_from_root) |
| 1409 | return re.sub(r'[-./\s]', '_', file_path_from_root).upper() + '_' |
| 1410 | |
| 1411 | |
| 1412 | def CheckForHeaderGuard(filename, lines, error): |
no test coverage detected