(clean_lines, line_number, file_state, error)
Looks for use of MAX() and MIN() macros that should be replaced with std::max() and std::min().

    Args:
      clean_lines: A CleansedLines instance containing the file.
      line_number: The number of the line to check.
      file_state: A _FileState instance which maintains information about
                  the state of things in the file.
      error: The function to call with any errors found.
Looks for use of MAX() and MIN() macros that should be replaced with std::max() and std::min().
Looks for use of MAX () and MIN () macros that should be replaced with std :: max () and std :: min () .
def check_max_min_macros(clean_lines, line_number, file_state, error):
    """Looks for use of MAX() and MIN() macros that should be replaced with std::max() and std::min().

    Args:
      clean_lines: A CleansedLines instance containing the file.
      line_number: The number of the line to check.
      file_state: A _FileState instance which maintains information about
                  the state of things in the file.
      error: The function to call with any errors found.
    """

    # This check doesn't apply to C or Objective-C implementation files.
    if file_state.is_c_or_objective_c():
        return

    line = clean_lines.elided[line_number]  # Get rid of comments and strings.

    max_min_macros_search = search(r'\b(?P<max_min_macro>(MAX|MIN))\s*\(', line)
    if not max_min_macros_search:
        return

    max_min_macro = max_min_macros_search.group('max_min_macro')
    max_min_macro_lower = max_min_macro.lower()
    error(line_number, 'runtime/max_min_macros', 4,
          'Use std::%s() or std::%s<type>() instead of the %s() macro.'
          % (max_min_macro_lower, max_min_macro_lower, max_min_macro))
def check_max_min_macros ( clean_lines , line_number , file_state , error ) : # This check doesn't apply to C or Objective-C implementation files. if file_state . is_c_or_objective_c ( ) : return line = clean_lines . elided [ line_number ] # Get rid of comments and strings. max_min_macros_search = search ( r'\b(?P<max_min_macro>(MAX|MIN))\s*\(' , line ) if not max_min_macros_search : return max_min_macro = max_min_macros_search . group ( 'max_min_macro' ) max_min_macro_lower = max_min_macro . lower ( ) error ( line_number , 'runtime/max_min_macros' , 4 , 'Use std::%s() or std::%s<type>() instead of the %s() macro.' % ( max_min_macro_lower , max_min_macro_lower , max_min_macro ) )