Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use CoffeeLint

  • Loading branch information...
commit 395dea38e7bf16ef7f5bfc8f7be043cd6f67a45b 1 parent ac818fc
@bergie bergie authored
View
6 package.json
@@ -31,7 +31,8 @@
"cheerio": "0.7.x",
"request": "2.x.x",
"js-yaml": "0.3.x",
- "json2yaml": "1.x.x"
+ "json2yaml": "1.x.x",
+ "coffeelint": "*"
},
"main": "./lib/NoFlo",
"bin": {
@@ -43,7 +44,8 @@
"url": "git://github.com/bergie/noflo.git"
},
"scripts": {
- "test": "./node_modules/nodeunit/bin/nodeunit test"
+ "pretest": "./node_modules/.bin/coffeelint -f test/coffeelint.json -r src",
+ "test": "./node_modules/.bin/nodeunit test"
},
"docco_husky": {
"output_dir": "docs",
View
2  src/bin/noflo.coffee
@@ -19,7 +19,7 @@ cli.parse
cli.main (args, options) ->
if options.interactive
process.argv = [process.argv[0], process.argv[1]]
- shell = require "#{nofloRoot}/lib/shell"
+ shell = require "#{nofloRoot}/lib/shell"
return unless cli.args.length
for arg in cli.args
View
4 src/components/CompileString.coffee
@@ -6,7 +6,7 @@ class CompileString extends noflo.Component
@delimiter = "\n"
@data = []
- @inPorts =
+ @inPorts =
delimiter: new noflo.Port
in: new noflo.Port
@outPorts =
@@ -16,7 +16,7 @@ class CompileString extends noflo.Component
@delimiter = data
@inPorts.in.on 'begingroup', (group) =>
- @outPorts.out.beginGroup group
+ @outPorts.out.beginGroup group
@inPorts.in.on 'data', (data) =>
@data.push data
View
2  src/components/DuplicateProperty.coffee
@@ -33,7 +33,7 @@ class DuplicateProperty extends noflo.Component
propParts = prop.split "="
if propParts.length > 2
- @properties[propParts.pop()] = propParts
+ @properties[propParts.pop()] = propParts
return
@properties[propParts[1]] = propParts[0]
View
2  src/components/FlattenObject.coffee
@@ -31,7 +31,7 @@ class FlattenObject extends noflo.Component
mapKeys: (object) ->
for key, map of @map
- object[map] = object.flattenedKeys[key]
+ object[map] = object.flattenedKeys[key]
delete object.flattenedKeys
return object
View
4 src/components/GetObjectKey.coffee
@@ -43,8 +43,8 @@ class GetObjectKey extends noflo.Component
@outPorts.out.disconnect()
getKey: (data) ->
- throw "Key not defined" unless @key.length
- throw "Data is not an object" unless typeof data is "object"
+ throw new Error "Key not defined" unless @key.length
+ throw new Error "Data is not an object" unless typeof data is "object"
for key in @key
continue unless data[key]
@outPorts.out.beginGroup key unless @key.length is 1
View
2  src/components/Graph.coffee
@@ -54,7 +54,7 @@ class Graph extends noflo.Component
replicatePort: (port) ->
return new noflo.ArrayPort() if port instanceof noflo.ArrayPort
- return new noflo.Port() unless port instanceof noflo.ArrayPort
+ return new noflo.Port() unless port instanceof noflo.ArrayPort
replicateInPort: (port, portName) ->
newPort = @replicatePort port
newPort.on "attach", (socket) ->
View
6 src/components/GroupByObjectKey.coffee
@@ -17,7 +17,7 @@ class GroupByObjectKey extends noflo.Component
@outPorts.out.beginGroup group
@inPorts.in.on "data", (data) =>
return @getKey data if @key
- @data.push data
+ @data.push data
@inPorts.in.on "endgroup", =>
@outPorts.out.endGroup()
@inPorts.in.on "disconnect", =>
@@ -42,8 +42,8 @@ class GroupByObjectKey extends noflo.Component
@outPorts.out.disconnect()
getKey: (data) ->
- throw "Key not defined" unless @key
- throw "Data is not an object" unless typeof data is "object"
+ throw new Error "Key not defined" unless @key
+ throw new Error "Data is not an object" unless typeof data is "object"
group = data[@key]
unless typeof data[@key] is "string"
View
2  src/components/Kick.coffee
@@ -4,7 +4,7 @@ class Kick extends noflo.Component
description: "This component generates a single packet and sends in to the output port. Mostly usable for debugging, but can also be useful for starting up networks."
constructor: ->
- @inPorts =
+ @inPorts =
in: new noflo.Port()
@outPorts =
View
2  src/components/Output.coffee
@@ -26,7 +26,7 @@ class Output extends noflo.Component
@setOptions data
setOptions: (options) ->
- throw "Options is not an object" unless typeof options is "object"
+ throw new Error "Options is not an object" unless typeof options is "object"
for own key, value of options
@options[key] = value
View
2  src/components/ParseXml.coffee
@@ -25,7 +25,7 @@ class ParseXml extends noflo.Component
@setOptions data
setOptions: (options) ->
- throw "Options is not an object" unless typeof options is "object"
+ throw new Error "Options is not an object" unless typeof options is "object"
for own key, value of options
@options[key] = value
View
2  src/components/ReadDocument.coffee
@@ -29,7 +29,7 @@ class ReadDocument extends noflo.Component
tika.stdout.on "data", (data) =>
@outPorts.out.send data
tika.stderr.on "data", (data) ->
- error += data
+ error += data
tika.on "exit", (code) =>
if code > 0
@outPorts.error.send error
View
2  src/components/SplitStr.coffee
@@ -18,7 +18,7 @@ class SplitStr extends noflo.Component
@inPorts.delimiter.on "data", (data) =>
@delimiterString = data
@inPorts.in.on "data", (data) =>
- @string += data
+ @string += data
@inPorts.in.on "disconnect", (data) =>
@string.split(@delimiterString).forEach (line) =>
@outPorts.out.send line
View
4 src/components/WebService/Basecamp/ConvertToJson.coffee
@@ -23,7 +23,7 @@ class ConvertToJson extends noflo.Component
return @convertTask data if data['completed'] and data['todo-list-id']
return @convertHour data if data['hours'] and data['person-id']
- json =
+ json =
"@type": "prj:Project"
"@subject": "#{@id}projects/#{data.id['#']}"
"prj:name": data.name
@@ -32,7 +32,7 @@ class ConvertToJson extends noflo.Component
"dc:modified": data['last-changed-on']['#']
convertTaskList: (data) ->
- json =
+ json =
"@type": "prj:TaskList"
"@subject": "#{@id}todo_lists/#{data.id['#']}"
"prj:name": data.name
View
2  src/components/WebService/Basecamp/ReadProjects.coffee
@@ -8,7 +8,7 @@ class ReadProjects extends base.BasecampComponent
out: new noflo.Port()
@inPorts.apikey.on "disconnect", =>
- do @readProject if @hostname
+ do @readProject if @hostname
@inPorts.hostname.on "disconnect", =>
do @readProject if @apikey
View
2  src/components/WebService/CouchDB/GetChanges.coffee
@@ -62,6 +62,6 @@ class GetChanges extends noflo.Component
@request.on "end", =>
# TODO: Try to reconnect?
- @outPorts.out.disconnect()
+ @outPorts.out.disconnect()
exports.getComponent = -> new GetChanges
View
2  src/components/WebService/CouchDB/WriteDocument.coffee
@@ -25,7 +25,7 @@ class WriteDocument extends noflo.Component
return unless @outPorts.out.isAttached()
for port in @inPorts.in
return if port.isConnected()
- @outPorts.out.disconnect()
+ @outPorts.out.disconnect()
saveObject: (object) ->
@connection.save object, (err, document) =>
View
14 src/lib/Fbp.coffee
@@ -38,30 +38,30 @@ class Fbp
checkTerminator = @matchSeparator.exec(char)
checkTerminator = null if @currentElement is "initial"
- currentString += char unless checkTerminator
+ currentString += char unless checkTerminator
continue unless checkTerminator or index is string.length - 1
connection = @matchConnection.exec currentString
if connection
- throw "Port or initial expected, got #{currentString} on line #{@currentLine}" unless @lastElement is "initial" or @lastElement is "port"
+ throw new Error "Port or initial expected, got #{currentString} on line #{@currentLine}" unless @lastElement is "initial" or @lastElement is "port"
@lastElement = "connection"
@handleConnection connection
currentString = ""
initial = @matchInitial.exec currentString
if initial
- throw "Newline expected, got #{currentString} on line #{@currentLine}" unless @lastElement is null
+ throw new Error "Newline expected, got #{currentString} on line #{@currentLine}" unless @lastElement is null
@lastElement = "initial"
@handleInitial initial
currentString = ""
component = @matchComponent.exec currentString
if component
- throw "Port or newline expected, got #{currentString} on line #{@currentLine}" unless @lastElement is "port" or @lastElement is null
+ throw new Error "Port or newline expected, got #{currentString} on line #{@currentLine}" unless @lastElement is "port" or @lastElement is null
@lastElement = "component"
@handleComponent component
currentString = ""
port = @matchPort.exec currentString
if port
- throw "Connection or component expected, got #{currentString} on line #{@currentLine}" unless @lastElement is "connection" or @lastElement is "component"
+ throw new Error "Connection or component expected, got #{currentString} on line #{@currentLine}" unless @lastElement is "connection" or @lastElement is "component"
@lastElement = "port"
@handlePort port
currentString = ""
@@ -70,7 +70,7 @@ class Fbp
@lastElement = null
json =
- properties:
+ properties:
name: ""
processes: @nodes
connections: @edges
@@ -97,7 +97,7 @@ class Fbp
if @currentEdge.tgt and @currentEdge.tgt.port
@currentEdge.tgt.process = @currentNode.name
@edges.push @currentEdge
- @currentEdge =
+ @currentEdge =
src: {}
tgt: {}
return
View
10 src/lib/Graph.coffee
@@ -36,7 +36,7 @@ class Graph extends events.EventEmitter
# possible display coordinates.
#
# For example:
- #
+ #
# myGraph.addNode 'Read, 'ReadFile',
# x: 91
# y: 154
@@ -115,7 +115,7 @@ class Graph extends events.EventEmitter
# myGraph.removeEdge 'Read', 'out'
#
# or:
- #
+ #
# myGraph.removeEdge 'Display', 'in'
#
# Removing a connection will emit the `removeEdge` event.
@@ -167,7 +167,7 @@ class Graph extends events.EventEmitter
dot += " #{cleanID(node.id)} [shape=box]\n"
for initializer, id in @initializers
- dot += " data#{id} -> #{cleanID(initializer.to.node)} [label='#{cleanPort(initializer.to.port)}']\n"
+ dot += " data#{id} -> #{cleanID(initializer.to.node)} [label='#{cleanPort(initializer.to.port)}']\n"
for edge in @edges
dot += " #{cleanID(edge.from.node)} -> #{cleanID(edge.to.node)}[label='#{cleanPort(edge.from.port)}']\n"
@@ -180,14 +180,14 @@ class Graph extends events.EventEmitter
yuml = []
for initializer in @initializers
- yuml.push "(start)[#{initializer.to.port}]->(#{initializer.to.node})";
+ yuml.push "(start)[#{initializer.to.port}]->(#{initializer.to.node})"
for edge in @edges
yuml.push "(#{edge.from.node})[#{edge.from.port}]->(#{edge.to.node})"
yuml.join ","
toJSON: ->
- json =
+ json =
properties:
name: @name
processes: {}
View
4 src/lib/NoFlo.coffee
@@ -76,7 +76,7 @@ class NoFlo
implementation.getComponent()
# ## Add a process to the network
- #
+ #
# Processes can be added to a network at either start-up time
# or later. The processes are added with a node definition object
# that includes the following properties:
@@ -95,7 +95,7 @@ class NoFlo
if node.component
process.component = @load node.component
- # Store and return the process instance
+ # Store and return the process instance
@processes[process.id] = process
removeNode: (node) ->
View
4 src/lib/Server.coffee
@@ -7,7 +7,7 @@ prepareNetwork = (network, id) ->
cleanNetwork =
id: id
name: network.graph.name
- started: network.startupDate
+ started: network.startupDate
nodes: []
edges: []
@@ -16,7 +16,7 @@ prepareNetwork = (network, id) ->
combined = network.graph.edges.concat network.graph.initializers
for edge, index in combined
- cleanNetwork.edges.push prepareEdge edge, index
+ cleanNetwork.edges.push prepareEdge edge, index
cleanNetwork
Please sign in to comment.
Something went wrong with that request. Please try again.