Skip to content

Commit 71f6bc5

Browse files
committed
MarkdownBear: Improve result message
Improves the result message by modifying the regex and ignoring the non-crucial output obtained from the linter.
1 parent d83fe5f commit 71f6bc5

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

bears/markdown/MarkdownBear.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class MarkdownBear:
2929

3030
_output_regex = re.compile(
3131
r'\s*(?P<line>\d+):(?P<column>\d+)'
32-
r'\s*(?P<severity>warning)\s*(?P<message>.*)')
32+
r'\s*(?P<severity>warning)\s*(?P<message>.+?)(?: .*|\n|$)')
3333

3434
@staticmethod
3535
@deprecate_settings(bullets='markdown_bullets',

tests/markdown/MarkdownBearTest.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ def test_invalid_message(self):
6262
with prepare_file(content, None) as (file, fname):
6363
with execute_bear(self.uut, fname, file) as results:
6464
self.assertEqual(results[0].message,
65-
'Line must be at most 10 characters'
66-
' maximum-line-length remark-lint')
65+
'Line must be at most 10 characters')
6766
self.assertEqual(results[0].severity, RESULT_SEVERITY.NORMAL)
6867

6968
def test_invalid_link(self):
@@ -72,9 +71,7 @@ def test_invalid_link(self):
7271
with prepare_file(content, None) as (file, fname):
7372
with execute_bear(self.uut, fname, file) as results:
7473
self.assertEqual(results[0].message,
75-
'Link to unknown heading: `world`'
76-
' remark-validate-links '
77-
'remark-validate-links')
74+
'Link to unknown heading: `world`')
7875
self.assertEqual(results[0].severity, RESULT_SEVERITY.NORMAL)
7976

8077
def test_valid_link(self):

0 commit comments

Comments
 (0)