def format(self, match, colored=False): formatstr = u"{0} {1}:{2}" if colored: return formatstr.format( colorize(u"[{0}]".format(match.rule.id), Color.error_code), colorize(self._format_path(match.filename), Color.filename), colorize(str(match.linenumber), Color.linenumber)) else: return formatstr.format(match.rule.id, self.format_path(match.filename), match.linenumber)
def format(self, match, colored=False): formatstr = u"{0}:{1}: [{2}] {3}" if colored: return formatstr.format( colorize(self._format_path(match.filename), Color.filename), colorize(str(match.linenumber), Color.linenumber), colorize(u"E{0}".format(match.rule.id), Color.error_code), colorize(u"{0}".format(match.message), Color.error_title)) else: return formatstr.format(self._format_path(match.filename), match.linenumber, "E" + match.rule.id, match.message)
def format(self, match, colored=False): formatstr = u"{0} {1}\n{2}:{3}\n{4}\n" _id = getattr(match.rule, 'id', '000') if colored: return formatstr.format( colorize(u"[{0}]".format(_id), Color.error_code), colorize(match.message, Color.error_title), colorize(self._format_path(match.filename), Color.filename), colorize(str(match.linenumber), Color.linenumber), colorize(u"{0}".format(match.line), Color.line)) else: return formatstr.format(_id, match.message, match.filename, match.linenumber, match.line)
def format(self, match: "MatchError", colored: bool = False) -> str: formatstr = u"{0}:{1}: [{2}] [{3}] {4}" filename = self._format_path(match.filename or "") linenumber = str(match.linenumber) rule_id = u"E{0}".format(match.rule.id) severity = match.rule.severity message = str(match.message) if colored: filename = colorize(filename, Color.filename) linenumber = colorize(linenumber, Color.linenumber) rule_id = colorize(rule_id, Color.error_code) severity = colorize(severity, Color.error_code) message = colorize(message, Color.error_title) return formatstr.format( filename, linenumber, rule_id, severity, message, )
def format(self, match, colored=False): formatstr = u"{0}:{1}: [{2}] [{3}] {4}" filename = self._format_path(match.filename) linenumber = str(match.linenumber) rule_id = u"E{0}".format(match.rule.id) severity = match.rule.severity message = str(match.message) if colored: filename = colorize(filename, 'blue') linenumber = colorize(linenumber, 'cyan') rule_id = colorize(rule_id, 'bright red') severity = colorize(severity, 'bright red') message = colorize(message, 'red') return formatstr.format( filename, linenumber, rule_id, severity, message, )