From b6176cdf19d3e91c985e9673a24d79dcbe5d1a65 Mon Sep 17 00:00:00 2001 From: Jeremiah Leary Date: Sat, 13 May 2023 07:35:43 -0500 Subject: [PATCH] Issue#913: Fixing reporting of line length errors. (#936) --- vsg/rules/line_length.py | 2 +- vsg/tests/length/test_rule_001.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/vsg/rules/line_length.py b/vsg/rules/line_length.py index 1a3ecb62..a21163cc 100644 --- a/vsg/rules/line_length.py +++ b/vsg/rules/line_length.py @@ -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) diff --git a/vsg/tests/length/test_rule_001.py b/vsg/tests/length/test_rule_001.py index 69322733..6f40dcb9 100644 --- a/vsg/tests/length/test_rule_001.py +++ b/vsg/tests/length/test_rule_001.py @@ -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)