-
-
reviewboard/diffviewer/diffutils.py (Diff revision 1) There should be a blank line before this import. Imports are in three groups, each separated by a blank line: 1) Python-provided modules, 2) Third-party modules, 3) Project modules.
-
-
reviewboard/diffviewer/diffutils.py (Diff revision 1) Might be nicer to import token, and use token.String, etc.
-
-
reviewboard/diffviewer/diffutils.py (Diff revision 1) Since our constructor doesn't do anything, we can actually leave it out.
-
reviewboard/diffviewer/diffutils.py (Diff revision 1) Spaces after each "," Also, functions should always be lowercase, with '_' between words. So, check_line.
-
-
-
-
-
-
reviewboard/diffviewer/diffutils.py (Diff revision 1) We should probably define a new token type: SpellingError. Then we can highlight that separately. I think you can do this with: from pygments import token ... SpellingError = Token.SpellingError token.STANDARD_TYPES[SpellingError] = 'spellerr' I haven't tried that, but it might work. We'd need a CSS rule for it, though, but that's easy.
-
-
-
-
-
Highlight Spell Errors for Spell Checking
Review Request #2122 — Created Feb. 12, 2011 and discarded
Check lines with token type as "String" or "Comment" for spell errors, using pyaspell. Highlight words with spell errors, using pygments.
-
This looks awesome :) I'm so excited about this. A few things to fix up. Only one of them is a tough problem, the rest are easy changes. I'll give the localization thing below some thought... This must be a solved problem.
-
-
reviewboard/diffviewer/filters.py (Diff revision 2) Shouldn't need this, since it'll fall back to the parent __init__.
-
reviewboard/diffviewer/filters.py (Diff revision 2) First line, immediately following the """, should contain a one-line summary, followed by a blank line, followed by a description.
-
reviewboard/diffviewer/filters.py (Diff revision 2) So this is an interesting thing I didn't consider. We're defaulting to "en", which probably isn't sufficient for all cases. Imagine a Japanese or French developer putting up code and seeing spelling errors everywhere. We'll need to figure out a solution for this. Tricky.
-
reviewboard/diffviewer/filters.py (Diff revision 2) Extra blank line at the end of the file should be removed.
-
reviewboard/htdocs/media/rb/css/diffviewer.css (Diff revision 2) I'd say probably just .spellerr. Also, it should go in syntax.css.
-
-
Oh, also, you'll need to add pyaspell to the dependency list in setup.py. Figure out what the latest version is and do: pyaspell>=the_version (assuming 'pyaspell' is what you easy_install).
DO
Change Summary:
I used "apt-get install aspell" to install aspell while easy_install doesn't seem to have that. pyaspell.py is like the python wrapper of the library. I'm not sure if it is appropriate to put it here.
Diff: |
Revision 4 (+416 -1) |
---|
-
-
reviewboard/diffviewer/diffutils.py (Diff revision 6) This doesn't really fit in the block, with regards to the try/except and comment. Since you're providing spellerror yourself, I'd just pull this line out of the block: lexer.add_filter('spellerror') try: # This is only available in 0.7 and higher lexer.add_filter('codetagify') except AttributeError: pass
-
reviewboard/diffviewer/filters.py (Diff revision 6) Remove this line (enchant and pygments are both "3rd party" modules and go in the same block of imports).
-
-
reviewboard/diffviewer/filters.py (Diff revision 6) Python lets you do this in one line via a "list comprehension" spell_errors = [err.word for err in spell_checker]
-
reviewboard/diffviewer/filters.py (Diff revision 6) Since this is both fetching a tuple and returning that same tuple, you can just iterate over a single value without unpacking it: for val in self.check_line(ttype, value): yield val
DO
Change Summary:
Time test with two large diffs. http://reviewboardstudents.wordpress.com/2011/02/21/spell-check-highlight/
Diff: |
Revision 7 (+54 -1) |
---|