def test(self):
     msg = None
     for note in range(-1, 11):
         note_msg = config.get_note_message(note)
         self.assertNotEqual(msg, note_msg)
         msg = note_msg
     if optimized:
         self.assertRaises(AssertionError, config.get_note_message, 11)
Example #2
0
 def report_evaluation(self, sect, stats, old_stats):
     """make the global evaluation report"""
     # check with at least check 1 statements (usually 0 when there is a
     # syntax error preventing pylint from further processing)
     if stats['statement'] == 0:
         raise EmptyReport()
     # get a global note for the code
     evaluation = self.config.evaluation
     try:
         note = eval(evaluation, {}, self.stats)
     except Exception as ex:
         msg = 'An exception occurred while rating: %s' % ex
     else:
         stats['global_note'] = note
         msg = 'Your code has been rated at %.2f/10' % note
         if 'global_note' in old_stats:
             msg += ' (previous run: %.2f/10)' % old_stats['global_note']
         if self.config.comment:
             msg = '%s\n%s' % (msg, config.get_note_message(note))
     sect.append(Text(msg))
Example #3
0
 def report_evaluation(self, sect, stats, old_stats):
     """make the global evaluation report"""
     # check with at least check 1 statements (usually 0 when there is a
     # syntax error preventing pylint from further processing)
     if stats['statement'] == 0:
         raise EmptyReport()
     # get a global note for the code
     evaluation = self.config.evaluation
     try:
         note = eval(evaluation, {}, self.stats)
     except Exception as ex:
         msg = 'An exception occurred while rating: %s' % ex
     else:
         stats['global_note'] = note
         msg = 'Your code has been rated at %.2f/10' % note
         if 'global_note' in old_stats:
             msg += ' (previous run: %.2f/10)' % old_stats['global_note']
         if self.config.comment:
             msg = '%s\n%s' % (msg, config.get_note_message(note))
     sect.append(Text(msg))
Example #4
0
        if stats['statement'] == 0:
            raise EmptyReport()
        # get a global note for the code
        evaluation = self.config.evaluation
        try:
            note = eval(evaluation, {}, self.stats)
        except Exception, ex:
            msg = 'An exception occurred while rating: %s' % ex
        else:
            stats['global_note'] = note
            msg = 'Your code has been rated at %.2f/10' % note
            pnote = previous_stats.get('global_note')
            if pnote is not None:
                msg += ' (previous run: %.2f/10, %+.2f)' % (pnote, note - pnote)
            if self.config.comment:
                msg = '%s\n%s' % (msg, config.get_note_message(note))
        sect.append(Text(msg))

# some reporting functions ####################################################

def report_total_messages_stats(sect, stats, previous_stats):
    """make total errors / warnings report"""
    lines = ['type', 'number', 'previous', 'difference']
    lines += table_lines_from_stats(stats, previous_stats,
                                    ('convention', 'refactor',
                                     'warning', 'error'))
    sect.append(Table(children=lines, cols=4, rheaders=1))

def report_messages_stats(sect, stats, _):
    """make messages type report"""
    if not stats['by_msg']:
Example #5
0
            raise EmptyReport()
        # get a global note for the code
        evaluation = self.config.evaluation
        try:
            note = eval(evaluation, {}, self.stats)
        except Exception, ex:
            msg = 'An exception occurred while rating: %s' % ex
        else:
            stats['global_note'] = note
            msg = 'Your code has been rated at %.2f/10' % note
            pnote = previous_stats.get('global_note')
            if pnote is not None:
                msg += ' (previous run: %.2f/10, %+.2f)' % (pnote,
                                                            note - pnote)
            if self.config.comment:
                msg = '%s\n%s' % (msg, config.get_note_message(note))
        sect.append(Text(msg))


# some reporting functions ####################################################


def report_total_messages_stats(sect, stats, previous_stats):
    """make total errors / warnings report"""
    lines = ['type', 'number', 'previous', 'difference']
    lines += table_lines_from_stats(
        stats, previous_stats, ('convention', 'refactor', 'warning', 'error'))
    sect.append(Table(children=lines, cols=4, rheaders=1))


def report_messages_stats(sect, stats, _):
 def test(self):
     msg = None
     for note in range(-1, 11):
         note_msg = config.get_note_message(note)
         self.assertNotEqual(msg, note_msg)
         msg = note_msg
Example #7
0
        # syntax error preventing pylint from further processing)
        if stats["statement"] == 0:
            raise EmptyReport()
        # get a global note for the code
        evaluation = self.config.evaluation
        try:
            note = eval(evaluation, {}, self.stats)
        except Exception, ex:
            msg = "An exception occurred while rating: %s" % ex
        else:
            stats["global_note"] = note
            msg = "Your code has been rated at %.2f/10" % note
            if "global_note" in previous_stats:
                msg += " (previous run: %.2f/10)" % previous_stats["global_note"]
            if self.config.comment:
                msg = "%s\n%s" % (msg, config.get_note_message(note))
        sect.append(Text(msg))


# some reporting functions ####################################################


def report_total_messages_stats(sect, stats, previous_stats):
    """make total errors / warnings report"""
    lines = ["type", "number", "previous", "difference"]
    lines += table_lines_from_stats(stats, previous_stats, ("convention", "refactor", "warning", "error"))
    sect.append(Table(children=lines, cols=4, rheaders=1))


def report_messages_stats(sect, stats, _):
    """make messages type report"""
Example #8
0
 def test(self):
     msg = None
     for note in range(-1, 11):
         note_msg = config.get_note_message(note)
         self.assertNotEqual(msg, note_msg)
         msg = note_msg