Debian Codegraph @

proselint/checks/misc/but.py

raw
1 """Don't start a paragraph with 'But'.
2
3 ---
4 layout:
5 source: Justin Jungé
6 source_url:
7 title:
8 date: 2016-03-10 12:31:19
9 categories: writing
10 ---
11
12 Paragraphs should not start with certain bad words.
13
14 """
15 from proselint.tools import existence_check, memoize
16
17
18 @memoize
19 def check(text):
20 """Do not start a paragraph with a 'But'."""
21 err = "misc.but"
22 msg = "No paragraph should start with a 'But'."
23 regex = r"(^|([\n\r]+))(\s*)But"
24
25 return existence_check(text, [regex], err, msg, ignore_case=False)