coffeelint
Version:
Lint your CoffeeScript
611 lines (544 loc) • 22.1 kB
Plain Text
> coffeelint@1.1.0 pretest /home/asa/coffeelint
> cake compile
Compiling Coffeelint...
> coffeelint@1.1.0 test /home/asa/coffeelint
> coffee vowsrunner.coffee --spec test/*.coffee test/*.litcoffee
♢ CoffeeScript 1.5.0+
lineNumber has become an object
✓ work with 1.5.0+ tokens
for indentation last_line is the correct value for lineNumber
✓ works with 1.5.0+
✓ Cleanup
♢ arrows
No spacing around the arrow operator
✓ will return an error
✓ will be ignored (no error)
Handles good spacing when parentheses are generated
✗ when spacing is not required around arrow operator
» expected [
{
name: 'indentation',
value: 2,
level: 'error',
message: 'Line contains inconsistent indentation',
description: "This rule imposes a standard number of spaces to be used for\nindentation. Since whitespace is significant in CoffeeScript, it's\ncritical that a project chooses a standard indentation format and\nstays consistent. Other roads lead to darkness. <pre> <code>#\nEnabling this option will prevent this ugly\n# but otherwise valid CoffeeScript.\ntwoSpaces = () ->\n fourSpaces = () ->\n eightSpaces = () ->\n 'this is valid CoffeeScript'\n\n</code>\n</pre>\nTwo space indentation is enabled by default.",
context: 'http://bit.ly/1fXiTIm CoffeeLint has problems with indented chains',
lineNumber: 2,
line: ' .around ->',
rule: 'indentation'
},
{
name: 'indentation',
value: 2,
level: 'error',
message: 'Line contains inconsistent indentation',
description: "This rule imposes a standard number of spaces to be used for\nindentation. Since whitespace is significant in CoffeeScript, it's\ncritical that a project chooses a standard indentation format and\nstays consistent. Other roads lead to darkness. <pre> <code>#\nEnabling this option will prevent this ugly\n# but otherwise valid CoffeeScript.\ntwoSpaces = () ->\n fourSpaces = () ->\n eightSpaces = () ->\n 'this is valid CoffeeScript'\n\n</code>\n</pre>\nTwo space indentation is enabled by default.",
context: 'http://bit.ly/1fXiTIm CoffeeLint has problems with indented chains',
lineNumber: 6,
line: ' .around ->',
rule: 'indentation'
},
{
name: 'indentation',
value: 2,
level: 'error',
message: 'Line contains inconsistent indentation',
description: "This rule imposes a standard number of spaces to be used for\nindentation. Since whitespace is significant in CoffeeScript, it's\ncritical that a project chooses a standard indentation format and\nstays consistent. Other roads lead to darkness. <pre> <code>#\nEnabling this option will prevent this ugly\n# but otherwise valid CoffeeScript.\ntwoSpaces = () ->\n fourSpaces = () ->\n eightSpaces = () ->\n 'this is valid CoffeeScript'\n\n</code>\n</pre>\nTwo space indentation is enabled by default.",
context: 'http://bit.ly/1fXiTIm CoffeeLint has problems with indented chains',
lineNumber: 10,
line: ' .around -> 4',
rule: 'indentation'
}
] to be empty // test_arrows.coffee:67
✗ when spacing is required around arrow operator
» expected [
{
name: 'indentation',
value: 2,
level: 'error',
message: 'Line contains inconsistent indentation',
description: "This rule imposes a standard number of spaces to be used for\nindentation. Since whitespace is significant in CoffeeScript, it's\ncritical that a project chooses a standard indentation format and\nstays consistent. Other roads lead to darkness. <pre> <code>#\nEnabling this option will prevent this ugly\n# but otherwise valid CoffeeScript.\ntwoSpaces = () ->\n fourSpaces = () ->\n eightSpaces = () ->\n 'this is valid CoffeeScript'\n\n</code>\n</pre>\nTwo space indentation is enabled by default.",
context: 'http://bit.ly/1fXiTIm CoffeeLint has problems with indented chains',
lineNumber: 2,
line: ' .around ->',
rule: 'indentation'
},
{
name: 'indentation',
value: 2,
level: 'error',
message: 'Line contains inconsistent indentation',
description: "This rule imposes a standard number of spaces to be used for\nindentation. Since whitespace is significant in CoffeeScript, it's\ncritical that a project chooses a standard indentation format and\nstays consistent. Other roads lead to darkness. <pre> <code>#\nEnabling this option will prevent this ugly\n# but otherwise valid CoffeeScript.\ntwoSpaces = () ->\n fourSpaces = () ->\n eightSpaces = () ->\n 'this is valid CoffeeScript'\n\n</code>\n</pre>\nTwo space indentation is enabled by default.",
context: 'http://bit.ly/1fXiTIm CoffeeLint has problems with indented chains',
lineNumber: 6,
line: ' .around ->',
rule: 'indentation'
},
{
name: 'indentation',
value: 2,
level: 'error',
message: 'Line contains inconsistent indentation',
description: "This rule imposes a standard number of spaces to be used for\nindentation. Since whitespace is significant in CoffeeScript, it's\ncritical that a project chooses a standard indentation format and\nstays consistent. Other roads lead to darkness. <pre> <code>#\nEnabling this option will prevent this ugly\n# but otherwise valid CoffeeScript.\ntwoSpaces = () ->\n fourSpaces = () ->\n eightSpaces = () ->\n 'this is valid CoffeeScript'\n\n</code>\n</pre>\nTwo space indentation is enabled by default.",
context: 'http://bit.ly/1fXiTIm CoffeeLint has problems with indented chains',
lineNumber: 10,
line: ' .around -> 4',
rule: 'indentation'
}
] to be empty // test_arrows.coffee:75
Handles bad spacing when parentheses are generated
✗ when spacing is required around arrow operator
» expected 3,
got 2 (==) // test_arrows.coffee:102
✗ when spacing is not required around arrow operator
» expected [
{
name: 'indentation',
value: 2,
level: 'error',
message: 'Line contains inconsistent indentation',
description: "This rule imposes a standard number of spaces to be used for\nindentation. Since whitespace is significant in CoffeeScript, it's\ncritical that a project chooses a standard indentation format and\nstays consistent. Other roads lead to darkness. <pre> <code>#\nEnabling this option will prevent this ugly\n# but otherwise valid CoffeeScript.\ntwoSpaces = () ->\n fourSpaces = () ->\n eightSpaces = () ->\n 'this is valid CoffeeScript'\n\n</code>\n</pre>\nTwo space indentation is enabled by default.",
context: 'http://bit.ly/1fXiTIm CoffeeLint has problems with indented chains',
lineNumber: 2,
line: ' .around ->',
rule: 'indentation'
},
{
name: 'indentation',
value: 2,
level: 'error',
message: 'Line contains inconsistent indentation',
description: "This rule imposes a standard number of spaces to be used for\nindentation. Since whitespace is significant in CoffeeScript, it's\ncritical that a project chooses a standard indentation format and\nstays consistent. Other roads lead to darkness. <pre> <code>#\nEnabling this option will prevent this ugly\n# but otherwise valid CoffeeScript.\ntwoSpaces = () ->\n fourSpaces = () ->\n eightSpaces = () ->\n 'this is valid CoffeeScript'\n\n</code>\n</pre>\nTwo space indentation is enabled by default.",
context: 'http://bit.ly/1fXiTIm CoffeeLint has problems with indented chains',
lineNumber: 6,
line: ' .around ->4',
rule: 'indentation'
}
] to be empty // test_arrows.coffee:114
Ignore spacing for non-generated parentheses
✓ when spacing is required around arrow operator
✓ when spacing is not required around arrow operator
Handle an arrow at beginning of statement
✓ when spacing is required around arrow operator
✓ when spacing is not required around arrow operator
Handle a nested arrow at end of file
✓ when spacing is required around arrow operator
✓ when spacing is not required around arrow operator
Handle an arrow at end of file
✓ when spacing is required around arrow operator
✓ when spacing is not required around arrow operator
♢ backticks
Backticks
✓ are forbidden by default
✓ can be permitted
♢ braces
Implicit braces
✓ are allowed by default
✓ can be forbidden
Implicit braces strict
✓ blocks all implicit braces by default
✓ allows braces at the end of lines when strict is false
Implicit braces in class definitions
✓ are always ignored
♢ coffeelint
CoffeeLint's version number
✓ exists
CoffeeLint's errors
✓ are sorted by line number
Errors in the source
✓ are reported
♢ colon_assignment_spacing
Equal spacing around assignment
✓ will not return an error
No space before assignment
✓ will not return an error
Newline to the right of assignment
✓ will not return an error
Improper spacing around assignment
✓ will return an error
✓ will ignore an error
Should not complain about strings
✓ will return an error
♢ commandline
version
✓ exists
with no args
✓ shows usage
with findconfig and local package.json
✓ works
using stdin with working string
✓ passes
with failing source
✓ works
with --rule parameter for a custom plugin
✓ works
with clean source
✓ passes
with module specified for a specific rule
✓ works
with findconfig and local coffeelint.json
✓ works
with broken source
✓ fails
with custom configuration
✓ works
reports using basic reporter with option q not set and errors occured
✓ output
recurses subdirectories
✓ and reports errors
literate coffeescript with failing string due to whitespace
✓ fails
does not fail on warnings
✓ works
reports using basic reporter with option q not set and no errors occured
✓ output
using stdin with failing string due to whitespace
✓ fails
with multiple sources
✓ works
reports using basic reporter with option q set and errors occured
✓ output
using environment config file with non existing enviroment set config file
✓ passes
reports using basic reporter with option q set and no errors occured
✓ no output
allows JSLint XML reporting
✓ Handles cyclomatic complexity check
literate coffeescript with working string
✓ passes
using environment config file with existing enviroment set config file
✓ passes
using environment config file with existing enviroment set config file + --noconfig
✓ fails
with configuration file
✓ works
♢ comment config
Disable statements
✓ can disable rules in your config
Enable statements
✓ can enable rules not in your config
Enable all statements
✓ will re-enable all rules in your config
♢ newparens
Missing Parentheses on "new Foo"
✓ warns about missing parens
Missing Parentheses on "new Foo 1, 2"
✓ warns about missing parens
♢ cyclomatic complexity
Cyclomatic complexity
✓ defaults to ignore
✓ can be enabled
✓ can be enabled with configurable complexity
An empty function
✓ has a complexity of one
If statement
✓ increments the complexity
If Else statement
✓ increments the complexity
If ElseIf statement
✓ has a complexity of three
If If-Else Else statement
✓ has a complexity of three
Nested if statements
✓ has a complexity of three
A while loop
✓ increments complexity
An until loop
✓ increments complexity
A for loop
✓ increments complexity
A list comprehension
✓ increments complexity
Try / Catch blocks
✓ increments complexity
Try / Catch / Finally blocks
✓ increments complexity
Switch statements without an else
✓ increase complexity by the number of cases
Switch statements with an else
✓ increase complexity by the number of cases
And operators
✓ increments the complexity
Or operators
✓ increments the complexity
A complicated example
✓ works
♢ linelength
Duplicate Keys
✓ should error by default
✓ is optional
♢ params
Empty param list
✓ are allowed by default
✓ can be forbidden
♢ identifiers
Camel cased class names
✓ are valid by default
Non camel case class names
✓ are rejected by default
✓ can be permitted
Anonymous class names
✓ are permitted
Inner classes are permitted
✓ are permitted
♢ indent
Indentation
✓ defaults to two spaces
✓ can be overridden
✓ is optional
Nested indentation errors
✓ are caught
Compiler generated indentation
✓ is ignored when not using two spaces
Indentation inside interpolation
✓ is ignored
Indentation in multi-line expressions
✓ is ignored
Indentation across line breaks
✓ is ignored
Indentation on seperate line invocation
✓ can be ignored. Issue #4
✓ errors by default.
Indented chained invocations
✓ can be is permitted
✓ errors by default.
Ignore comment in indented chained invocations
✓ no error when comment is in first line of a chain
✓ errors by default.
Ignore blank line in indented chained invocations
✓ no error when blank line is in first line of a chain
✓ errors by default.
Arbitrarily indented arguments
✓ are permitted
Indenting a callback in a chained call inside a function
✓ is permitted. See issue #88
♢ levels
CoffeeLint
✓ can ignore errors
✓ can return warnings
✓ can return errors
✓ catches unknown levels
♢ line endings
Unix line endings
✓ are allowed by default
✓ can be forbidden
Windows line endings
✓ are allowed by default
✓ can be forbidden
Unknown line endings
✓ throw errors
♢ linelength
Maximum line length
✓ defaults to 80
✓ is configurable
✓ is optional
✓ can ignore comments
Literate Line Length
✓
Maximum length exceptions
✓ excludes long urls
♢ missing_fat_arrows
empty function
✓ does not error for no missing arrows
function without this
✓ does not error for no missing arrows
function with this
✓ errors for missing arrow
function with this.a
✓ errors for missing arrow
function with @
✓ errors for missing arrow
function with @a
✓ errors for missing arrow
functions with multiple statements
✓ errors for missing arrow
functions with parameters
✓ does not error for no missing arrows
functions with parameter assignment
✓ errors for missing arrow
functions with destructuring parameter assignment
✓ errors for missing arrow
nested functions with this inside with inner fat arrow
✓ does not error for no missing arrows
nested functions with this inside with outer fat arrow
✓ errors for missing arrow
nested functions with this inside with both fat arrows
✓ does not error for no missing arrows
nested functions with this outside with inner fat arrow
✓ errors for missing arrow
nested functions with this outside with outer fat arrow
✓ does not error for no missing arrows
nested functions with this outside with both fat arrows
✓ does not error for no missing arrows
deeply nested functions with thin arrow
✓ errors for missing arrow
deeply nested functions with fat arrow
✓ does not error for no missing arrows
deeply nested functions with wrong fat arrow
✓ errors for missing arrow
class instance method without this
✓ does not error for no missing arrows
class instance method with this
✓ does not error for no missing arrows
class method without this
✓ does not error for no missing arrows
class method with this
✓ does not error for no missing arrows
function in class body without this
✓ does not error for no missing arrows
function in class body with this
✓ errors for missing arrow
function inside class instance method without this
✓ does not error for no missing arrows
function inside class instance method with this
✓ errors for missing arrow
mixture of class methods and function in class body with this
✓ does not error for no missing arrows
https://github.com/clutchski/coffeelint/issues/215 method with block comment
✓ does not error for no missing arrows
♢ newlines_after_classes
Classfile ends with end of class
✓ won't match
Class with arbitrary Code following
✓ defaults to ignore newlines_after_classes
✓ has too few newlines after class
✓ has too many newlines after class
✓ works OK
♢ parens
Implicit parens
✓ are allowed by default
✓ can be forbidden
♢ stand alone @
Stand alone @
✓ are allowed by default
✓ can be forbidden
♢ no_unnecessary_fat_arrows
Single quotes
✓ single quotes should always be allowed
Unnecessary double quotes
✓ double quotes are allowed by default
✓ double quotes can be forbidden
Useful double quotes
✓ string interpolation should always be allowed
Block strings with double quotes
✓ block strings with double quotes are not allowed
Block strings with useful double quotes
✓ block strings with useful content should be allowed
Block strings with single quotes
✓ block strings with single quotes should be allowed
Hand concatenated string with parenthesis
✓ double quotes should not be allowed
♢ no unnecessary fat arrows
empty function
✓ errors for unnecessary arrow
simple function
✓ errors for unnecessary arrow
function with this
✓ does not error for necessary arrow
function with this.a
✓ does not error for necessary arrow
function with @
✓ does not error for necessary arrow
function with @a
✓ does not error for necessary arrow
deeply nested simple function
✓ errors for unnecessary arrow
deeply nested function with this
✓ does not error for necessary arrow
functions with multiple statements
✓ errors for unnecessary arrow
functions with parameters
✓ errors for unnecessary arrow
functions with parameter assignment
✓ does not error for necessary arrow
functions with destructuring parameter assignment
✓ does not error for necessary arrow
nested simple functions with inner fat arrow
✓ errors for unnecessary arrow
nested simple functions with outer fat arrow
✓ errors for unnecessary arrow
nested simple functions with both fat arrows
✓ errors for unnecessary arrow
nested functions with this inside with inner fat arrow
✓ does not error for necessary arrow
nested functions with this inside with outer fat arrow
✓ errors for unnecessary arrow
nested functions with this inside with both fat arrows
✓ does not error for necessary arrow
nested functions with this outside with inner fat arrow
✓ errors for unnecessary arrow
nested functions with this outside with outer fat arrow
✓ does not error for necessary arrow
nested functions with this outside with both fat arrows
✓ errors for unnecessary arrow
♢ plusplus
The increment and decrement operators
✓ are permitted by default
✓ can be forbidden
♢ semicolons
Semicolons at end of lines
✓ are forbidden
✓ can be ignored
Semicolons in multiline expressions
✓ are ignored
Trailing semicolon in comments
✓ are ignored
Trailing semicolon in comments with no semicolon in statement
✓ are ignored
✓ will throw an error
Trailing semicolon in comments with semicolon in statement
✓ are ignored
✓ will throw an error
Trailing semicolon in block comments
✓ are ignored
✓ are ignored even if config level is error
Semicolons with windows line endings
✓ works as expected
♢ spacing
No spaces around binary operators
✓ are permitted by default
✓ can be forbidden
Correctly spaced operators
✓ are permitted
Spaces around unary operators
✓ are permitted by default
✓ can be forbidden
♢ tabs
Tabs
✓ can be forbidden
✓ can be permitted
✓ are forbidden by default
✓ are allowed in strings
Tabs in multi-line strings
✓ are ignored
Tabs in Heredocs
✓ are ignored
Tabs in multi line regular expressions
✓ are ignored
♢ throw
Throwing strings
✓ is forbidden by default
✓ can be permitted
♢ trailing
Trailing whitespace
✓ is forbidden by default
✓ can be permitted
Trailing whitespace in comments
✓ is forbidden by default
✓ can be permitted
a # in a string
✓ does not confuse trailing_whitespace
Trailing whitespace in block comments
✓ is forbidden by default
✓ can be permitted
On empty lines
✓ allowed by default
✓ can be forbidden
Trailing tabs
✓ are forbidden as well
Windows line endings
✓ are permitted
♢ literate
Trailing whitespace in markdown
✓ is ignored
✗ Broken » 228 honored ∙ 4 broken (1.173s)