Lines Matching refs:self

460   def __init__(self):  argument
461 dict.__init__(self)
463 self._section = self._INITIAL_SECTION
465 self._last_header = ''
467 def CanonicalizeAlphabeticalOrder(self, header_path): argument
482 def IsInAlphabeticalOrder(self, header_path): argument
491 canonical_header = self.CanonicalizeAlphabeticalOrder(header_path)
492 if self._last_header > canonical_header:
494 self._last_header = canonical_header
497 def CheckNextIncludeOrder(self, header_type): argument
512 (self._TYPE_NAMES[header_type],
513 self._SECTION_NAMES[self._section]))
515 last_section = self._section
518 if self._section <= self._C_SECTION:
519 self._section = self._C_SECTION
521 self._last_header = ''
524 if self._section <= self._CPP_SECTION:
525 self._section = self._CPP_SECTION
527 self._last_header = ''
530 if self._section <= self._MY_H_SECTION:
531 self._section = self._MY_H_SECTION
533 self._section = self._OTHER_H_SECTION
535 if self._section <= self._MY_H_SECTION:
536 self._section = self._MY_H_SECTION
540 self._section = self._OTHER_H_SECTION
543 self._section = self._OTHER_H_SECTION
545 if last_section != self._section:
546 self._last_header = ''
554 def __init__(self): argument
555 self.verbose_level = 1 # global setting.
556 self.error_count = 0 # global count of reported errors
558 self.filters = _DEFAULT_FILTERS[:]
559 self.counting = 'total' # In what way are we counting errors?
560 self.errors_by_category = {} # string to int dict storing error counts
565 self.output_format = 'emacs'
567 def SetOutputFormat(self, output_format): argument
569 self.output_format = output_format
571 def SetVerboseLevel(self, level): argument
573 last_verbose_level = self.verbose_level
574 self.verbose_level = level
577 def SetCountingStyle(self, counting_style): argument
579 self.counting = counting_style
581 def SetFilters(self, filters): argument
596 self.filters = _DEFAULT_FILTERS[:]
600 self.filters.append(clean_filt)
601 for filt in self.filters:
606 def ResetErrorCounts(self): argument
608 self.error_count = 0
609 self.errors_by_category = {}
611 def IncrementErrorCount(self, category): argument
613 self.error_count += 1
614 if self.counting in ('toplevel', 'detailed'):
615 if self.counting != 'detailed':
617 if category not in self.errors_by_category:
618 self.errors_by_category[category] = 0
619 self.errors_by_category[category] += 1
621 def PrintErrorCounts(self): argument
623 for category, count in self.errors_by_category.iteritems():
626 sys.stderr.write('Total errors found: %d\n' % self.error_count)
680 def __init__(self): argument
681 self.in_a_function = False
682 self.lines_in_function = 0
683 self.current_function = ''
685 def Begin(self, function_name): argument
691 self.in_a_function = True
692 self.lines_in_function = 0
693 self.current_function = function_name
695 def Count(self): argument
697 if self.in_a_function:
698 self.lines_in_function += 1
700 def Check(self, error, filename, linenum): argument
709 if not self.in_a_function:
712 if Match(r'T(EST|est)', self.current_function):
713 base_trigger = self._TEST_TRIGGER
715 base_trigger = self._NORMAL_TRIGGER
718 if self.lines_in_function > trigger:
719 error_level = int(math.log(self.lines_in_function / base_trigger, 2))
727 self.current_function, self.lines_in_function, trigger))
729 def End(self): argument
731 self.in_a_function = False
746 def __init__(self, filename): argument
747 self._filename = filename
749 def FullName(self): argument
751 return os.path.abspath(self._filename).replace('\\', '/')
753 def RepositoryName(self): argument
763 fullname = self.FullName()
801 def Split(self): argument
811 googlename = self.RepositoryName()
815 def BaseName(self): argument
817 return self.Split()[1]
819 def Extension(self): argument
821 return self.Split()[2]
823 def NoExtension(self): argument
825 return '/'.join(self.Split()[0:2])
827 def IsSource(self): argument
829 return self.Extension()[1:] in ('c', 'cc', 'cpp', 'cxx')
1002 def __init__(self, lines): argument
1003 self.elided = []
1004 self.lines = []
1005 self.raw_lines = lines
1006 self.num_lines = len(lines)
1008 self.lines.append(CleanseComments(lines[linenum]))
1009 elided = self._CollapseStrings(lines[linenum])
1010 self.elided.append(CleanseComments(elided))
1012 def NumLines(self): argument
1014 return self.num_lines
1367 def __init__(self, seen_open_brace): argument
1368 self.seen_open_brace = seen_open_brace
1369 self.open_parentheses = 0
1370 self.inline_asm = _NO_ASM
1372 def CheckBegin(self, filename, clean_lines, linenum, error): argument
1387 def CheckEnd(self, filename, clean_lines, linenum, error): argument
1404 def __init__(self, name, class_or_struct, clean_lines, linenum): argument
1405 _BlockInfo.__init__(self, False)
1406 self.name = name
1407 self.starting_linenum = linenum
1408 self.is_derived = False
1410 self.access = 'public'
1412 self.access = 'private'
1419 self.last_line = 0
1425 self.last_line = i
1428 def CheckBegin(self, filename, clean_lines, linenum, error): argument
1431 self.is_derived = True
1437 def __init__(self, name, linenum): argument
1438 _BlockInfo.__init__(self, False)
1439 self.name = name or ''
1440 self.starting_linenum = linenum
1442 def CheckEnd(self, filename, clean_lines, linenum, error): argument
1457 if (linenum - self.starting_linenum < 10
1473 if self.name:
1475 if not Match((r'};*\s*(//|/\*).*\bnamespace\s+' + re.escape(self.name) +
1480 self.name)
1491 def __init__(self, stack_before_if): argument
1493 self.stack_before_if = stack_before_if
1496 self.stack_before_else = []
1499 self.seen_else = False
1505 def __init__(self): argument
1512 self.stack = []
1515 self.pp_stack = []
1517 def SeenOpenBrace(self): argument
1524 return (not self.stack) or self.stack[-1].seen_open_brace
1526 def InNamespaceBody(self): argument
1532 return self.stack and isinstance(self.stack[-1], _NamespaceInfo)
1534 def UpdatePreprocessor(self, line): argument
1559 self.pp_stack.append(_PreprocessorInfo(copy.deepcopy(self.stack)))
1562 if self.pp_stack:
1563 if not self.pp_stack[-1].seen_else:
1567 self.pp_stack[-1].seen_else = True
1568 self.pp_stack[-1].stack_before_else = copy.deepcopy(self.stack)
1571 self.stack = copy.deepcopy(self.pp_stack[-1].stack_before_if)
1577 if self.pp_stack:
1581 if self.pp_stack[-1].seen_else:
1584 self.stack = self.pp_stack[-1].stack_before_else
1586 self.pp_stack.pop()
1591 def Update(self, filename, clean_lines, linenum, error): argument
1603 self.UpdatePreprocessor(line)
1607 if self.stack:
1608 inner_block = self.stack[-1]
1641 self.stack.append(new_namespace)
1674 (not self.stack or self.stack[-1].open_parentheses == 0)):
1675 self.stack.append(_ClassInfo(
1682 if not self.SeenOpenBrace():
1683 self.stack[-1].CheckBegin(filename, clean_lines, linenum, error)
1686 if self.stack and isinstance(self.stack[-1], _ClassInfo):
1689 self.stack[-1].access = access_match.group(1)
1703 if not self.SeenOpenBrace():
1704 self.stack[-1].seen_open_brace = True
1706 self.stack.append(_BlockInfo(True))
1708 self.stack[-1].inline_asm = _BLOCK_ASM
1718 if not self.SeenOpenBrace():
1719 self.stack.pop()
1722 if self.stack:
1723 self.stack[-1].CheckEnd(filename, clean_lines, linenum, error)
1724 self.stack.pop()
1727 def InnermostClass(self): argument
1733 for i in range(len(self.stack), 0, -1):
1734 classinfo = self.stack[i - 1]
1739 def CheckClassFinished(self, filename, error): argument
1750 for obj in self.stack: