Skip to content

Commit

Permalink
fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon-fryslie committed Mar 28, 2016
1 parent 640de09 commit 85b655a
Show file tree
Hide file tree
Showing 19 changed files with 187 additions and 53 deletions.
135 changes: 135 additions & 0 deletions coffeelint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
"arrow_spacing": {
"level": "warn"
},
"braces_spacing": {
"level": "ignore",
"spaces": 0,
"empty_object_spaces": 0
},
"camel_case_classes": {
"level": "error"
},
"coffeescript_error": {
"level": "error"
},
"colon_assignment_spacing": {
"level": "warn",
"spacing": {
"left": 0,
"right": 1
}
},
"cyclomatic_complexity": {
"level": "warn",
"value": 10
},
"duplicate_key": {
"level": "error"
},
"empty_constructor_needs_parens": {
"level": "ignore"
},
"ensure_comprehensions": {
"level": "warn"
},
"eol_last": {
"level": "warn"
},
"indentation": {
"value": 2,
"level": "error"
},
"line_endings": {
"level": "warn",
"value": "unix"
},
"max_line_length": {
"value": 80,
"level": "ignore",
"limitComments": true
},
"missing_fat_arrows": {
"level": "ignore",
"is_strict": false
},
"newlines_after_classes": {
"value": 3,
"level": "warn"
},
"no_backticks": {
"level": "error"
},
"no_debugger": {
"level": "warn",
"console": false
},
"no_empty_functions": {
"level": "warn"
},
"no_empty_param_list": {
"level": "warn"
},
"no_implicit_braces": {
"level": "ignore",
"strict": true
},
"no_implicit_parens": {
"level": "ignore",
"strict": true
},
"no_interpolation_in_single_quotes": {
"level": "warn"
},
"no_nested_string_interpolation": {
"level": "warn"
},
"no_plusplus": {
"level": "ignore"
},
"no_private_function_fat_arrows": {
"level": "warn"
},
"no_stand_alone_at": {
"level": "ignore"
},
"no_tabs": {
"level": "error"
},
"no_this": {
"level": "warn"
},
"no_throwing_strings": {
"level": "error"
},
"no_trailing_semicolons": {
"level": "error"
},
"no_trailing_whitespace": {
"level": "error",
"allowed_in_comments": false,
"allowed_in_empty_lines": true
},
"no_unnecessary_double_quotes": {
"level": "warn"
},
"no_unnecessary_fat_arrows": {
"level": "warn"
},
"non_empty_constructor_needs_parens": {
"level": "ignore"
},
"prefer_english_operator": {
"level": "warn",
"doubleNotLevel": "warn"
},
"space_operators": {
"level": "warn"
},
"spacing_after_comma": {
"level": "warn"
},
"transform_messes_up_line_numbers": {
"level": "warn"
}
}
2 changes: 1 addition & 1 deletion config/tasks/hydra.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = (state) ->
start_message: "on #{'127.0.0.1:4000'.magenta}"
cwd: "#{state.ROOTDIR}/hydra"
shell_env:
ZOOKEEPER_CONNECT:state.zookeeper_address
ZOOKEEPER_CONNECT: state.zookeeper_address
wait_for: /hydra listening on port 4000|(RuntimeException)/
callback: (state, data) ->
[match, exception] = data
Expand Down
5 changes: 2 additions & 3 deletions config/tasks/marshmallow.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = (state, util) ->
alias: 'm'
command: ['lein', 'start-infrastructure']
cwd: "#{state.ROOTDIR}/marshmallow"
wait_for: /ZOOKEEPER INIT:\s*([\w:]+)|(Connection timed out)/
wait_for: /ZOOKEEPER INIT:\s*([\w:]+)|(Connection timed out)/
callback: (state, data) ->
[match, zookeeper_address, error] = data
if error
Expand All @@ -16,5 +16,4 @@ module.exports = (state, util) ->

util.print 'Zookeeper Address:', zookeeper_address.magenta

