coffeelint 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 344ed179d709d31cb9cfc849b08bfee88b8aec30
4
- data.tar.gz: 505057ae769bedb0e2703c0190cb3bf248a68e3e
3
+ metadata.gz: c911352ec2b63e923e39d097f0e77bfa86e78e11
4
+ data.tar.gz: 48e9f7be428f2c7db10e1842cc44e3b98f39471e
5
5
  SHA512:
6
- metadata.gz: 2d810eeab5acfc59ff90273a0c084dac875a059fc05bba4caf09a3e84b727649d766b7c344f1092d6a92a45c879314c4a5bd7dc2a60b189e97aed0590da755a5
7
- data.tar.gz: c7f271a95c8c5dfc6c9b85b77bdab7f4f3c973380877415adab41fb7bee057add6fe00bc60bee59119987149a332fb9f8b2d6615d3563e6e8a03983dc8ddc831
6
+ metadata.gz: c9514800789c878c521b808a94e1f9220bd5686f70a392915acfd482495b77878a3729ea65db813809986abd6866bf569be40ea8934d6241e0d641e52c9346c7
7
+ data.tar.gz: 3e23fb9822c1e448cdf0f15c563bd87d6f9a4e65a728a1dc1e696c2d28a141c1ae7d8c9c2f0030f03e35b408e460974f29fb36d250b5e6bfb634bde0e1ac5b19
data/.gitmodules CHANGED
@@ -1,3 +1,3 @@
1
1
  [submodule "coffeelint"]
2
2
  path = coffeelint
