6677 | | }()); |
6678 | | No newline at end of file |
| 6678 | }()); |
| 6679 | |
| 6680 | |
| 6681 | if(!arguments[0] || arguments[0]==="-h" || arguments[0]==="--help"){ |
| 6682 | print('Usage : "jslint myscript.js option[=true]"'); |
| 6683 | }else{ |
| 6684 | var file=new File(arguments[0]); |
| 6685 | file.open("read", "text"); |
| 6686 | var script=file.readAll(); |
| 6687 | var i; |
| 6688 | var option= {}; |
| 6689 | for (i = 1; i < arguments.length; i++) { |
| 6690 | var splitoptions=arguments[i].split("="); |
| 6691 | option[splitoptions[0]]=splitoptions[1]=="false"?false:true; |
| 6692 | } |
| 6693 | if(!JSLINT(script, option)){ |
| 6694 | for (i = 0; i < JSLINT.errors.length; i++) { |
| 6695 | var e = JSLINT.errors[i]; |
| 6696 | if (e) { |
| 6697 | print('Error at line ' + (e.line + 1) + ' character ' + (e.character + 1) + ': ' + e.reason); |
| 6698 | if(e.evidence){ |
| 6699 | print((e.evidence).replace(/^\s+/g,'').replace(/\s+$/g,'')); |
| 6700 | } |
| 6701 | print(''); |
| 6702 | } |
| 6703 | } |
| 6704 | |
| 6705 | }else{ |
| 6706 | print("No error found"); |
| 6707 | } |
| 6708 | } |
| 6709 | No newline at end of file |