Issue#913: Fixing reporting of line length errors. (#936)

This commit is contained in:
Jeremiah Leary 2023-05-13 07:35:43 -05:00 committed by GitHub
parent 39c27ec83a
commit b6176cdf19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -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)

View File

@ -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)