#425 ✓resolved
Michal Hantl

JS validator is very, very strict

Reported by Michal Hantl | December 7th, 2010 @ 01:53 PM

$.noConflict(); //'$' is not defined jQuery(document).ready(function($) { // missing space after function, jQuery is not defined, document is not defined (wtf?)

var slova = ["hojnost", "ochota", "empatie"]; // expected 'var' to have an indentation of 5, instead of 3

var game = $('#game'); // too many var statements, expected 'var' to have an indentation of 5, instead of 3

var hrej = function(slovo) { // missing space after function, too many var statements, expected 'var' to have an indentation of 5, instead of 3

console.log(game); // 'console' is not defined, expected console to have indentation of 9, instead of 5
game.innerHTML = slovo; // expected game to have indentation of 9, instead of 5

} // missing semicolon, expected '}' to have an indentation of 5, instead of 3

hrej(slova[0]); // expected 'hrej' to have indentation of 9, instead of 5 });

Comments and changes to this ticket

  • delisa

    delisa December 7th, 2010 @ 02:28 PM

    JS syntax checking is provided using JSLint, as documented on the redcar wiki here: https://github.com/redcar/redcar/wiki/Syntax-Checking

    The settings are configurable using JSLint option comments:
    http://www.jslint.com/lint.html#options

    You probably need these settings at the top of checked files:

    /*jslint rhino: true, browser:true, onevar:false*/
    

    There's also a general warning on JSLint which makes me feel better: http://www.jslint.com/lint.html :)

    Warning!
    
    JSLint will hurt your feelings.
    

    JS Validation can also be turned off in preferences.

  • Michal Hantl

    Michal Hantl December 7th, 2010 @ 02:49 PM

    Thanks delisa!

    Btw, I think JS lint crashes redcar, it crashes frequently when I'm editing a JS file.

    Integrating JSlint is a mighty fine idea, but the result (all lines in red) is not good looking.

    Here is what I ended up with:

    /jslint rhino:true, browser:true, indent:2, white:false, onevar:false, devel:true, plusplus:false /

    I couldn't find where to turn it off in preferences and it crashes Redcar frequently.

    I think JSlint is a good idea, but I would like to see its options right below the editor window, so I can turn it off whenever I need to quickly.

    Also, this is a show stopper for noobs I think. I kind of knew this was JS lint and I was already registered here so I reported my problem. I cannot imagine why a newbie would care so much about Redcar that he would take the time to fix that problem.

  • delisa

    delisa December 7th, 2010 @ 02:55 PM

    • Tag changed from js validator to syntax checking, js, lint, rhino

    Thanks for the update, Michal. :)
    To disable, check in preferences under syntax_checking.

    Is there any console output or a stack trace on crash?

  • Michal Hantl

    Michal Hantl December 7th, 2010 @ 03:27 PM

    I was using the --fork option, will let you know when the next crash appears.

    I had 3 crashes in 15 minutes, now when I need to report one, there is none :)

  • Michal Hantl

    Michal Hantl December 7th, 2010 @ 04:21 PM

    michal@domov:~/Dropbox/dev/sluvka$ redcar .
    Redcar 0.9.1 ( i686-linux )
    java -d32 -client -Xbootclasspath/a:/home/michal/.redcar/assets/jruby-complete-1.5.3.jar -Xmx320m -Xss1024k -Djruby.memory.max=320m -Djruby.stack.max=1024k org.jruby.Main /var/lib/gems/1.8/gems/redcar-0.9.1/bin/redcar . --no-sub-jruby --ignore-stdin
    Redcar 0.9.1 ( java )
    Redcar::ApplicationSWTloading plugins took 3.449
    took 0.946s to load textmate assets
    initializing gui took 0.05s
    project start took 0.877s
    start time: 5.783
    indent setting without scope! #<Redcar::Textmate::UnIndentedLinePatternSetting:0x1423820 @plist="^\\s*$", @scope=nil>
    *** ERROR in Document controller: <Redcar::PairHighlighter::DocumentController>
    NativeException: java.lang.IllegalArgumentException: Index out of bounds
    org.eclipse.swt.SWT:-1:in `error'
    org.eclipse.swt.SWT:-1:in `error'
    org.eclipse.swt.SWT:-1:in `error'
    org.eclipse.swt.custom.StyledText:-1:in `getTextRange'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb:94:in `find_pair'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb:114:in `pair_of_offset'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb:140:in `cursor_moved'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:156:in `cursor_moved'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:730:in `rescue_document_controller_error'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:155:in `cursor_moved'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:154:in `each'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:154:in `cursor_moved'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view_swt/lib/edit_view_swt/document.rb:191:in `caretMoved'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/swt/lib/swt/event_loop.rb:13:in `start'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/core/lib/core/gui.rb:39:in `start'
    /var/lib/gems/1.8/gems/redcar-0.9.1/lib/redcar.rb:184:in `pump'
    /var/lib/gems/1.8/gems/redcar-0.9.1/bin/redcar:30
    *** ERROR in Document controller: <Redcar::PairHighlighter::DocumentController>
    NativeException: java.lang.IllegalArgumentException: Index out of bounds
    org.eclipse.swt.SWT:-1:in `error'
    org.eclipse.swt.SWT:-1:in `error'
    org.eclipse.swt.SWT:-1:in `error'
    org.eclipse.swt.custom.StyledText:-1:in `getTextRange'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb:94:in `find_pair'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb:110:in `pair_of_offset'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb:143:in `cursor_moved'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:156:in `cursor_moved'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:730:in `rescue_document_controller_error'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:155:in `cursor_moved'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:154:in `each'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:154:in `cursor_moved'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view_swt/lib/edit_view_swt/document.rb:191:in `caretMoved'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view_swt/lib/edit_view_swt/document.rb:111:in `cursor_offset='
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:293:in `cursor_offset='
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/redcar/redcar.rb:663:in `execute'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/redcar/redcar.rb:646:in `each'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/redcar/redcar.rb:646:in `each_with_index'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/redcar/redcar.rb:646:in `execute'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/auto_indenter/lib/auto_indenter/document_controller.rb:11:in `disable'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/redcar/redcar.rb:639:in `execute'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/auto_pairer/lib/auto_pairer/document_controller.rb:22:in `disable'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/redcar/redcar.rb:638:in `execute'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/application/lib/application/command/executor.rb:29:in `execute'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/application/lib/application/command.rb:83:in `run'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/application/lib/application/menu/item.rb:45:in `selected'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/application_swt/lib/application_swt/menu.rb:133:in `widgetSelected'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/swt/lib/swt/event_loop.rb:13:in `start'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/core/lib/core/gui.rb:39:in `start'
    /var/lib/gems/1.8/gems/redcar-0.9.1/lib/redcar.rb:184:in `pump'
    /var/lib/gems/1.8/gems/redcar-0.9.1/bin/redcar:30
    *** ERROR in Document controller: <Redcar::PairHighlighter::DocumentController>
    NativeException: java.lang.IllegalArgumentException: Index out of bounds
    org.eclipse.swt.SWT:-1:in `error'
    org.eclipse.swt.SWT:-1:in `error'
    org.eclipse.swt.SWT:-1:in `error'
    org.eclipse.swt.custom.StyledText:-1:in `getTextRange'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb:94:in `find_pair'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb:110:in `pair_of_offset'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb:143:in `cursor_moved'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:156:in `cursor_moved'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:730:in `rescue_document_controller_error'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:155:in `cursor_moved'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:154:in `each'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:154:in `cursor_moved'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view_swt/lib/edit_view_swt/document.rb:191:in `caretMoved'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/swt/lib/swt/event_loop.rb:13:in `start'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/core/lib/core/gui.rb:39:in `start'
    /var/lib/gems/1.8/gems/redcar-0.9.1/lib/redcar.rb:184:in `pump'
    /var/lib/gems/1.8/gems/redcar-0.9.1/bin/redcar:30
    Error in command Redcar::Top::MoveEndCommand
    NativeException: java.lang.IllegalArgumentException: Argument not valid
    org.eclipse.swt.SWT:-1:in `error'
    org.eclipse.swt.SWT:-1:in `error'
    org.eclipse.swt.SWT:-1:in `error'
    org.eclipse.swt.custom.StyledText:-1:in `setCaretOffset'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view_swt/lib/edit_view_swt/document.rb:111:in `cursor_offset='
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/edit_view/lib/edit_view/document.rb:293:in `cursor_offset='
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/redcar/redcar.rb:475:in `execute'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/application/lib/application/command/executor.rb:29:in `execute'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/application/lib/application/command.rb:83:in `run'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/application/lib/application/menu/item.rb:45:in `selected'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/application_swt/lib/application_swt/menu.rb:133:in `widgetSelected'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/swt/lib/swt/event_loop.rb:13:in `start'
    /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/core/lib/core/gui.rb:39:in `start'
    /var/lib/gems/1.8/gems/redcar-0.9.1/lib/redcar.rb:184:in `pump'
    /var/lib/gems/1.8/gems/redcar-0.9.1/bin/redcar:30
    org.eclipse.swt.SWT:-1:in `error': org.eclipse.swt.SWTException: Failed to execute runnable  (java.util.ConcurrentModificationException) (NativeException) <-- this is probabaly the reason
        from org.eclipse.swt.SWT:-1:in `error'
        from org.eclipse.swt.widgets.Synchronizer:-1:in `runAsyncMessages'
        from org.eclipse.swt.widgets.Display:-1:in `runAsyncMessages'
        from org.eclipse.swt.widgets.Display:-1:in `readAndDispatch'
        from /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/swt/lib/swt/event_loop.rb:13:in `start'
        from /var/lib/gems/1.8/gems/redcar-0.9.1/plugins/core/lib/core/gui.rb:39:in `start'
        from /var/lib/gems/1.8/gems/redcar-0.9.1/lib/redcar.rb:184:in `pump'
        from /var/lib/gems/1.8/gems/redcar-0.9.1/bin/redcar:30
    
  • delisa

    delisa December 7th, 2010 @ 05:32 PM

    Ok. For the moment, I added some menu items for managing syntax checking. Changes will be in 0.10.

  • delisa

    delisa December 7th, 2010 @ 05:33 PM

    • Title changed from “JS validator is an asshole” to “JS validator is very, very strict”
  • delisa

    delisa December 7th, 2010 @ 05:35 PM

    • no changes were found...
  • delisa

    delisa December 14th, 2010 @ 11:25 PM

    • State changed from “new” to “open”
  • delisa

    delisa January 23rd, 2011 @ 10:12 PM

    • State changed from “open” to “resolved”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

A programmer's text editor for Gnome.

People watching this ticket

Attachments

Pages