new_state = util._.assign {}, state, zookeeper_address: zookeeper_address
new_state
zookeeper_address: zookeeper_address
4 changes: 2 additions & 2 deletions config/tasks/pigeon.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ module.exports = (state) ->
start_message: "on #{'127.0.0.1:3200'.magenta}"
cwd: "#{state.ROOTDIR}/pigeon"
shell_env:
ZOOKEEPER_CONNECT:state.zookeeper_address
STACK:state.schema
ZOOKEEPER_CONNECT: state.zookeeper_address
STACK: state.schema
args:
'pigeon-profile':
describe: 'pass a lein profile to pigeon'
Expand Down
2 changes: 1 addition & 1 deletion config/tasks/realtime-nginx.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = (state) ->
wait_for: /Started/
is_running: ->
run_cmd
cmd: ["ps -ax | grep -v grep | grep realtime-nginx-conf"]
cmd: ['ps -ax | grep -v grep | grep realtime-nginx-conf']
cwd: @cwd
pipe_output: false
.on_close.then ([code, signal]) ->
Expand Down
6 changes: 3 additions & 3 deletions config/tasks/zuul.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ module.exports = (state) ->
cwd: "#{state.ROOTDIR}/zuul"
shell_env:
DATASTORE_OVERRIDE: 'db'
ZOOKEEPER_CONNECT:state.zookeeper_address
ZUUL_TENANT_OVERRIDE:state.schema
ZOOKEEPER_CONNECT: state.zookeeper_address
ZUUL_TENANT_OVERRIDE: state.schema
wait_for: /Server started!|(Connection timed out)|(Address already in use)|(All host pools marked down.)/
callback: (state, data) ->
[match, timeout_error, address_in_use_error, host_pool_down_error] = data
if timeout_error || address_in_use_error || host_pool_down_error
if timeout_error or address_in_use_error or host_pool_down_error
util.error 'Error: Zuul failed to connect to Marshmallow:', data.input ? data
state.with_local_zuul = true
state
4 changes: 2 additions & 2 deletions lib/arg_lib.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ cli_options = _.merge.apply _, task_cli_options.concat [config_cli_options, stac
cli_options = replace_keys cli_options, /_/g, '-'

baked_yarg = require('yargs')(process.argv.slice(2))
.usage "#{'Usage:'.yellow} #{'stacker'.magenta} #{ "#{Object.keys(task_configs).join(' ')} ".cyan}#{'[options]'.green }"
.usage "#{'Usage:'.yellow} #{'stacker'.magenta} #{ Object.keys(task_configs).join(' ').cyan}#{'[options]'.green }"
.example "#{'stacker'.magenta} #{'marshmallow zuul burro alm pigeon'.cyan} #{'--with-local-churro'.green}", 'start the realtime stack with local churro'
.updateStrings
'Options:': 'Options:'.green
Expand All @@ -60,7 +60,7 @@ if argv.help
baked_yarg.showHelp 'log'
process.exit 0

if !argv.debug?
if not argv.debug?
delete argv.debug
else if argv.debug.length is 0
argv.debug = true
Expand Down
3 changes: 2 additions & 1 deletion lib/mexpect.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Mexpect
# direct: run command directly (not using bash)
spawn: (opt) =>
{cmd, direct} = opt
opt =_.omit opt, ['cmd', 'direct']
opt = _.omit opt, ['cmd', 'direct']

cmd = if _.isArray(cmd) then cmd else [cmd]
direct ?= false
Expand All @@ -123,6 +123,7 @@ class Mexpect

@


module.exports =
spawn: ->
mexpect = new Mexpect
Expand Down
14 changes: 7 additions & 7 deletions lib/repl_commands.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ processes_running = ->
'No running procs!'.bold.cyan

util.print if _.keys(proc_lib.all_daemons()).length
"\n#{'Daemons'.cyan}\n#{("#{k}\n" for k, v of proc_lib.all_daemons()).join('')}"
"\n#{'Daemons'.cyan}\n#{(k+'\n' for k, v of proc_lib.all_daemons()).join('')}"
else
'No running daemons!'.bold.cyan

Expand All @@ -43,10 +43,10 @@ repl_lib.add_command
name: 'ds'
help: 'status of daemons'
fn: ->
util.print "Daemons".cyan
util.print 'Daemons'.cyan

util.print if _.keys(proc_lib.all_daemons()).length
"#{("#{k}\n" for k, v of proc_lib.all_daemons()).join('')}"
"#{(k+'\n' for k, v of proc_lib.all_daemons()).join('')}"
else
'No running daemons!'.bold.cyan

Expand Down Expand Up @@ -212,8 +212,8 @@ repl_lib.add_command
repl_lib.add_command
name: 'kill'
alias: 'k'
help:'kill a task'
usage:'kill [TASK]'
help: 'kill a task'
usage: 'kill [TASK]'
fn: (target) ->
unless target?
return invalid_command_invocation @
Expand All @@ -223,7 +223,7 @@ repl_lib.add_command
repl_lib.add_command
name: 'killall'
alias: 'ka'
help:'kill all running processes'
help: 'kill all running processes'
fn: task_lib.kill_running_tasks

repl_lib.add_command
Expand Down Expand Up @@ -275,7 +275,7 @@ stacker_exit = ->
task_lib.kill_running_tasks().then ->
util.print 'Killed running tasks!'.green

t = 0 ; delta = 200 ; words = "Going To Sleep Mode".split ' '
t = 0 ; delta = 200 ; words = 'Going To Sleep Mode'.split ' '
_.map words, (word) ->
setTimeout (-> process.stdout.write "#{word.blue.bold} "), t += delta

Expand Down
2 changes: 1 addition & 1 deletion lib/repl_lib.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ module.exports =
[major, minor, build] = process.versions.node.split('.').map (n) -> parseInt(n)

if major is 0 and minor < 8
console.warn "Node 0.8.0+ required for CoffeeScript REPL"
console.warn 'Node 0.8.0+ required for CoffeeScript REPL'
process.exit 1

opts = _.merge replDefaults, opts
Expand Down
2 changes: 1 addition & 1 deletion lib/run_cmd.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports =
# Run a command
# if id is passed in, will prefix output with that
# ({cmd: [string], task_name: string, cwd: string, env: map, silent: boolean, pipe_output: boolean}) -> child_process
({cmd, id, cwd, env, silent, pipe_output, close_stdin, direct}) ->
({cmd, id, cwd, env, silent, pipe_output, close_stdin, direct}) ->
cwd ?= process.cwd()

missing_dir_error = "This task has an invalid working directory (#{cwd}). Please check your configuration."
Expand Down
6 changes: 3 additions & 3 deletions lib/stacker_lib.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ check_config = ->

catch e
util._log __filename, e
util.print "No config found. Using:".yellow, config_dir.cyan
util.print 'No config found. Using:'.yellow, config_dir.cyan

boot_stack = () ->
should_start_repl = !args['no-repl']
boot_stack = ->
should_start_repl = not args['no-repl']

state_lib.set_stacker_state args.stacker_state

Expand Down
10 changes: 5 additions & 5 deletions lib/task_lib.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ start_task = (task_name) ->
task_config = task_config_lib.get_task_config task_name, state_lib.get_stacker_state()

if task_config.check?
if !task_config.check()
if not task_config.check()
util.log_error "Task #{task_name} failed prestart check"
return Promise.resolve()
else
Expand Down Expand Up @@ -148,7 +148,7 @@ start_daemon_task = (task_name, task_config, callback) ->

run_mexpect_process(task_name, task_config).then ([data, code, signal]) ->
unless code is 0
throw "Daemon start task exited with code #{code}"
throw new Error "Daemon start task exited with code #{code}"

new_state = callback state_lib.get_stacker_state(), data # throws

Expand Down Expand Up @@ -239,10 +239,10 @@ kill_daemon_task = (task_name, task_config) ->
cwd: task_config.cwd
.on_close.then ([code, signal]) ->
if code is 0
util.print "Stopped daemon #{task_name.cyan}".green + " successfully!".green
util.print "Stopped daemon #{task_name.cyan}".green + ' successfully!'.green
proc_lib.remove_daemon task_name
else
util.print "Failed to stop daemon #{task_name.cyan}".yellow + ". Maybe already dead?".yellow
util.print "Failed to stop daemon #{task_name.cyan}".yellow + '. Maybe already dead?'.yellow
.catch (err) ->
console.log 'error: kill daemon task'
console.log err
Expand Down Expand Up @@ -291,7 +291,7 @@ kill_task = (task_name) ->

# -> Promise
kill_running_tasks = ->
util.print "Killing all tasks...".yellow
util.print 'Killing all tasks...'.yellow
Promise.all _(proc_lib.all_procs()).keys().map(kill_task).value()

module.exports = {
Expand Down
Loading

0 comments on commit 85b655a

Please sign in to comment.