Loading ...
Sorry, an error occurred while loading the content.

986goodpart:true with ruby

Expand Messages
  • walfisch_in_the_sea
    Oct 31, 2009
    • 0 Attachment
      I use JSLint with Rhino. And as the goodparts sometimes change, I wrote a short rubyscript to update the options-string. Is there another way to get the most recent goodparts?

      (click on "Show Message Option" on the right, to change the font to monospace)
      The script:

      #!/usr/bin/env ruby

      require "net/http"

      r = []
      Net::HTTP.get("www.jslint.com", "/").
      each do |option|
      if /title=/i === option
      #option with boolean
      r.push([option.gsub(/<[^>]*title="(\w*)".*/, '\1'),
      (/name=goodpart/ === option).to_s].join(":"))
      elsif /value="\d+"/ === option
      #option with number

      p "/*jslint " + r.join(", ").downcase + " */"

      #creates this:
      #/*jslint passfail:false, white:true, onevar:true, browser:false, widget:false, sidebar:false, rhino:false, safe:false, adsafe:false, debug:false, evil:false, laxbreak:false, forin:false, sub:false, css:false, cap:false, on:false, fragment:false, undef:true, nomen:true, eqeqeq:true, plusplus:true, bitwise:true, regexp:true, strict:true, newcap:true, immed:true, indent:4, maxerr:50 */