Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Greetings wise brothers, I seek your wisdom in the matter of how fat fingers, mistakes and carelessness can corrupt our beautiful code.

I am looking for a way to spellcheck perl source code. If it can be done reliably enough then I would like to add it as a pre-commit hook to our source control, but even if that is not possible, it would be good to warn developers so that they can change things.

I have done an internet search and found modules such as Perl::Critic::Policy::Documentation::PodSpelling and Test::Spelling, which look useful, but they only check the spelling of POD documents not the rest of the source code.

What I would really like to do is to intelligently check the spelling on variable and method names as well. So that if someone names a scalar as $new_varable or $newVarable it will find the variable in the source, intelligently split the name on underscores and case changes, and spellcheck the parts. (And report that varable is wrong (it should have an i). I don't need a spellchecker to offer replacements, as my editor can usually do that once I isolate the error, but I do need a better way to find error.

The reason I am after such a tool is that developers will often search for methods or variables by name. So for example, a developer might be looking for the function to increase a variable, and miss it because it is named increease_varable()

Any suggestions? do such tools exist? I know that it is impossible to write a perfect tool of this nature, because only perl can parse perl, but something that does 90% would be a great deal better than nothing. Looking at perldebguts, I was wondering if you could hook the debugger to return all the names (variables, functions, globs etc) declared in a source file, and then parse them for possible errors.


In reply to Check spelling in perl source code. by chrestomanci

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-25 17:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found