Code Duplication    Length = 34-34 lines in 2 locations

core/build-support/cpplint.py 1 location

@@ 3593-3626 (lines=34) @@
3590
            match.group(1))
3591
3592
3593
def CheckCommaSpacing(filename, clean_lines, linenum, error):
3594
  """Checks for horizontal spacing near commas and semicolons.
3595
3596
  Args:
3597
    filename: The name of the current file.
3598
    clean_lines: A CleansedLines instance containing the file.
3599
    linenum: The number of the line to check.
3600
    error: The function to call with any errors found.
3601
  """
3602
  raw = clean_lines.lines_without_raw_strings
3603
  line = clean_lines.elided[linenum]
3604
3605
  # You should always have a space after a comma (either as fn arg or operator)
3606
  #
3607
  # This does not apply when the non-space character following the
3608
  # comma is another comma, since the only time when that happens is
3609
  # for empty macro arguments.
3610
  #
3611
  # We run this check in two passes: first pass on elided lines to
3612
  # verify that lines contain missing whitespaces, second pass on raw
3613
  # lines to confirm that those missing whitespaces are not due to
3614
  # elided comments.
3615
  if (Search(r',[^,\s]', ReplaceAll(r'\boperator\s*,\s*\(', 'F(', line)) and
3616
      Search(r',[^,\s]', raw[linenum])):
3617
    error(filename, linenum, 'whitespace/comma', 3,
3618
          'Missing space after ,')
3619
3620
  # You should always have a space after a semicolon
3621
  # except for few corner cases
3622
  # TODO(unknown): clarify if 'if (1) { return 1;}' is requires one more
3623
  # space after ;
3624
  if Search(r';[^\s};\\)/]', line):
3625
    error(filename, linenum, 'whitespace/semicolon', 3,
3626
          'Missing space after ;')
3627
3628
3629
def _IsType(clean_lines, nesting_state, expr):

sdk/build-support/cpplint.py 1 location

@@ 3593-3626 (lines=34) @@
3590
            match.group(1))
3591
3592
3593
def CheckCommaSpacing(filename, clean_lines, linenum, error):
3594
  """Checks for horizontal spacing near commas and semicolons.
3595
3596
  Args:
3597
    filename: The name of the current file.
3598
    clean_lines: A CleansedLines instance containing the file.
3599
    linenum: The number of the line to check.
3600
    error: The function to call with any errors found.
3601
  """
3602
  raw = clean_lines.lines_without_raw_strings
3603
  line = clean_lines.elided[linenum]
3604
3605
  # You should always have a space after a comma (either as fn arg or operator)
3606
  #
3607
  # This does not apply when the non-space character following the
3608
  # comma is another comma, since the only time when that happens is
3609
  # for empty macro arguments.
3610
  #
3611
  # We run this check in two passes: first pass on elided lines to
3612
  # verify that lines contain missing whitespaces, second pass on raw
3613
  # lines to confirm that those missing whitespaces are not due to
3614
  # elided comments.
3615
  if (Search(r',[^,\s]', ReplaceAll(r'\boperator\s*,\s*\(', 'F(', line)) and
3616
      Search(r',[^,\s]', raw[linenum])):
3617
    error(filename, linenum, 'whitespace/comma', 3,
3618
          'Missing space after ,')
3619
3620
  # You should always have a space after a semicolon
3621
  # except for few corner cases
3622
  # TODO(unknown): clarify if 'if (1) { return 1;}' is requires one more
3623
  # space after ;
3624
  if Search(r';[^\s};\\)/]', line):
3625
    error(filename, linenum, 'whitespace/semicolon', 3,
3626
          'Missing space after ;')
3627
3628
3629
def _IsType(clean_lines, nesting_state, expr):