parameters: (self, file_name, print_diff)
return_statement: return True
docstring: Check the specified file has the correct format
docstring_summary: Check the specified file has the correct format
docstring_tokens: Check the specified file has the correct format
function: def _lint(self, file_name, print_diff):
          """Check the specified file has the correct format
          """
          with open(file_name, 'rb') as original_text:
              original_file = original_text.read()
  
          # Get formatted file as clang-format would format the file
          formatted_file = callo([self.path, "--style=file", file_name])
  
          if original_file != formatted_file:
              if print_diff:
                  original_lines = original_file.splitlines()
                  formatted_lines = formatted_file.splitlines()
                  result = difflib.unified_diff(original_lines, formatted_lines)
  
                  # Take a lock to ensure diffs do not get mixed when printed to the screen
                  with self.print_lock:
                      print("ERROR: Found diff for " + file_name)
                      print("To fix formatting errors, run %s --style=file -i %s" %
                              (self.path, file_name))
                      for line in result:
                          print(line.rstrip())
  
              return False
  
          return True
function_tokens: def _lint ( self , file_name , print_diff ) : with open ( file_name , 'rb' ) as original_text : original_file = original_text . read ( ) # Get formatted file as clang-format would format the file formatted_file = callo ( [ self . path , "--style=file" , file_name ] ) if original_file != formatted_file : if print_diff : original_lines = original_file . splitlines ( ) formatted_lines = formatted_file . splitlines ( ) result = difflib . unified_diff ( original_lines , formatted_lines ) # Take a lock to ensure diffs do not get mixed when printed to the screen with self . print_lock : print ( "ERROR: Found diff for " + file_name ) print ( "To fix formatting errors, run %s --style=file -i %s" % ( self . path , file_name ) ) for line in result : print ( line . rstrip ( ) ) return False return True