3
- url = git://github.com/zmbush/coffeelint.git
3
+ url = git://github.com/clutchski/coffeelint.git
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Coffeelint [![Build Status](https://travis-ci.org/zmbush/coffeelint-ruby.svg?branch=master)](https://travis-ci.org/zmbush/coffeelint-ruby) [![Gem Version](https://badge.fury.io/rb/coffeelint.png)](http://badge.fury.io/rb/coffeelint)
2
2
 
3
- Using coffeelint version: v1.2.0-6-g20613f6
3
+ Using coffeelint version: v1.3.0
4
4
 
5
5
  Coffeelint is a set of simple ruby bindings for [coffeelint](https://github.com/clutchski/coffeelint).
6
6
 
@@ -2,7 +2,7 @@
2
2
  module.exports={
3
3
  "name": "coffeelint",
4
4
  "description": "Lint your CoffeeScript",
5
- "version": "1.2.0",
5
+ "version": "1.3.0",
6
6
  "homepage": "http://www.coffeelint.org",
7
7
  "keywords": [
8
8
  "lint",
@@ -460,6 +460,8 @@ coffeelint.registerRule(_dereq_('./rules/no_debugger.coffee'));
460
460
 
461
461
  coffeelint.registerRule(_dereq_('./rules/no_interpolation_in_single_quotes.coffee'));
462
462
 
463
+ coffeelint.registerRule(_dereq_('./rules/no_empty_functions.coffee'));
464
+
463
465
  hasSyntaxError = function(source) {
464
466
  try {
465
467
  CoffeeScript.tokens(source);
@@ -556,7 +558,7 @@ coffeelint.lint = function(source, userConfig, literate) {
556
558
  };
557
559
 
558
560
 
559
- },{"./../package.json":1,"./ast_linter.coffee":2,"./lexical_linter.coffee":5,"./line_linter.coffee":6,"./rules.coffee":7,"./rules/arrow_spacing.coffee":8,"./rules/camel_case_classes.coffee":9,"./rules/colon_assignment_spacing.coffee":10,"./rules/cyclomatic_complexity.coffee":11,"./rules/duplicate_key.coffee":12,"./rules/empty_constructor_needs_parens.coffee":13,"./rules/indentation.coffee":14,"./rules/line_endings.coffee":15,"./rules/max_line_length.coffee":16,"./rules/missing_fat_arrows.coffee":17,"./rules/newlines_after_classes.coffee":18,"./rules/no_backticks.coffee":19,"./rules/no_debugger.coffee":20,"./rules/no_empty_param_list.coffee":21,"./rules/no_implicit_braces.coffee":22,"./rules/no_implicit_parens.coffee":23,"./rules/no_interpolation_in_single_quotes.coffee":24,"./rules/no_plusplus.coffee":25,"./rules/no_stand_alone_at.coffee":26,"./rules/no_tabs.coffee":27,"./rules/no_throwing_strings.coffee":28,"./rules/no_trailing_semicolons.coffee":29,"./rules/no_trailing_whitespace.coffee":30,"./rules/no_unnecessary_double_quotes.coffee":31,"./rules/no_unnecessary_fat_arrows.coffee":32,"./rules/non_empty_constructor_needs_parens.coffee":33,"./rules/space_operators.coffee":34}],5:[function(_dereq_,module,exports){
561
+ },{"./../package.json":1,"./ast_linter.coffee":2,"./lexical_linter.coffee":5,"./line_linter.coffee":6,"./rules.coffee":7,"./rules/arrow_spacing.coffee":8,"./rules/camel_case_classes.coffee":9,"./rules/colon_assignment_spacing.coffee":10,"./rules/cyclomatic_complexity.coffee":11,"./rules/duplicate_key.coffee":12,"./rules/empty_constructor_needs_parens.coffee":13,"./rules/indentation.coffee":14,"./rules/line_endings.coffee":15,"./rules/max_line_length.coffee":16,"./rules/missing_fat_arrows.coffee":17,"./rules/newlines_after_classes.coffee":18,"./rules/no_backticks.coffee":19,"./rules/no_debugger.coffee":20,"./rules/no_empty_functions.coffee":21,"./rules/no_empty_param_list.coffee":22,"./rules/no_implicit_braces.coffee":23,"./rules/no_implicit_parens.coffee":24,"./rules/no_interpolation_in_single_quotes.coffee":25,"./rules/no_plusplus.coffee":26,"./rules/no_stand_alone_at.coffee":27,"./rules/no_tabs.coffee":28,"./rules/no_throwing_strings.coffee":29,"./rules/no_trailing_semicolons.coffee":30,"./rules/no_trailing_whitespace.coffee":31,"./rules/no_unnecessary_double_quotes.coffee":32,"./rules/no_unnecessary_fat_arrows.coffee":33,"./rules/non_empty_constructor_needs_parens.coffee":34,"./rules/space_operators.coffee":35}],5:[function(_dereq_,module,exports){
560
562
  var BaseLinter, LexicalLinter, TokenApi,
561
563
  __hasProp = {}.hasOwnProperty,
562
564
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
@@ -1353,7 +1355,7 @@ module.exports = MaxLineLength = (function() {
1353
1355
  var limitComments, lineLength, max, _ref, _ref1;
1354
1356
  max = (_ref = lineApi.config[this.rule.name]) != null ? _ref.value : void 0;
1355
1357
  limitComments = (_ref1 = lineApi.config[this.rule.name]) != null ? _ref1.limitComments : void 0;
1356
- lineLength = line.length;
1358
+ lineLength = line.trimRight().length;
1357
1359
  if (lineApi.isLiterate() && regexes.literateComment.test(line)) {
1358
1360
  lineLength -= 2;
1359
1361
  }
@@ -1571,6 +1573,50 @@ module.exports = NoDebugger = (function() {
1571
1573
 
1572
1574
 
1573
1575
  },{}],21:[function(_dereq_,module,exports){
1576
+ var NoEmptyFunctions, isEmptyCode;
1577
+
1578
+ isEmptyCode = function(node, astApi) {
1579
+ var nodeName;
1580
+ nodeName = astApi.getNodeName(node);
1581
+ return nodeName === 'Code' && node.body.isEmpty();
1582
+ };
1583
+
1584
+ module.exports = NoEmptyFunctions = (function() {
1585
+ function NoEmptyFunctions() {}
1586
+
1587
+ NoEmptyFunctions.prototype.rule = {
1588
+ name: 'no_empty_functions',
1589
+ level: 'ignore',
1590
+ message: 'Empty function',
1591
+ description: "Disallows declaring empty functions. The goal of this rule is that\nunintentional empty callbacks can be detected:\n<pre>\n<code>someFunctionWithCallback ->\ndoSomethingSignificant()\n</code>\n</pre>\nThe problem is that the call to\n<tt>doSomethingSignificant</tt> will be made regardless\nof <tt>someFunctionWithCallback</tt>'s execution. It can\nbe because you did not indent the call to\n<tt>doSomethingSignificant</tt> properly.\n\nIf you really meant that <tt>someFunctionWithCallback</tt>\nshould call a callback that does nothing, you can write your code\nthis way:\n<pre>\n<code>someFunctionWithCallback ->\n undefined\ndoSomethingSignificant()\n</code>\n</pre>"
1592
+ };
1593
+
1594
+ NoEmptyFunctions.prototype.lintAST = function(node, astApi) {
1595
+ this.lintNode(node, astApi);
1596
+ return void 0;
1597
+ };
1598
+
1599
+ NoEmptyFunctions.prototype.lintNode = function(node, astApi) {
1600
+ var error;
1601
+ if (isEmptyCode(node, astApi)) {
1602
+ error = astApi.createError({
1603
+ lineNumber: node.locationData.first_line + 1
1604
+ });
1605
+ this.errors.push(error);
1606
+ }
1607
+ return node.eachChild((function(_this) {
1608
+ return function(child) {
1609
+ return _this.lintNode(child, astApi);
1610
+ };
1611
+ })(this));
1612
+ };
1613
+
1614
+ return NoEmptyFunctions;
1615
+
1616
+ })();
1617
+
1618
+
1619
+ },{}],22:[function(_dereq_,module,exports){
1574
1620
  var NoEmptyParamList;
1575
1621
 
1576
1622
  module.exports = NoEmptyParamList = (function() {
@@ -1596,7 +1642,7 @@ module.exports = NoEmptyParamList = (function() {
1596
1642
  })();
1597
1643
 
1598
1644
 
1599
- },{}],22:[function(_dereq_,module,exports){
1645
+ },{}],23:[function(_dereq_,module,exports){
1600
1646
  var NoImplicitBraces;
1601
1647
 
1602
1648
  module.exports = NoImplicitBraces = (function() {
@@ -1645,7 +1691,7 @@ module.exports = NoImplicitBraces = (function() {
1645
1691
  })();
1646
1692
 
1647
1693
 
1648
- },{}],23:[function(_dereq_,module,exports){
1694
+ },{}],24:[function(_dereq_,module,exports){
1649
1695
  var NoImplicitParens;
1650
1696
 
1651
1697
  module.exports = NoImplicitParens = (function() {
@@ -1687,7 +1733,7 @@ module.exports = NoImplicitParens = (function() {
1687
1733
  })();
1688
1734
 
1689
1735
 
1690
- },{}],24:[function(_dereq_,module,exports){
1736
+ },{}],25:[function(_dereq_,module,exports){
1691
1737
  var NoInterpolationInSingleQuotes;
1692
1738
 
1693
1739
  module.exports = NoInterpolationInSingleQuotes = (function() {
@@ -1714,7 +1760,7 @@ module.exports = NoInterpolationInSingleQuotes = (function() {
1714
1760
  })();
1715
1761
 
1716
1762
 
1717
- },{}],25:[function(_dereq_,module,exports){
1763
+ },{}],26:[function(_dereq_,module,exports){
1718
1764
  var NoPlusPlus;
1719
1765
 
1720
1766
  module.exports = NoPlusPlus = (function() {
@@ -1740,7 +1786,7 @@ module.exports = NoPlusPlus = (function() {
1740
1786
  })();
1741
1787
 
1742
1788
 
1743
- },{}],26:[function(_dereq_,module,exports){
1789
+ },{}],27:[function(_dereq_,module,exports){
1744
1790
  var NoStandAloneAt;
1745
1791
 
1746
1792
  module.exports = NoStandAloneAt = (function() {
@@ -1776,7 +1822,7 @@ module.exports = NoStandAloneAt = (function() {
1776
1822
  })();
1777
1823
 
1778
1824
 
1779
- },{}],27:[function(_dereq_,module,exports){
1825
+ },{}],28:[function(_dereq_,module,exports){
1780
1826
  var NoTabs, indentationRegex,
1781
1827
  __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
1782
1828
 
@@ -1807,7 +1853,7 @@ module.exports = NoTabs = (function() {
1807
1853
  })();
1808
1854
 
1809
1855
 
1810
- },{}],28:[function(_dereq_,module,exports){
1856
+ },{}],29:[function(_dereq_,module,exports){
1811
1857
  var NoThrowingStrings;
1812
1858
 
1813
1859
  module.exports = NoThrowingStrings = (function() {
@@ -1834,7 +1880,7 @@ module.exports = NoThrowingStrings = (function() {
1834
1880
  })();
1835
1881
 
1836
1882
 
1837
- },{}],29:[function(_dereq_,module,exports){
1883
+ },{}],30:[function(_dereq_,module,exports){
1838
1884
  var NoTrailingSemicolons, regexes,
1839
1885
  __slice = [].slice;
1840
1886
 
@@ -1883,7 +1929,7 @@ module.exports = NoTrailingSemicolons = (function() {
1883
1929
  })();
1884
1930
 
1885
1931
 
1886
- },{}],30:[function(_dereq_,module,exports){
1932
+ },{}],31:[function(_dereq_,module,exports){
1887
1933
  var NoTrailingWhitespace, regexes;
1888
1934
 
1889
1935
  regexes = {
@@ -1946,7 +1992,7 @@ module.exports = NoTrailingWhitespace = (function() {
1946
1992
  })();
1947
1993
 
1948
1994
 
1949
- },{}],31:[function(_dereq_,module,exports){
1995
+ },{}],32:[function(_dereq_,module,exports){
1950
1996
  var NoUnnecessaryDoubleQuotes;
1951
1997
 
1952
1998
  module.exports = NoUnnecessaryDoubleQuotes = (function() {
@@ -1999,7 +2045,7 @@ module.exports = NoUnnecessaryDoubleQuotes = (function() {
1999
2045
  })();
2000
2046
 
2001
2047
 
2002
- },{}],32:[function(_dereq_,module,exports){
2048
+ },{}],33:[function(_dereq_,module,exports){
2003
2049
  var NoUnnecessaryFatArrows, any,
2004
2050
  __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
2005
2051
 
@@ -2076,7 +2122,7 @@ module.exports = NoUnnecessaryFatArrows = (function() {
2076
2122
  })();
2077
2123
 
2078
2124
 
2079
- },{}],33:[function(_dereq_,module,exports){
2125
+ },{}],34:[function(_dereq_,module,exports){
2080
2126
  var NonEmptyConstructorNeedsParens, ParentClass,
2081
2127
  __hasProp = {}.hasOwnProperty,
2082
2128
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
@@ -2108,7 +2154,7 @@ module.exports = NonEmptyConstructorNeedsParens = (function(_super) {
2108
2154
  })(ParentClass);
2109
2155
 
2110
2156
 
2111
- },{"./empty_constructor_needs_parens.coffee":13}],34:[function(_dereq_,module,exports){
2157
+ },{"./empty_constructor_needs_parens.coffee":13}],35:[function(_dereq_,module,exports){
2112
2158
  var SpaceOperators,
2113
2159
  __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
2114
2160
 
data/lib/coffeelint.rb CHANGED
@@ -69,9 +69,9 @@ module Coffeelint
69
69
  puts " #{good} " + Coffeelint.green(name, pretty_output)
70
70
  return true
71
71
  else
72
- failed = false
72
+ no_failures = true
73
73
  if errors.any? {|e| e["level"] == "error"}
74
- failed = true
74
+ no_failures = false
75
75
  puts " #{bad} " + Coffeelint.red(name, pretty_output)
76
76
  else
77
77
  puts " #{warn} " + Coffeelint.yellow(name, pretty_output)
@@ -93,7 +93,7 @@ module Coffeelint
93
93
  end
94
94
  puts ": #{error["message"]}. #{error["context"]}."
95
95
  end
96
- return failed
96
+ return no_failures
97
97
  end
98
98
  end
99
99
 
@@ -1,3 +1,3 @@
1
1
  module Coffeelint
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coffeelint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Bush
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-09 00:00:00.000000000 Z
11
+ date: 2014-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-script