Slashdot Log In
Programmer's Language-Aware Spell Checker?
Posted by
kdawson
on Tue Sep 04, 2007 05:12 AM
from the hands-off-my-camelcase dept.
from the hands-off-my-camelcase dept.
Jerry Asher writes "Not all of my coworkers are careful about spelling errors. Sometimes this causes real embarrassment as spelling errors creep into software interfaces. Does anyone know of spell checkers for programming languages? I don't want a text spell checker, I want a programming-language-aware spell checker. A spell checker that I can pass all of my code through and will flag spelling errors in function names, variable names, and comments, but will ignore language keywords, language constructs and expressions, and various programming styles (camel code, or underscores, or...). I want a spell checker that knows that void *functionSigniture(char *myRoutine) contains one spelling error. Does anyone have such a thing for Java or C++? Are there any Eclipse plugins that do this?"
Related Stories
This discussion has been archived.
No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Full
Abbreviated
Hidden
Loading... please wait.
Eclipse WTP 3.3 Europa seems to do this.. almost. (Score:5, Informative)
Man Dies Waiting for Eclipse to Launch (Score:5, Funny)
A software engineer in San Jose, CA was found dead at his desk yesterday, apparently having died while waiting for his Java editing program, Eclipse, to finish its boot process. Coworkers say the engineer came in that morning vowing to "get Eclipse working on his box or die trying." The last thing anyone heard him say aloud was the cryptic comment: "I see the splash screen is appropriately blue." Nobody knows what he meant. The man was then thought to have fallen asleep, but hours later it was discovered that the engineer had died suddenly of apparent natural causes. The forensics team's investigation that evening was reportedly interrupted unexpectedly when the dead man's Eclipse program suddenly finished launching. The team tried to interact with it to see if they could find clues about the man's death, but the program was unresponsive and the machine ultimately had to be rebooted. At this time, the police commissioner says there is no evidence of foul play, and they currently believe the man simply died of either boredom or frustration.
Parent
Re:Man Dies Waiting for Eclipse to Launch (Score:5, Informative)
Parent
Re:Eclipse WTP 3.3 Europa seems to do this.. almos (Score:5, Funny)
"You appear to be creating an infinite loop. Would you like me to increment your counter variable?"
"You appear to be writing a virus, would you like a list of the latest Windows Vista sploits?"
Parent
Re:Eclipse WTP 3.3 Europa seems to do this.. almos (Score:5, Funny)
Parent
ego != good_open_minded_programmer (Score:5, Insightful)
You clearly fail to see a programmer can also create their own function names, as well as use other peoples functions. So you prove you are a very inexperienced programmer, (and close minded), which adds weight to the idea you are either young or just arrogant. Also your very apparent need to show hostility, shows a degree of insecurity, where you are over compensating, by verbally hitting out at others, in an attempt to appear to be more knowledgeable than you really are.
The easiest way to become a better programmer, is to be more open minded. So far you have failed to demonstrate this.
As a side note, (back in the DOS days of programming), I found the the spell checker in Multiedit very useful (especially when having to work very late at night, after the coffee stopped working!
Parent
Re:ego != good_open_minded_programmer (Score:5, Funny)
We're the do-anything team that specialises in imaginging new ways for you to reach your audience.
The word "pwned" doesn't spell check correctly either, but it is applicable.
Parent
Re:What the fuck is the OP on? (Score:5, Funny)
Parent
How about eyeball Mk 1? (Score:5, Funny)
Re:How about eyeball Mk 1? (Score:5, Insightful)
Parent
Re:How about eyeball Mk 1? (Score:5, Funny)
Parent
Re:How about eyeball Mk 1? (Score:5, Insightful)
Parent
Sounds like a good idea (Score:5, Interesting)
It's a good question ... (Score:5, Interesting)
People here making fun of his request and saying that this should be set in stone in design documents, or be checked in peer code reviews are obviously not working in a run-of-the-mill software company where there's neither the inclination nor the time to do everything the formal way. Also, I have to see the first design document that correctly enumerates all the requirements for the software, let alone all the names for the variables to be used.
Re:It's a good question ... (Score:5, Informative)
As a non-native English speaker, working in a non-native english speaking team (mainly french speaking people) it is a real problem. The biggest problem happens when you search something and don't find it because you wrote it right and your coworker wrote it wrong. (Or the inverse, I don't claim to be perfect in English)
Sure, you might say, "Write your code in French", but that's not a solution. My mother tongue is Dutch, we have a German coworker, and you never know if the next guy will be Italian. There is also this team that has to maintain code written by Spanish people.... in Spanish.... and they don't know Spanish. Fun times, if you like to hear them curse....
In multilingual environments this problem increases drastically.
Parent
How about this (Score:5, Interesting)
Enough rant. How about this:
perl -ne "s/([a-z])([A-Z])/$1 $2/g; tr/A-Za-z/
That will give a list of unique words in your source code (use find and xargs to scan the whole source tree). Then you can run that list of words through an ordinary spellchecker such as ispell. Unfortunately when you find a mistake you have to go back and grep for it to find where it occurs. You would also need a personal dictionary for things that are not English words but nonetheless appear in code.
I would probably keep the private word list containing things like 'foreach' and 'const' with the program source code, and have a makefile target 'make spellcheck' that runs a command like the above and then prints out all words found that are not in
find . -type f -name '*.c' | xargs perl -ne "s/([a-z])([A-Z])/$1 $2/g; tr/A-Za-z/
sort -u private_word_list
diff -u allowed_words found_words | grep -E '^[+][^+]'
The private word list can be kept under version control and checked in whenever you add a new non-English word like 'Frobule' to your source code.
Adding filenames and line numbers to the output is left as an exercise for the reader. You might also want to change the perl command to ignore words with length < 5.
FxCop (Score:5, Informative)
http://www.gotdotnet.com/Team/FxCop/ [gotdotnet.com]
Annoying perhaps but (Score:5, Interesting)
HRESULT MFGetService(
IUnknown* punkObject,
REFGUID guidService,
REFIID riid,
LPVOID* ppvObject
);
You'll probably just end up spending all your day removing false positives.
Ken Thompson and creat() (Score:5, Interesting)
"If I had to do it over again? Hmm... I guess I'd spell 'creat' with an 'e'."
Re:How about the Built-in OS X spell checker? (Score:5, Funny)
We're talking about programming, friend.
Parent
Re:May I suggest.... (Score:5, Insightful)
Responses like this entirely miss the point of the question. Same with the "just review your code" responses. It's not a matter of making the language more readable. It's a matter of making the code more usable. Certainly, correct spelling is pointless without other elements of good code practice. However, bad spelling can add a lot of frustration.
I joined a project which already had a few misspelled class names. I'm a fast typer and often I've typed out more of a filename than is spelled correctly before hitting tab to complete the name. Needless to say, I've been trained to hit tab earlier for a few choice files. But it's certainly been an irritation. Similarly, I've been confounded more than once when a function or variable couldn't be found by the compiler, only to realize that I'd spelled a word correctly rather than how the actual name was spelled.
We choose to use English words for our class, function, and variable names for a reason. That reason is mostly defeated by misspelling the English word. A dictionary is a great idea, even for coding languages that don't "read like English".
Parent
Re:May I suggest.... (Score:4, Insightful)
Parent
Re:simple (Score:5, Insightful)
Parent
Re:Visual Assist (Score:5, Funny)
Parent
Re:the problem is really prevalent (Score:5, Funny)
Parent