Issue#913: Fixing reporting of line length errors. (#936)
This commit is contained in:
parent
39c27ec83a
commit
b6176cdf19
|
|
@ -23,12 +23,12 @@ class line_length(length.Rule):
|
|||
length.Rule.__init__(self, name=name, identifier=identifier)
|
||||
self.disable = False
|
||||
self.length = 120
|
||||
self.solution = 'Reduce line to less than ' + str(self.length) + ' characters'
|
||||
|
||||
def _get_tokens_of_interest(self, oFile):
|
||||
return oFile.get_lines_with_length_that_exceed_column(self.length)
|
||||
|
||||
def _analyze(self, lToi):
|
||||
for oToi in lToi:
|
||||
self.solution = 'Reduce line to less than ' + str(self.length) + ' characters'
|
||||
oViolation = violation.New(oToi.get_line_number(), oToi, self.solution)
|
||||
self.add_violation(oViolation)
|
||||
|
|
|
|||
|
|
@ -37,3 +37,5 @@ class test_length_rule(unittest.TestCase):
|
|||
oRule.analyze(self.oFile)
|
||||
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
|
||||
|
||||
oViolation = oRule.violations[0]
|
||||
self.assertEqual('Reduce line to less than 125 characters', oViolation.sSolution)
|
||||
|
|
|
|||
Loading…
Reference in New Issue