jshintrb 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7c4624b433c58899f20be1e014498de9ecfca916
4
+ data.tar.gz: f03303171b533dd2705cbf24c8898ecac3cda2e0
5
+ SHA512:
6
+ metadata.gz: 5f1fbc90eb179fb83d72b8cb36364e82169e24c041ce642a7907cda53bd6f386ba4f32781342275df7e4ce57a6d3a27d7e8ea70920721340812ec76db5ca1de4
7
+ data.tar.gz: 6cb70c0207fbbe3d7dcd09ce411f8b380c46c3c8127426193c721e8a884720cc67a38d6bd357e77da2802e22d9df7d4e9edf4aca6decd265de9d25de57a7be32
data/.gitignore CHANGED
File without changes
File without changes
File without changes
data/Gemfile CHANGED
@@ -3,8 +3,6 @@ source "http://rubygems.org"
3
3
  # Specify your gem's dependencies in jshintrb.gemspec
4
4
  gemspec
5
5
 
6
- gem 'inifile', '~> 1.1.0'
7
-
8
6
  # Depend on defined ExecJS runtime
9
7
  execjs_runtimes = {
10
8
  "RubyRacer" => "therubyracer",
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Stereobooster
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -68,6 +68,10 @@ If you pass `:defaults` as option, it is the same as if you pass following
68
68
 
69
69
  ## TODO
70
70
 
71
+ - update to the latest jshint. Need to resolve problems with CommonJS ([see](https://github.com/jshint/jshint/issues/739)):
72
+ - `require` can be resolved with `stitch-rb`
73
+ - `underscore`
74
+ - [CommonJS `event` module](http://wiki.commonjs.org/wiki/Events/A)
71
75
  - add more tests
72
76
  - add color reporter. Maybe [colorize](https://github.com/fazibear/colorize)
73
77
  - add cli. Support same options as [jshint/node-jshint](https://github.com/jshint/node-jshint/blob/master/lib/cli.js)
data/Rakefile CHANGED
File without changes
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.homepage = "https://github.com/stereobooster/jshintrb"
11
11
  s.summary = %q{Ruby wrapper for JSHint}
12
12
  s.description = %q{Ruby wrapper for JSHint. The main difference from jshint gem it does not depend on Java. Instead, it uses ExecJS}
13
+ s.license = "MIT"
13
14
 
14
15
  s.files = `git ls-files`.split("\n")
15
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -151,7 +151,7 @@
151
151
  /*members "\b", "\t", "\n", "\f", "\r", "!=", "!==", "\"", "%", "(begin)",
152
152
  "(breakage)", "(character)", "(context)", "(error)", "(explicitNewcap)", "(global)",
153
153
  "(identifier)", "(last)", "(lastcharacter)", "(line)", "(loopage)", "(metrics)",
154
- "(name)", "(onevar)", "(params)", "(scope)", "(statement)", "(verb)", "(tokens)",
154
+ "(name)", "(onevar)", "(params)", "(scope)", "(statement)", "(verb)", "(tokens)", "(catch)",
155
155
  "*", "+", "++", "-", "--", "\/", "<", "<=", "==",
156
156
  "===", ">", ">=", $, $$, $A, $F, $H, $R, $break, $continue, $w, Abstract, Ajax,
157
157
  __filename, __dirname, ActiveXObject, Array, ArrayBuffer, ArrayBufferView, Audio,
@@ -215,13 +215,13 @@
215
215
  removeEventListener, replace, report, require, reserved, resizeBy, resizeTo, resolvePath,
216
216
  resumeUpdates, respond, rhino, right, runCommand, scroll, scope, screen, scripturl, scrollBy,
217
217
  scrollTo, scrollbar, search, seal, self, send, serialize, sessionStorage, setInterval, setTimeout,
218
- setter, setterToken, shift, slice, smarttabs, sort, spawn, split, statementCount, stack, status,
219
- start, strict, sub, substr, supernew, shadow, supplant, sum, sync, test, toLowerCase, toString,
220
- toUpperCase, toint32, token, tokens, top, trailing, type, typeOf, Uint16Array, Uint32Array,
221
- Uint8Array, undef, undefs, unused, urls, validthis, value, valueOf, var, vars, version,
222
- verifyMaxParametersPerFunction, verifyMaxStatementsPerFunction, verifyMaxComplexityPerFunction,
223
- verifyMaxNestedBlockDepthPerFunction, WebSocket, withstmt, white, window, windows, Worker, worker,
224
- wsh*/
218
+ setter, setterToken, shift, slice, smarttabs, sort, spawn, split, statement, statementCount, stack,
219
+ status, start, strict, sub, substr, supernew, shadow, supplant, sum, sync, test, toLowerCase,
220
+ toString, toUpperCase, toint32, token, tokens, top, trailing, type, typeOf, Uint16Array,
221
+ Uint32Array, Uint8Array, undef, undefs, unused, urls, validthis, value, valueOf, var, vars,
222
+ version, verifyMaxParametersPerFunction, verifyMaxStatementsPerFunction,
223
+ verifyMaxComplexityPerFunction, verifyMaxNestedBlockDepthPerFunction, WebSocket, withstmt, white,
224
+ window, windows, Worker, worker, wsh, yui, YUI, Y, YUI_config*/
225
225
 
226
226
  /*global exports: false */
227
227
 
@@ -325,8 +325,9 @@ var JSHINT = (function () {
325
325
  withstmt : true, // if with statements should be allowed
326
326
  white : true, // if strict whitespace rules apply
327
327
  worker : true, // if Web Worker script symbols should be allowed
328
- wsh : true // if the Windows Scripting Host environment globals
328
+ wsh : true, // if the Windows Scripting Host environment globals
329
329
  // should be predefined
330
+ yui : true // YUI variables should be predefined
330
331
  },
331
332
 
332
333
  // These are the JSHint options that can take any value
@@ -780,8 +781,13 @@ var JSHINT = (function () {
780
781
  WSH : true,
781
782
  WScript : true,
782
783
  XDomainRequest : true
783
- };
784
+ },
784
785
 
786
+ yui = {
787
+ YUI : false,
788
+ Y : false,
789
+ YUI_config : false
790
+ };
785
791
  // Regular expressions. Some of these are stupidly long.
786
792
  var ax, cx, tx, nx, nxg, lx, ix, jx, ft;
787
793
  (function () {
@@ -794,7 +800,7 @@ var JSHINT = (function () {
794
800
  cx = /[\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;
795
801
 
796
802
  // token
797
- tx = /^\s*([(){}\[.,:;'"~\?\]#@]|==?=?|\/(\*(jshint|jslint|members?|global)?|=|\/)?|\*[\/=]?|\+(?:=|\++)?|-(?:=|-+)?|%=?|&[&=]?|\|[|=]?|>>?>?=?|<([\/=!]|\!(\[|--)?|<=?)?|\^=?|\!=?=?|[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+([xX][0-9a-fA-F]+|\.[0-9]*)?([eE][+\-]?[0-9]+)?)/;
803
+ tx = /^\s*([(){}\[.,:;'"~\?\]#@]|==?=?|\/=(?!(\S*\/[gim]?))|\/(\*(jshint|jslint|members?|global)?|\/)?|\*[\/=]?|\+(?:=|\++)?|-(?:=|-+)?|%=?|&[&=]?|\|[|=]?|>>?>?=?|<([\/=!]|\!(\[|--)?|<=?)?|\^=?|\!=?=?|[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+([xX][0-9a-fA-F]+|\.[0-9]*)?([eE][+\-]?[0-9]+)?)/;
798
804
 
799
805
  // characters in strings that need escapement
800
806
  nx = /[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;
@@ -1006,6 +1012,10 @@ var JSHINT = (function () {
1006
1012
  if (option.globalstrict && option.strict !== false) {
1007
1013
  option.strict = true;
1008
1014
  }
1015
+
1016
+ if (option.yui) {
1017
+ combine(predefined, yui);
1018
+ }
1009
1019
  }
1010
1020
 
1011
1021
 
@@ -1098,6 +1108,7 @@ var JSHINT = (function () {
1098
1108
 
1099
1109
  function nextLine() {
1100
1110
  var at,
1111
+ match,
1101
1112
  tw; // trailing whitespace check
1102
1113
 
1103
1114
  if (line >= lines.length)
@@ -1110,10 +1121,13 @@ var JSHINT = (function () {
1110
1121
  // If smarttabs option is used check for spaces followed by tabs only.
1111
1122
  // Otherwise check for any occurence of mixed tabs and spaces.
1112
1123
  // Tabs and one space followed by block comment is allowed.
1113
- if (option.smarttabs)
1114
- at = s.search(/ \t/);
1115
- else
1124
+ if (option.smarttabs) {
1125
+ // negative look-behind for "//"
1126
+ match = s.match(/(\/\/)? \t/);
1127
+ at = match && !match[1] ? 0 : -1;
1128
+ } else {
1116
1129
  at = s.search(/ \t|\t [^\*]/);
1130
+ }
1117
1131
 
1118
1132
  if (at >= 0)
1119
1133
  warningAt("Mixed spaces and tabs.", line, at + 1);
@@ -1267,6 +1281,7 @@ var JSHINT = (function () {
1267
1281
 
1268
1282
  function match(x) {
1269
1283
  var r = x.exec(s), r1;
1284
+
1270
1285
  if (r) {
1271
1286
  l = r[0].length;
1272
1287
  r1 = r[1];
@@ -1312,6 +1327,7 @@ var JSHINT = (function () {
1312
1327
  character += n;
1313
1328
  c = String.fromCharCode(i);
1314
1329
  }
1330
+
1315
1331
  j = 0;
1316
1332
  unclosedString: for (;;) {
1317
1333
  while (j >= s.length) {
@@ -1329,12 +1345,14 @@ unclosedString: for (;;) {
1329
1345
  warningAt("Unclosed string.", cl, cf);
1330
1346
  }
1331
1347
  }
1348
+
1332
1349
  c = s.charAt(j);
1333
1350
  if (c === x) {
1334
1351
  character += 1;
1335
1352
  s = s.substr(j + 1);
1336
1353
  return it("(string)", r, x);
1337
1354
  }
1355
+
1338
1356
  if (c < " ") {
1339
1357
  if (c === "\n" || c === "\r") {
1340
1358
  break;
@@ -1431,7 +1449,9 @@ unclosedString: for (;;) {
1431
1449
  if (!s) {
1432
1450
  return it(nextLine() ? "(endline)" : "(end)", "");
1433
1451
  }
1452
+
1434
1453
  t = match(tx);
1454
+
1435
1455
  if (!t) {
1436
1456
  t = "";
1437
1457
  c = "";
@@ -1530,10 +1550,11 @@ unclosedString: for (;;) {
1530
1550
  break;
1531
1551
  // /
1532
1552
  case "/":
1533
- if (token.id === "/=") {
1553
+ if (s.charAt(0) === "=") {
1534
1554
  errorAt("A regular expression literal can be confused with '/='.",
1535
1555
  line, from);
1536
1556
  }
1557
+
1537
1558
  if (prereg) {
1538
1559
  depth = 0;
1539
1560
  captures = 0;
@@ -1755,6 +1776,7 @@ klass: do {
1755
1776
  if (c < "0" || c > "9") {
1756
1777
  warningAt(
1757
1778
  "Expected a number and instead saw '{a}'.", line, from + l, c);
1779
+ break; // No reason to continue checking numbers.
1758
1780
  }
1759
1781
  l += 1;
1760
1782
  low = +c;
@@ -1827,13 +1849,22 @@ klass: do {
1827
1849
  }
1828
1850
 
1829
1851
  // Define t in the current function in the current scope.
1852
+ if (type === "exception") {
1853
+ if (is_own(funct["(context)"], t)) {
1854
+ if (funct[t] !== true && !option.node) {
1855
+ warning("Value of '{a}' may be overwritten in IE.", nexttoken, t);
1856
+ }
1857
+ }
1858
+ }
1859
+
1830
1860
  if (is_own(funct, t) && !funct["(global)"]) {
1831
1861
  if (funct[t] === true) {
1832
1862
  if (option.latedef)
1833
1863
  warning("'{a}' was used before it was defined.", nexttoken, t);
1834
1864
  } else {
1835
- if (!option.shadow && type !== "exception")
1865
+ if (!option.shadow && type !== "exception") {
1836
1866
  warning("'{a}' is already defined.", nexttoken, t);
1867
+ }
1837
1868
  }
1838
1869
  }
1839
1870
 
@@ -1922,31 +1953,27 @@ loop: for (;;) {
1922
1953
  checkOption(t.value, t);
1923
1954
  }
1924
1955
 
1925
- if (t.value === "indent" && (o === "/*jshint" || o === "/*jslint")) {
1926
- b = +v.value;
1927
- if (typeof b !== "number" || !isFinite(b) || b <= 0 ||
1928
- Math.floor(b) !== b) {
1929
- error("Expected a small integer and instead saw '{a}'.",
1930
- v, v.value);
1931
- }
1932
- obj.white = true;
1933
- obj.indent = b;
1934
- } else if (t.value === "maxerr" && (o === "/*jshint" || o === "/*jslint")) {
1956
+ var numericVals = [
1957
+ "maxstatements",
1958
+ "maxparams",
1959
+ "maxdepth",
1960
+ "maxcomplexity",
1961
+ "maxerr",
1962
+ "maxlen",
1963
+ "indent"
1964
+ ];
1965
+
1966
+ if (numericVals.indexOf(t.value) > -1 && (o === "/*jshint" || o === "/*jslint")) {
1935
1967
  b = +v.value;
1936
- if (typeof b !== "number" || !isFinite(b) || b <= 0 ||
1937
- Math.floor(b) !== b) {
1938
- error("Expected a small integer and instead saw '{a}'.",
1939
- v, v.value);
1940
- }
1941
- obj.maxerr = b;
1942
- } else if (t.value === "maxlen" && (o === "/*jshint" || o === "/*jslint")) {
1943
- b = +v.value;
1944
- if (typeof b !== "number" || !isFinite(b) || b <= 0 ||
1945
- Math.floor(b) !== b) {
1946
- error("Expected a small integer and instead saw '{a}'.",
1947
- v, v.value);
1968
+
1969
+ if (typeof b !== "number" || !isFinite(b) || b <= 0 || Math.floor(b) !== b) {
1970
+ error("Expected a small integer and instead saw '{a}'.", v, v.value);
1948
1971
  }
1949
- obj.maxlen = b;
1972
+
1973
+ if (t.value === "indent")
1974
+ obj.white = true;
1975
+
1976
+ obj[t.value] = b;
1950
1977
  } else if (t.value === "validthis") {
1951
1978
  if (funct["(global)"]) {
1952
1979
  error("Option 'validthis' can't be used in a global scope.");
@@ -2771,7 +2798,10 @@ loop: for (;;) {
2771
2798
  d;
2772
2799
 
2773
2800
  inblock = ordinary;
2774
- if (!ordinary || !option.funcscope) scope = Object.create(scope);
2801
+
2802
+ if (!ordinary || !option.funcscope)
2803
+ scope = Object.create(scope);
2804
+
2775
2805
  nonadjacent(token, nexttoken);
2776
2806
  t = nexttoken;
2777
2807
 
@@ -3410,7 +3440,8 @@ loop: for (;;) {
3410
3440
  }
3411
3441
  while (nexttoken.id !== "(end)") {
3412
3442
  while (nexttoken.id === ",") {
3413
- warning("Extra comma.");
3443
+ if (!option.es5)
3444
+ warning("Extra comma.");
3414
3445
  advance(",");
3415
3446
  }
3416
3447
  if (nexttoken.id === "]") {
@@ -3482,16 +3513,16 @@ loop: for (;;) {
3482
3513
  }
3483
3514
 
3484
3515
 
3485
- function doFunction(i, statement) {
3486
- var f,
3487
- oldOption = option,
3488
- oldScope = scope;
3516
+ function doFunction(name, statement) {
3517
+ var f;
3518
+ var oldOption = option;
3519
+ var oldScope = scope;
3489
3520
 
3490
3521
  option = Object.create(option);
3491
- scope = Object.create(scope);
3522
+ scope = Object.create(scope);
3492
3523
 
3493
3524
  funct = {
3494
- "(name)" : i || "\"" + anonname + "\"",
3525
+ "(name)" : name || "\"" + anonname + "\"",
3495
3526
  "(line)" : nexttoken.line,
3496
3527
  "(character)": nexttoken.character,
3497
3528
  "(context)" : funct,
@@ -3502,12 +3533,16 @@ loop: for (;;) {
3502
3533
  "(statement)": statement,
3503
3534
  "(tokens)" : {}
3504
3535
  };
3536
+
3505
3537
  f = funct;
3506
3538
  token.funct = funct;
3539
+
3507
3540
  functions.push(funct);
3508
- if (i) {
3509
- addlabel(i, "function");
3541
+
3542
+ if (name) {
3543
+ addlabel(name, "function");
3510
3544
  }
3545
+
3511
3546
  funct["(params)"] = functionparams();
3512
3547
  funct["(metrics)"].verifyMaxParametersPerFunction(funct["(params)"]);
3513
3548
 
@@ -3521,6 +3556,7 @@ loop: for (;;) {
3521
3556
  funct["(last)"] = token.line;
3522
3557
  funct["(lastcharacter)"] = token.character;
3523
3558
  funct = funct["(context)"];
3559
+
3524
3560
  return f;
3525
3561
  }
3526
3562
 
@@ -3537,10 +3573,11 @@ loop: for (;;) {
3537
3573
  }
3538
3574
  },
3539
3575
 
3540
- verifyMaxParametersPerFunction: function (parameters) {
3541
- if (option.maxparams &&
3542
- parameters.length > option.maxparams) {
3543
- var message = "Too many parameters per function (" + parameters.length + ").";
3576
+ verifyMaxParametersPerFunction: function (params) {
3577
+ params = params || [];
3578
+
3579
+ if (option.maxparams && params.length > option.maxparams) {
3580
+ var message = "Too many parameters per function (" + params.length + ").";
3544
3581
  warning(message, functionStartToken);
3545
3582
  }
3546
3583
  },
@@ -3828,7 +3865,7 @@ loop: for (;;) {
3828
3865
  adjacent(token, nexttoken);
3829
3866
  addlabel(i, "unction", token);
3830
3867
 
3831
- doFunction(i, true);
3868
+ doFunction(i, { statement: true });
3832
3869
  if (nexttoken.id === "(" && nexttoken.line === token.line) {
3833
3870
  error(
3834
3871
  "Function declarations are not invocable. Wrap the whole function invocation in parens.");
@@ -3879,29 +3916,65 @@ loop: for (;;) {
3879
3916
  });
3880
3917
 
3881
3918
  blockstmt("try", function () {
3882
- var b, e, s;
3919
+ var b;
3920
+
3921
+ function doCatch() {
3922
+ var oldScope = scope;
3923
+ var e;
3883
3924
 
3884
- block(false);
3885
- if (nexttoken.id === "catch") {
3886
- increaseComplexityCount();
3887
3925
  advance("catch");
3888
3926
  nonadjacent(token, nexttoken);
3889
3927
  advance("(");
3890
- s = scope;
3891
- scope = Object.create(s);
3928
+
3929
+ scope = Object.create(oldScope);
3930
+
3892
3931
  e = nexttoken.value;
3893
3932
  if (nexttoken.type !== "(identifier)") {
3894
- warning("Expected an identifier and instead saw '{a}'.",
3895
- nexttoken, e);
3896
- } else {
3897
- addlabel(e, "exception");
3933
+ e = null;
3934
+ warning("Expected an identifier and instead saw '{a}'.", nexttoken, e);
3898
3935
  }
3936
+
3899
3937
  advance();
3900
3938
  advance(")");
3939
+
3940
+ funct = {
3941
+ "(name)" : "(catch)",
3942
+ "(line)" : nexttoken.line,
3943
+ "(character)": nexttoken.character,
3944
+ "(context)" : funct,
3945
+ "(breakage)" : funct["(breakage)"],
3946
+ "(loopage)" : funct["(loopage)"],
3947
+ "(scope)" : scope,
3948
+ "(statement)": false,
3949
+ "(metrics)" : createMetrics(nexttoken),
3950
+ "(catch)" : true,
3951
+ "(tokens)" : {}
3952
+ };
3953
+
3954
+ if (e) {
3955
+ addlabel(e, "exception");
3956
+ }
3957
+
3958
+ token.funct = funct;
3959
+ functions.push(funct);
3960
+
3901
3961
  block(false);
3962
+
3963
+ scope = oldScope;
3964
+
3965
+ funct["(last)"] = token.line;
3966
+ funct["(lastcharacter)"] = token.character;
3967
+ funct = funct["(context)"];
3968
+ }
3969
+
3970
+ block(false);
3971
+
3972
+ if (nexttoken.id === "catch") {
3973
+ increaseComplexityCount();
3974
+ doCatch();
3902
3975
  b = true;
3903
- scope = s;
3904
3976
  }
3977
+
3905
3978
  if (nexttoken.id === "finally") {
3906
3979
  advance("finally");
3907
3980
  block(false);
@@ -3910,6 +3983,7 @@ loop: for (;;) {
3910
3983
  error("Expected '{a}' and instead saw '{b}'.",
3911
3984
  nexttoken, "catch", nexttoken.value);
3912
3985
  }
3986
+
3913
3987
  return this;
3914
3988
  });
3915
3989
 
@@ -4421,12 +4495,16 @@ loop: for (;;) {
4421
4495
  }
4422
4496
  });
4423
4497
  }
4498
+
4424
4499
  optionKeys = Object.keys(o);
4425
4500
  for (x = 0; x < optionKeys.length; x++) {
4426
4501
  newOptionObj[optionKeys[x]] = o[optionKeys[x]];
4427
4502
 
4428
4503
  if (optionKeys[x] === "newcap" && o[optionKeys[x]] === false)
4429
4504
  newOptionObj["(explicitNewcap)"] = true;
4505
+
4506
+ if (optionKeys[x] === "indent")
4507
+ newOptionObj.white = true;
4430
4508
  }
4431
4509
  }
4432
4510
 
@@ -10,9 +10,9 @@ module Jshintrb
10
10
  Lint.new(options, globals).lint(source)
11
11
  end
12
12
 
13
- def self.report(source, options = nil, out = nil)
13
+ def self.report(source, options = nil, globals = nil, out = nil)
14
14
  reporter = Reporter::Default.new
15
- linter = Lint.new(options)
15
+ linter = Lint.new(options, globals)
16
16
  report = ''
17
17
  if source.is_a?(Array) then
18
18
  source.each do |src|
@@ -37,4 +37,4 @@ module Jshintrb
37
37
  report
38
38
  end
39
39
 
40
- end
40
+ end
@@ -17,6 +17,8 @@ module Jshintrb
17
17
  # options
18
18
  attr_accessor :options
19
19
 
20
+ attr_accessor :globals
21
+
20
22
  # Whether or not to fail Rake when an error occurs (typically when Jshint check fail).
21
23
  # Defaults to true.
22
24
  attr_accessor :fail_on_error
@@ -39,6 +41,7 @@ module Jshintrb
39
41
  @exclude_pattern = nil
40
42
  @exclude_js_files = nil
41
43
  @options = nil
44
+ @globals = nil
42
45
  @fail_on_error = true
43
46
 
44
47
  yield self if block_given?
@@ -54,7 +57,7 @@ module Jshintrb
54
57
  end
55
58
  task name do
56
59
  unless js_file_list.empty?
57
- result = Jshintrb::report(js_file_list, @options, STDERR)
60
+ result = Jshintrb::report(js_file_list, @options, @globals, STDERR)
58
61
  if result.size > 0
59
62
  abort("JSHint check failed") if fail_on_error
60
63
  end
File without changes
File without changes
@@ -1,4 +1,4 @@
1
1
  module Jshintrb
2
- VERSION = "0.2.1"
3
- SUBMODULE = "4cfed1e1f105f7ccb404032a32046c0c857aab99"
2
+ VERSION = "0.2.2"
3
+ SUBMODULE = "f31118b78877f2c64b07a30934424512762e6af7"
4
4
  end
File without changes
metadata CHANGED
@@ -1,71 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jshintrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
5
- prerelease:
4
+ version: 0.2.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - stereobooster
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-08-29 00:00:00.000000000 Z
11
+ date: 2013-05-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
- requirement: &77946620 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
- version_requirements: *77946620
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: submodule
27
- requirement: &77946130 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: 0.0.3
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *77946130
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.0.3
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: rake
38
- requirement: &77945850 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ! '>='
45
+ - - '>='
42
46
  - !ruby/object:Gem::Version
43
47
  version: '0'
44
48
  type: :runtime
45
49
  prerelease: false
46
- version_requirements: *77945850
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: multi_json
49
- requirement: &77944870 !ruby/object:Gem::Requirement
50
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ! '>='
59
+ - - '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '1.3'
55
62
  type: :runtime
56
63
  prerelease: false
57
- version_requirements: *77944870
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: execjs
60
- requirement: &77943970 !ruby/object:Gem::Requirement
61
- none: false
71
+ requirement: !ruby/object:Gem::Requirement
62
72
  requirements:
63
- - - ! '>='
73
+ - - '>='
64
74
  - !ruby/object:Gem::Version
65
75
  version: '0'
66
76
  type: :runtime
67
77
  prerelease: false
68
- version_requirements: *77943970
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: Ruby wrapper for JSHint. The main difference from jshint gem it does
70
84
  not depend on Java. Instead, it uses ExecJS
71
85
  email:
@@ -78,6 +92,7 @@ files:
78
92
  - .gitmodules
79
93
  - .travis.yml
80
94
  - Gemfile
95
+ - LICENSE
81
96
  - README.md
82
97
  - Rakefile
83
98
  - jshintrb.gemspec
@@ -89,27 +104,27 @@ files:
89
104
  - lib/jshintrb/version.rb
90
105
  - spec/jshintrb_spec.rb
91
106
  homepage: https://github.com/stereobooster/jshintrb
92
- licenses: []
107
+ licenses:
108
+ - MIT
109
+ metadata: {}
93
110
  post_install_message:
94
111
  rdoc_options: []
95
112
  require_paths:
96
113
  - lib
97
114
  required_ruby_version: !ruby/object:Gem::Requirement
98
- none: false
99
115
  requirements:
100
- - - ! '>='
116
+ - - '>='
101
117
  - !ruby/object:Gem::Version
102
118
  version: '0'
103
119
  required_rubygems_version: !ruby/object:Gem::Requirement
104
- none: false
105
120
  requirements:
106
- - - ! '>='
121
+ - - '>='
107
122
  - !ruby/object:Gem::Version
108
123
  version: '0'
109
124
  requirements: []
110
125
  rubyforge_project:
111
- rubygems_version: 1.8.11
126
+ rubygems_version: 2.0.3
112
127
  signing_key:
113
- specification_version: 3
128
+ specification_version: 4
114
129
  summary: Ruby wrapper for JSHint
115
130
  test_files: []