coffeelint
Advanced tools
Comparing version
@@ -8,5 +8,6 @@ // Generated by CoffeeScript 1.6.2 | ||
LineApi = (function() { | ||
function LineApi(source, config, tokensByLine) { | ||
function LineApi(source, config, tokensByLine, literate) { | ||
this.config = config; | ||
this.tokensByLine = tokensByLine; | ||
this.literate = literate; | ||
this.line = null; | ||
@@ -26,2 +27,6 @@ this.lines = source.split('\n'); | ||
LineApi.prototype.isLiterate = function() { | ||
return this.literate; | ||
}; | ||
LineApi.prototype.maintainClassContext = function(line) { | ||
@@ -102,5 +107,8 @@ if (this.context["class"].inClass) { | ||
function LineLinter(source, config, rules, tokensByLine) { | ||
function LineLinter(source, config, rules, tokensByLine, literate) { | ||
if (literate == null) { | ||
literate = false; | ||
} | ||
LineLinter.__super__.constructor.call(this, source, config, rules); | ||
this.lineApi = new LineApi(source, config, tokensByLine); | ||
this.lineApi = new LineApi(source, config, tokensByLine, literate); | ||
this.block_config = { | ||
@@ -107,0 +115,0 @@ enable: {}, |
@@ -6,2 +6,3 @@ // Generated by CoffeeScript 1.6.2 | ||
regexes = { | ||
literateComment: /^\#\s/, | ||
longUrlComment: /^\s*\#\s*http[^\s]+$/ | ||
@@ -23,7 +24,11 @@ }; | ||
MaxLineLength.prototype.lintLine = function(line, lineApi) { | ||
var limitComments, max, _ref, _ref1; | ||
var limitComments, lineLength, max, _ref, _ref1; | ||
max = (_ref = lineApi.config[this.rule.name]) != null ? _ref.value : void 0; | ||
limitComments = (_ref1 = lineApi.config[this.rule.name]) != null ? _ref1.limitComments : void 0; | ||
if (max && max < line.length && !regexes.longUrlComment.test(line)) { | ||
lineLength = line.length; | ||
if (lineApi.isLiterate() && regexes.literateComment.test(line)) { | ||
lineLength -= 2; | ||
} | ||
if (max && max < lineLength && !regexes.longUrlComment.test(line)) { | ||
if (!limitComments) { | ||
@@ -35,3 +40,3 @@ if (lineApi.getLineTokens().length === 0) { | ||
return { | ||
context: "Length is " + line.length + ", max is " + max | ||
context: "Length is " + lineLength + ", max is " + max | ||
}; | ||
@@ -38,0 +43,0 @@ } |
{ | ||
"name": "coffeelint", | ||
"description": "Lint your CoffeeScript", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"homepage": "http://www.coffeelint.org", | ||
@@ -25,3 +25,3 @@ "keywords": [ | ||
"optimist": ">=0.2.8", | ||
"coffee-script": ">=1.6.0", | ||
"coffee-script": "1.6.x", | ||
"glob": ">=3.1.9", | ||
@@ -28,0 +28,0 @@ "browserify": "~2.26.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
237803
0.45%4134
0.58%- Removed
Updated