parameters: (filename, include_state, error)
docstring: Logs an error if a source file does not include its header.
docstring_summary: Logs an error if a source file does not include its header.
docstring_tokens: Logs an error if a source file does not include its header .
function: def CheckHeaderFileIncluded(filename, include_state, error):
    """Logs an error if a source file does not include its header."""
  
    # Do not check test files
    fileinfo = FileInfo(filename)
    if Search(_TEST_FILE_SUFFIX, fileinfo.BaseName()):
      return
  
    for ext in GetHeaderExtensions():
      basefilename = filename[0:len(filename) - len(fileinfo.Extension())]
      headerfile = basefilename + '.' + ext
      if not os.path.exists(headerfile):
        continue
      headername = FileInfo(headerfile).RepositoryName()
      first_include = None
      include_uses_unix_dir_aliases = False
      for section_list in include_state.include_list:
        for f in section_list:
          include_text = f[0]
          if "./" in include_text:
            include_uses_unix_dir_aliases = True
          if headername in include_text or include_text in headername:
            return
          if not first_include:
            first_include = f[1]
  
      message = '%s should include its header file %s' % (fileinfo.RepositoryName(), headername)
      if include_uses_unix_dir_aliases:
        message += ". Relative paths like . and .. are not allowed."
  
      error(filename, first_include, 'build/include', 5, message)
function_tokens: def CheckHeaderFileIncluded ( filename , include_state , error ) : # Do not check test files fileinfo = FileInfo ( filename ) if Search ( _TEST_FILE_SUFFIX , fileinfo . BaseName ( ) ) : return for ext in GetHeaderExtensions ( ) : basefilename = filename [ 0 : len ( filename ) - len ( fileinfo . Extension ( ) ) ] headerfile = basefilename + '.' + ext if not os . path . exists ( headerfile ) : continue headername = FileInfo ( headerfile ) . RepositoryName ( ) first_include = None include_uses_unix_dir_aliases = False for section_list in include_state . include_list : for f in section_list : include_text = f [ 0 ] if "./" in include_text : include_uses_unix_dir_aliases = True if headername in include_text or include_text in headername : return if not first_include : first_include = f [ 1 ] message = '%s should include its header file %s' % ( fileinfo . RepositoryName ( ) , headername ) if include_uses_unix_dir_aliases : message += ". Relative paths like . and .. are not allowed." error ( filename , first_include , 'build/include' , 5 , message )