I was looking for a program like lint in C and came across nitpick. I installed the gem but am not sure where to go from there. With lint one ran it from the command prompt with the file name. I don't know how to do this with gems. If I try to run it like lint I get over a dozen lines of error messages and no output.
ripple:~/$ sudo gem install nitpick
Password:
Successfully installed trollop-1.14
Successfully installed nitpick-1.0.2
2 gems installed
Installing ri documentation for trollop-1.14...
Installing ri documentation for nitpick-1.0.2...
Installing RDoc documentation for trollop-1.14...
Installing RDoc documentation for nitpick-1.0.2...
ripple:~/$ which nitpick
/usr/bin/nitpick
ripple:~/$ nitpick --help
Nitpick is a lint-like static code analyzer for Ruby.
Usage: `nitpick [(--only str | --except str)*|-h] file1.rb file2.rb`
By default, nitpick will analyze *all* loaded code. To reduce the noise:
--only, -o <s>: Nitpick only classes/modules that match this string.
--except, -e <s>: Don't nitpick classes/modules that match this string.
--help, -h: Show this message
ripple:~/$
Are you sure your installation ran all the way through?
···
On Mon, Sep 28, 2009 at 9:25 PM, Michael W. Ryder <_mwryder@worldnet.att.net> wrote:
I was looking for a program like lint in C and came across nitpick. I
installed the gem but am not sure where to go from there. With lint one
ran it from the command prompt with the file name. I don't know how to do
this with gems. If I try to run it like lint I get over a dozen lines of
error messages and no output.
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan
Hassan Schroeder wrote:
I was looking for a program like lint in C and came across nitpick. I
installed the gem but am not sure where to go from there. With lint one
ran it from the command prompt with the file name. I don't know how to do
this with gems. If I try to run it like lint I get over a dozen lines of
error messages and no output.ripple:~/$ sudo gem install nitpick
Password:
Successfully installed trollop-1.14
Successfully installed nitpick-1.0.2
2 gems installed
Installing ri documentation for trollop-1.14...
Installing ri documentation for nitpick-1.0.2...
Installing RDoc documentation for trollop-1.14...
Installing RDoc documentation for nitpick-1.0.2...
ripple:~/$ which nitpick
/usr/bin/nitpick
ripple:~/$ nitpick --help
Nitpick is a lint-like static code analyzer for Ruby.Usage: `nitpick [(--only str | --except str)*|-h] file1.rb file2.rb`
By default, nitpick will analyze *all* loaded code. To reduce the noise:
--only, -o <s>: Nitpick only classes/modules that match this string.
--except, -e <s>: Don't nitpick classes/modules that match this string.
--help, -h: Show this message
ripple:~/$Are you sure your installation ran all the way through?
The first time it installed a bunch of dependencies. I just ran it again and after saying that it was installing RDoc files for nitpick the following message appeared:
lib/nitpick/sexp_extension.rb:3:23: ':' not followed by identified or operator
Trying to just use nitpick --help results in a bunch of error messages. Could this be related to the version of Ruby (1.8.4) or that I am running this on Windows XP Pro?
···
On Mon, Sep 28, 2009 at 9:25 PM, Michael W. Ryder > <_mwryder@worldnet.att.net> wrote:
1.8.4?!?
yes. you should update.
···
On Sep 29, 2009, at 12:00 , Michael W. Ryder wrote:
The first time it installed a bunch of dependencies. I just ran it again and after saying that it was installing RDoc files for nitpick the following message appeared:
lib/nitpick/sexp_extension.rb:3:23: ':' not followed by identified or operator
Trying to just use nitpick --help results in a bunch of error messages. Could this be related to the version of Ruby (1.8.4) or that I am running this on Windows XP Pro?
I'd like to match a string to another, and recognize the match even if there are a few typing errors. These errors could include omission of a letter/space/punctuation mark, an extra letter or a mistyped letter. I don't require it to detect multiple errors in a row, or in a single word. The string would be comparable to the length of this paragraph, a little shorter, in case that matters
I could come up with some basic implementation for this, but it seems like a little too much to do for something like this. I was wondering if there was a simple way to do this, a gem perhaps?
Thanks
-Ehsan
···
_________________________________________________________________
Lauren found her dream laptop. Find the PC that’s right for you.
http://www.microsoft.com/windows/choosepc/?ocid=ftp_val_wl_290
Ryan Davis wrote:
···
On Sep 29, 2009, at 12:00 , Michael W. Ryder wrote:
The first time it installed a bunch of dependencies. I just ran it again and after saying that it was installing RDoc files for nitpick the following message appeared:
lib/nitpick/sexp_extension.rb:3:23: ':' not followed by identified or operator
Trying to just use nitpick --help results in a bunch of error messages. Could this be related to the version of Ruby (1.8.4) or that I am running this on Windows XP Pro?1.8.4?!?
yes. you should update.
I updated to 1.9.1 and now it is complaining that ParseTree does not work with 1.9.1. Now what do I do?
You could use the Levenshtein distance [1] to check how different is a
string to another. The "Text" [2] gem seems to do that, haven't used
it though.
[1] Levenshtein distance - Wikipedia
[2] http://raa.ruby-lang.org/project/levenshtein/
···
On Tue, Sep 29, 2009 at 5:23 PM, Ehsanul Hoque <ehsanul_g3@hotmail.com> wrote:
I'd like to match a string to another, and recognize the match even if there are a few typing errors. These errors could include omission of a letter/space/punctuation mark, an extra letter or a mistyped letter. I don't require it to detect multiple errors in a row, or in a single word. The string would be comparable to the length of this paragraph, a little shorter, in case that matters
I could come up with some basic implementation for this, but it seems like a little too much to do for something like this. I was wondering if there was a simple way to do this, a gem perhaps?
--
Luis Parravicini
http://ktulu.com.ar/blog/
-------- Original-Nachricht --------
Datum: Wed, 30 Sep 2009 05:23:15 +0900
Von: Ehsanul Hoque <ehsanul_g3@hotmail.com>
An: ruby-talk@ruby-lang.org
Betreff: Match a long string in Ruby despite a few typing errors
I'd like to match a string to another, and recognize the match even if
there are a few typing errors. These errors could include omission of a
letter/space/punctuation mark, an extra letter or a mistyped letter. I don't
require it to detect multiple errors in a row, or in a single word. The string
would be comparable to the length of this paragraph, a little shorter, in
case that mattersI could come up with some basic implementation for this, but it seems
like a little too much to do for something like this. I was wondering if there
was a simple way to do this, a gem perhaps?
Dear Ehsan,
you could use Levenstein distance - there's an implementation in Ruby
here:
http://raa.ruby-lang.org/project/levenshtein/
An even more informative alternative would be using the McIlroy-Hunt longest common subsequence algorithm, of which you get an implementation in the diff-lcs gem.
Both algorithms can be implemented with complexity O(m*n), so this
might take some time, if your string lengths m,n are big.
Maybe you can check beforehand that the lengths of string a and b differ by e.g., 5, so their Levenstein distance is certainly greater than e.g.,
3, which you'd fix as the maximum tolerable error number ...
Also, some tweaking allows to bring down the complexity to O(m+n), as is stated e.g., here : ttp://www.ime.usp.br/~is/papir/sctp/node2.html .
Best regards,
Axel
···
--
Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* Aktuelle Nachrichten aus Politik, Wirtschaft & Panorama | GMX
Do you know about Soundex?
Looks pretty old but I found this Soundex for Ruby library here:
http://raa.ruby-lang.org/project/soundex/
···
On Tue, Sep 29, 2009 at 3:23 PM, Ehsanul Hoque <ehsanul_g3@hotmail.com> wrote:
I'd like to match a string to another, and recognize the match even if there are a few typing errors. These errors could include omission of a letter/space/punctuation mark, an extra letter or a mistyped letter. I don't require it to detect multiple errors in a row, or in a single word. The string would be comparable to the length of this paragraph, a little shorter, in case that matters
I could come up with some basic implementation for this, but it seems like a little too much to do for something like this. I was wondering if there was a simple way to do this, a gem perhaps?
--
Greg Donald
http://destiney.com/
Don't thread hijack. Start a new mail like a responsible person.
···
On Sep 29, 2009, at 13:23 , Ehsanul Hoque wrote:
I'd like to match a string to another, and recognize the match even if there are a few typing errors. These errors could include omission of a letter/space/punctuation mark, an extra letter or a mistyped letter. I don't require it to detect multiple errors in a row, or in a single word. The string would be comparable to the length of this paragraph, a little shorter, in case that matters
I could come up with some basic implementation for this, but it seems like a little too much to do for something like this. I was wondering if there was a simple way to do this, a gem perhaps?
ParseTree only works up to 1.8.7. ruby_parser will work for 1.9.x, but it doesn't work for getting ASTs for procs or other live objects.
···
On Sep 29, 2009, at 18:20 , Michael W. Ryder wrote:
Ryan Davis wrote:
On Sep 29, 2009, at 12:00 , Michael W. Ryder wrote:
The first time it installed a bunch of dependencies. I just ran it again and after saying that it was installing RDoc files for nitpick the following message appeared:
lib/nitpick/sexp_extension.rb:3:23: ':' not followed by identified or operator
Trying to just use nitpick --help results in a bunch of error messages. Could this be related to the version of Ruby (1.8.4) or that I am running this on Windows XP Pro?1.8.4?!?
yes. you should update.I updated to 1.9.1 and now it is complaining that ParseTree does not work with 1.9.1. Now what do I do?
Luis, Axel and Greg, I thank you for your suggestions. The levenshtein distance algorithm seems like the way to go, and I'll be taking a look at the implementations mentioned.
I apologize for hijacking the thread. I didn't realize I was doing this, I naively assumed threads were based on the subject line, which I replaced. But apparently not so. It won't happen again in any case.
···
_________________________________________________________________
Insert movie times and more without leaving Hotmail®.
http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd_062009
Ryan Davis wrote:
Ryan Davis wrote:
The first time it installed a bunch of dependencies. I just ran it again and after saying that it was installing RDoc files for nitpick the following message appeared:
lib/nitpick/sexp_extension.rb:3:23: ':' not followed by identified or operator
Trying to just use nitpick --help results in a bunch of error messages. Could this be related to the version of Ruby (1.8.4) or that I am running this on Windows XP Pro?1.8.4?!?
yes. you should update.I updated to 1.9.1 and now it is complaining that ParseTree does not work with 1.9.1. Now what do I do?
ParseTree only works up to 1.8.7. ruby_parser will work for 1.9.x, but it doesn't work for getting ASTs for procs or other live objects.
So my options are:
1. Downgrade to 1.8.7
2. Somehow patch ParseTree to work with 1.9 which seems to be a f feature request for over a year now.
3. Patch nitpick to work with ruby_parser
4. Forget about using any kind of lint program with Ruby.
Personally I do not like any of the above. I can understand programs written for version 1.8.7 not working with 1.8.4, but not programs written for 1.8.7 not working for 1.9.1. Whatever happened to backwards compatibility?
···
On Sep 29, 2009, at 18:20 , Michael W. Ryder wrote:
On Sep 29, 2009, at 12:00 , Michael W. Ryder wrote:
1.8.4, but not programs written for 1.8.7 not working for 1.9.1. Whatever happened to backwards compatibility?
You want the most current of the stable branch, not something off of what is essentially the development branch. 1.9.1. is a major refactoring, a work in progress towards the eventual 2.x versions.
Hi,
···
On Sep 29, 2009, at 9:40 PM, Michael W. Ryder wrote:
2. Somehow patch ParseTree to work with 1.9 which seems to be a f feature request for over a year now.
This will not happen with 1.9 in its current state. It's not a ParseTree limitation, it's a Ruby 1.9 limitation.
~ j.
So my options are:
1. Downgrade to 1.8.7
yes, that should work.
2. Somehow patch ParseTree to work with 1.9 which seems to be a f feature request for over a year now.
can't happen, as john pointed out.
3. Patch nitpick to work with ruby_parser
this would probably work fine, but I don't know nitpick so I can only guess that it is a static-only analysis tool.
4. Forget about using any kind of lint program with Ruby.
not much gray in your world, is there? ![]()
Personally I do not like any of the above. I can understand programs written for version 1.8.7 not working with 1.8.4, but not programs written for 1.8.7 not working for 1.9.1. Whatever happened to backwards compatibility?
1.9.x does not (nor did it ever intend to) maintain backwards compatibility with 1.8. Lots of stuff went in 1.9, that's what progress is for.
See also: perl 4 to perl 5, perl 5 to perl 6, deprecations across java versions, industrial revolution, ponies.
···
On Sep 29, 2009, at 21:40 , Michael W. Ryder wrote:
Is it really a downgrade? Ruby 1.8 and Ruby 1.9 are different
animals. AFAIK lots of people have both installed on their machine.
···
On Wed, Sep 30, 2009 at 11:05 AM, Ryan Davis <ryand-ruby@zenspider.com> wrote:
On Sep 29, 2009, at 21:40 , Michael W. Ryder wrote:
So my options are:
1. Downgrade to 1.8.7yes, that should work.
--
Paul Smith
http://www.nomadicfun.co.uk
paul@pollyandpaul.co.uk
Ryan Davis wrote:
···
On Sep 29, 2009, at 21:40 , Michael W. Ryder wrote:
So my options are:
1. Downgrade to 1.8.7yes, that should work.
2. Somehow patch ParseTree to work with 1.9 which seems to be a f feature request for over a year now.
can't happen, as john pointed out.
3. Patch nitpick to work with ruby_parser
this would probably work fine, but I don't know nitpick so I can only guess that it is a static-only analysis tool.
4. Forget about using any kind of lint program with Ruby.
not much gray in your world, is there?
Personally I do not like any of the above. I can understand programs written for version 1.8.7 not working with 1.8.4, but not programs written for 1.8.7 not working for 1.9.1. Whatever happened to backwards compatibility?
1.9.x does not (nor did it ever intend to) maintain backwards compatibility with 1.8. Lots of stuff went in 1.9, that's what progress is for.
See also: perl 4 to perl 5, perl 5 to perl 6, deprecations across java versions, industrial revolution, ponies.
So my best choice is to write my own version of lint using no dependencies on gems which may be tied to a specific language feature that may or may not work with the next release of Ruby.
Wow, drama much? I think the best thing for you to do would be to focus on the specific problem you're trying to solve (I assume it's "I need to lint some code!") and any specific problems that are keeping you from doing it right now (maybe, "It's in 1.9 and nitpick is jacked!"). Hyperbole is just silly.
Rereading the thread, since nitpick looks to be a static analysis tool, it seems to me that your "best choice" is to look at modifying it to use ruby_parser.
~ j.
···
On Sep 30, 2009, at 11:50 AM, Michael W. Ryder wrote:
So my best choice is to write my own version of lint using no dependencies on gems which may be tied to a specific language feature that may or may not work with the next release of Ruby.
John Barnette wrote:
So my best choice is to write my own version of lint using no dependencies on gems which may be tied to a specific language feature that may or may not work with the next release of Ruby.
Wow, drama much? I think the best thing for you to do would be to focus on the specific problem you're trying to solve (I assume it's "I need to lint some code!") and any specific problems that are keeping you from doing it right now (maybe, "It's in 1.9 and nitpick is jacked!"). Hyperbole is just silly.
The real problem is with the inability to tell if a tool will work in a given environment. I looked on RubyForge for lint and found two programs, only one that appeared to be functional. After using gem install to load the gem and all the dependencies I found out that my current level of Ruby was insufficient to run the program. So I updated Ruby to the latest version without knowing that other tools needed by the first wouldn't work with the latest and greatest. Its very frustrating to try and do something and spend so much time trying to navigate the maze of dependencies while blindfolded.
···
On Sep 30, 2009, at 11:50 AM, Michael W. Ryder wrote:
Rereading the thread, since nitpick looks to be a static analysis tool, it seems to me that your "best choice" is to look at modifying it to use ruby_parser.
~ j.