Where can I find an actively developed lint tool for Ruby?

后端 未结 9 954
别跟我提以往
别跟我提以往 2020-12-12 19:27

Most of the code I write is in Ruby, and every once in a while, I make some typo which only gets caught after a while. This is irritating when I have my scripts running long

9条回答
  •  旧时难觅i
    2020-12-12 19:52

    nitpick might be what you're lookng for.

    With this code:

    class MyString < String
      def awesome
        self.gsub("e", "3").gsub("l", "1").uppercase
      end
    end
    
    puts MyString.new("leet").awesome
    

    ... it outputs:

    $ nitpick misspelling.rb 
    *** Nitpick had trouble loading "misspelling.rb":
        NoMethodError undefined method `uppercase' for "133t":MyString
    Nothing to report boss! He's clean!
    

提交回复
热议问题