MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / CheckHeaderFileIncluded

Function CheckHeaderFileIncluded

util/cpplint.py:1888–1910  ·  view source on GitHub ↗

Logs an error if a .cc file does not include its header.

(filename, include_state, error)

Source from the content-addressed store, hash-verified

1886
1887
1888def CheckHeaderFileIncluded(filename, include_state, error):
1889 """Logs an error if a .cc file does not include its header."""
1890
1891 # Do not check test files
1892 fileinfo = FileInfo(filename)
1893 if Search(_TEST_FILE_SUFFIX, fileinfo.BaseName()):
1894 return
1895
1896 headerfile = filename[0:len(filename) - len(fileinfo.Extension())] + '.h'
1897 if not os.path.exists(headerfile):
1898 return
1899 headername = FileInfo(headerfile).RepositoryName()
1900 first_include = 0
1901 for section_list in include_state.include_list:
1902 for f in section_list:
1903 if headername in f[0] or f[0] in headername:
1904 return
1905 if not first_include:
1906 first_include = f[1]
1907
1908 error(filename, first_include, 'build/include', 5,
1909 '%s should include its header file %s' % (fileinfo.RepositoryName(),
1910 headername))
1911
1912
1913def CheckForBadCharacters(filename, lines, error):

Callers 1

ProcessFileDataFunction · 0.85

Calls 6

BaseNameMethod · 0.95
ExtensionMethod · 0.95
RepositoryNameMethod · 0.95
FileInfoClass · 0.85
SearchFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected