-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add spelling_warning configuration option #116
Conversation
msg_parts.append(self.format_suggestions(suggestions)) | ||
msg_parts.append(context_line) | ||
msg = ':'.join(msg_parts) | ||
logger.info(msg) | ||
if self.config.spelling_warning: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be less surprising to users if we have a consistent log format and only change the level of the log message based on the option. Does logger.info() accept the location argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I updated the PR. It makes the code simpler, too.
Here is an example with warning and -q. badlink is there to show what other warnings looks like:
rscohn2@rscohn1-MOBL:test$ sphinx-build -M spelling "source" "build" -q
/home/rscohn2/local/Projects/doc/test/source/index.rst:11: WARNING: Unknown target name: "badlink".
/home/rscohn2/local/Projects/doc/test/source/index.rst:9: WARNING: Spell check: sntence: Misspelling in a sntence.
WARNING: Found 1 misspelled words
rscohn2@rscohn1-MOBL:test$
Here is info and no -q:
rscohn2@rscohn1-MOBL:test$ sphinx-build -M spelling "source" "build"
Running Sphinx v3.3.0
Initializing Spelling Checker 7.0.3.dev2
making output directory... done
Ignoring wiki words
Ignoring acronyms
Ignoring Python builtins
Ignoring importable module names
Ignoring contributor names
Looking for custom word list in /home/rscohn2/local/Projects/doc/test/source/spelling_wordlist.txt
Scanning contributors
building [mo]: targets for 0 po files that are out of date
building [spelling]: all documents
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index/home/rscohn2/local/Projects/doc/test/source/index.rst:11: WARNING: Unknown target name: "badlink".
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index
/home/rscohn2/local/Projects/doc/test/source/index.rst:9: Spell check: sntence: Misspelling in a sntence.
Writing /home/rscohn2/local/Projects/doc/test/build/spelling/index.spellingWARNING: Found 1 misspelled words
build succeeded, 2 warnings.
rscohn2@rscohn1-MOBL:test$
Thanks! I'll work on a release to include this new feature soon. |
Thanks for sharing your great tool.
…On Thu, Nov 5, 2020 at 8:53 AM Doug Hellmann ***@***.***> wrote:
Thanks! I'll work on a release to include this new feature soon.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#116 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOY2WUGVLWLILEMT73A5YLSOKU4NANCNFSM4TK2LDYA>
.
|
I have released this in https://pypi.org/project/sphinxcontrib-spelling/7.1.0/ |
Resolves #108
Adds a config option: spelling_warning that will emit misspellings as sphinx warning instead of info message. The sphinx warning format is better suited for IDE's that no how to parse error/warnings and automatically navigate to the file/line. Also, you can invoke sphinx with -q and still see warnings.