MCPcopy Create free account
hub / github.com/tensorflow/tfjs / CheckHeaderFileIncluded

Function CheckHeaderFileIncluded

tfjs-backend-wasm/tools/cpplint.py:1983–2005  ·  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

1981
1982
1983def CheckHeaderFileIncluded(filename, include_state, error):
1984 """Logs an error if a .cc file does not include its header."""
1985
1986 # Do not check test files
1987 fileinfo = FileInfo(filename)
1988 if Search(_TEST_FILE_SUFFIX, fileinfo.BaseName()):
1989 return
1990
1991 headerfile = filename[0:len(filename) - len(fileinfo.Extension())] + '.h'
1992 if not os.path.exists(headerfile):
1993 return
1994 headername = FileInfo(headerfile).RepositoryName()
1995 first_include = 0
1996 for section_list in include_state.include_list:
1997 for f in section_list:
1998 if headername in f[0] or f[0] in headername:
1999 return
2000 if not first_include:
2001 first_include = f[1]
2002
2003 error(filename, first_include, 'build/include', 5,
2004 '%s should include its header file %s' % (fileinfo.RepositoryName(),
2005 headername))
2006
2007
2008def CheckForBadCharacters(filename, lines, error):

Callers 1

ProcessFileDataFunction · 0.85

Calls 5

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…