Skip to content
Snippets Groups Projects
Commit e0b03f68 authored by Henning Glawe's avatar Henning Glawe
Browse files

clarify annotate: split classification and representation code

parent ab347dda
No related branches found
No related tags found
No related merge requests found
......@@ -36,26 +36,23 @@ class Annotator(object):
def annotate(self, match, line, matcher, targetStartEnd):
if not self.annotateFile:
return 1
matchlabel = ''
# classify match
full = match and match.start() == 0 and match.end() == len(line)
ignore = not match and self.coverageIgnore.match(line)
# setup match label
if match:
matchlabel = ('' if full else 'p_') + ('end' if targetStartEnd else 'start')
else:
matchlabel = 'ign' if ignore else 'no'
# highlight line
if match:
# we matched
highlighted = self.matchHighlighter.highlight(match, line)
if not match.start() == 0 and match.end() == len(line):
# we matched only partially
matchlabel = 'p_'
if targetStartEnd == 0:
matchlabel += 'start'
else:
matchlabel += 'end'
elif ignore:
highlighted = ANSI.FG_BLUE + self.matchHighlighter.with_ANSI_RESET(line)
else:
if self.coverageIgnore.match(line):
matchlabel = 'ign'
highlighted = (
ANSI.FG_BLUE + self.matchHighlighter.with_ANSI_RESET(line))
else:
matchlabel = 'no'
highlighted = line
highlighted = line
# set matcher name
if matcher.name:
name=matcher.name[-self._formatNameWidth:]
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment