Skip to content

Commit

Permalink
Automatically append error code to title
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Suchow authored and suchow committed Sep 27, 2015
1 parent 59d6abd commit ac3df3d
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion proselint/checks/dfw_uncomparables.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
error_code: DFW200
source: David Foster Wallace
source_url: http://bit.ly/1qudVuC
title: DFW200: Comparing an uncomparable
title: Comparing an uncomparable
date: 2014-06-10 12:31:19
categories: writing
---
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/example_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
error_code: ERR100
source: Nobody
source_url: ???
title: ERR100: Firse line is always wrong.
title: Firse line is always wrong.
date: 2014-06-10 12:31:19
categories: writing
---
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/inprogress/wgd_cliches.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
error_code: WGD101
source: write-good
source_url: https://github.com/btford/write-good
title: WGD101: Cliches
title: Cliches
date: 2014-06-10 12:31:19
categories: writing
---
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/inprogress/wgd_lexical_illusions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
error_code: WGD200
source: write-good
source_url: https://github.com/btford/write-good
title: WGD200: Lexical illusion present
title: Lexical illusion present
date: 2014-06-10 12:31:19
categories: writing
---
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/inprogress/wgd_weasel_words.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
error_code: WGD200
source: write-good
source_url: https://github.com/btford/write-good
title: WGD100: Weasel words.
title: Weasel words.
date: 2014-06-10 12:31:19
categories: writing
---
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/strunk_white_eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
error_code: STW100
source: Strunk & White
source_url: ???
title: STW100: Use of greylisted words
title: Use of greylisted words
date: 2014-06-10 12:31:19
categories: writing
---
Expand Down
5 changes: 5 additions & 0 deletions scripts/generate_posts.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import ast
import datetime
import re


grandparent = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
checks_dir = os.path.join(grandparent, "proselint", "checks")
Expand All @@ -14,6 +16,9 @@ def is_check(fn):
if is_check(fn):
M = ast.parse(''.join(open(os.path.join(checks_dir, fn))))
docstring = ast.get_docstring(M)
error_code = re.search("error_code: (.*)\n", docstring).group(1)
head, sep, tail = docstring.partition("title: ")
docstring = head + sep + " " + error_code + ":" + tail[4:]

post_filename = os.path.join(
os.path.join(grandparent, "site", "_posts"),
Expand Down

0 comments on commit ac3df3d

Please sign in to comment.