From 9f9768e48d51e7d3e0a5feebcf1402447c40fd95 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 10 Oct 2017 16:59:22 +0100 Subject: [PATCH 1/2] Don't fail by default There's value in not always failing on a spelling - for example, if you want to use the tool merely as a guideline rather than a strict check. We could add a spelling-specific option to make failures optional, but we already have a similar option available - Sphinx's 'warning-is-error' option. Stop setting the builder status and instead emit a warning on build failures. This is breaking change so we probably want to bump the MAJOR version. Signed-off-by: Stephen Finucane --- sphinxcontrib/spelling/builder.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sphinxcontrib/spelling/builder.py b/sphinxcontrib/spelling/builder.py index 27a9f287..329b574c 100644 --- a/sphinxcontrib/spelling/builder.py +++ b/sphinxcontrib/spelling/builder.py @@ -32,6 +32,7 @@ class SpellingBuilder(Builder): def init(self): self.docnames = [] self.document_data = [] + self.misspelling_count = 0 # Initialize the per-document filters if not hasattr(self.env, 'spelling_document_filters'): @@ -136,10 +137,7 @@ def write_doc(self, docname, doctree): lineno, word, self.format_suggestions(suggestions), )) - - # We found at least one bad spelling, so set the status - # code for the app to a value that indicates an error. - self.app.statuscode = 1 + self.misspelling_count += 1 self.checker.pop_filters() return @@ -148,4 +146,6 @@ def finish(self): self.output.close() self.info('Spelling checker messages written to %s' % self.output_filename) + if self.misspelling_count: + self.warning('Found %d misspelled words' % self.misspelling_count) return From 58a0c44c41cda2bf9f2ad4a11cba8091c2a766cf Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 10 Oct 2017 17:01:44 +0100 Subject: [PATCH 2/2] trivial: Remove nosestest.cfg This was missed in a8bcb487ebbf71fa03cdd518265d06a5dafe2f0c. Signed-off-by: Stephen Finucane --- nosetest.cfg | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 nosetest.cfg diff --git a/nosetest.cfg b/nosetest.cfg deleted file mode 100644 index 1afd7098..00000000 --- a/nosetest.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[nosetests] -detailed-errors = 1