From 835047c755bc086a68931d5a7e1e6fcd1aeb9523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Katona?= Date: Sat, 22 Oct 2016 13:29:41 -0600 Subject: [PATCH] fix lint errors --- bin/embark | 2 +- js/mine.js | 8 ++++---- lib/contracts.js | 31 ++++++++++++++++--------------- lib/deploy.js | 34 +++++++++++++++++++--------------- 4 files changed, 40 insertions(+), 35 deletions(-) diff --git a/bin/embark b/bin/embark index a4acc80b8..eb0b4d558 100755 --- a/bin/embark +++ b/bin/embark @@ -1,4 +1,4 @@ #!/usr/bin/env node var Embark = require('..'); -Embark.process(process.argv) +Embark.process(process.argv); diff --git a/js/mine.js b/js/mine.js index bce7bcf4e..52aa254a0 100644 --- a/js/mine.js +++ b/js/mine.js @@ -16,7 +16,7 @@ In the meantime, just set an empty config object. */ - config = {} + config = {}; defaults = { interval_ms: 15000, @@ -25,9 +25,9 @@ mine_periodically: false, mine_normally: false, threads: 1 - } + }; - for (key in defaults) { + for (var key in defaults) { if (config[key] === undefined) { config[key] = defaults[key]; } @@ -54,7 +54,7 @@ var fundAccount = function (config, miner_obj, cb) { var accountFunded = function () { return (eth.getBalance(eth.coinbase) >= config.initial_ether); - } + }; if (accountFunded()) { return cb(); diff --git a/lib/contracts.js b/lib/contracts.js index f3136f0bf..8f51480f5 100644 --- a/lib/contracts.js +++ b/lib/contracts.js @@ -19,10 +19,12 @@ ContractsManager.prototype.compileContracts = function() { ContractsManager.prototype.build = function() { this.compiledContracts = this.compileContracts(); + var className; + var contract; // go through config file first - for(var className in this.contractsConfig.contracts) { - var contract = this.contractsConfig.contracts[className]; + for(className in this.contractsConfig.contracts) { + contract = this.contractsConfig.contracts[className]; contract.className = className; contract.args = contract.args || []; @@ -31,11 +33,11 @@ ContractsManager.prototype.build = function() { } // compile contracts - for(var className in this.compiledContracts) { + for(className in this.compiledContracts) { var compiledContract = this.compiledContracts[className]; var contractConfig = this.contractsConfig.contracts[className]; - var contract = this.contracts[className] || {className: className, args: []}; + contract = this.contracts[className] || {className: className, args: []}; contract.code = compiledContract.code; contract.runtimeBytecode = compiledContract.runtimeBytecode; @@ -67,8 +69,8 @@ ContractsManager.prototype.build = function() { } // deal with special configs - for(var className in this.contracts) { - var contract = this.contracts[className]; + for(className in this.contracts) { + contract = this.contracts[className]; // if deploy intention is not specified default is true if (contract.deploy === undefined) { @@ -109,8 +111,8 @@ ContractsManager.prototype.build = function() { } // remove contracts that don't have code - for(var className in this.contracts) { - var contract = this.contracts[className]; + for(className in this.contracts) { + contract = this.contracts[className]; if (contract.code === undefined) { this.logger.error(className + " has no code associated"); @@ -121,8 +123,8 @@ ContractsManager.prototype.build = function() { this.logger.trace(this.contracts); // determine dependencies - for(var className in this.contracts) { - var contract = this.contracts[className]; + for(className in this.contracts) { + contract = this.contracts[className]; if (contract.args === []) continue; @@ -149,7 +151,7 @@ ContractsManager.prototype.sortContracts = function(contractList) { for(var contract in this.contractDependencies) { var dependencies = this.contractDependencies[contract]; - for(var i=0; i < dependencies.length; i++) { + for(i=0; i < dependencies.length; i++) { converted_dependencies.push([contract, dependencies[i]]); } } @@ -188,19 +190,19 @@ ContractsManager.prototype.contractsState = function() { className.green, 'Interface or set to not deploy'.green, "\t\tn/a".green - ] + ]; } else if (contract.error) { contractData = [ className.green, (contract.error).red, '\t\tError'.red - ] + ]; } else { contractData = [ className.green, (contract.deployedAddress || '...').green, ((contract.deployedAddress !== undefined) ? "\t\tDeployed".green : "\t\tPending".magenta) - ] + ]; } data.push(contractData); @@ -210,4 +212,3 @@ ContractsManager.prototype.contractsState = function() { }; module.exports = ContractsManager; - diff --git a/lib/deploy.js b/lib/deploy.js index 36b281e09..d51e31175 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -17,7 +17,12 @@ var Deploy = function(options) { Deploy.prototype.checkAndDeployContract = function(contract, params, callback) { var self = this; - + var suppliedArgs; + var realArgs; + var arg; + var l; + var contractName; + var referedContract; contract.error = false; if (contract.deploy === false) { @@ -28,14 +33,14 @@ Deploy.prototype.checkAndDeployContract = function(contract, params, callback) { if (contract.address !== undefined) { // determine arguments - var suppliedArgs = (params || contract.args); - var realArgs = []; + suppliedArgs = (params || contract.args); + realArgs = []; - for (var l = 0; l < suppliedArgs.length; l++) { - var arg = suppliedArgs[l]; + for (l = 0; l < suppliedArgs.length; l++) { + arg = suppliedArgs[l]; if (arg[0] === "$") { - var contractName = arg.substr(1); - var referedContract = this.contractsManager.getContract(contractName); + contractName = arg.substr(1); + referedContract = this.contractsManager.getContract(contractName); realArgs.push(referedContract.deployedAddress); } else { realArgs.push(arg); @@ -59,14 +64,14 @@ Deploy.prototype.checkAndDeployContract = function(contract, params, callback) { } else { // determine arguments - var suppliedArgs = (params || contract.args); - var realArgs = []; + suppliedArgs = (params || contract.args); + realArgs = []; - for (var l = 0; l < suppliedArgs.length; l++) { - var arg = suppliedArgs[l]; + for (l = 0; l < suppliedArgs.length; l++) { + arg = suppliedArgs[l]; if (arg[0] === "$") { - var contractName = arg.substr(1); - var referedContract = this.contractsManager.getContract(contractName); + contractName = arg.substr(1); + referedContract = this.contractsManager.getContract(contractName); realArgs.push(referedContract.deployedAddress); } else { realArgs.push(arg); @@ -103,7 +108,7 @@ Deploy.prototype.deployContract = function(contract, params, callback) { var contractParams = (params || contract.args).slice(); - this.web3.eth.getAccounts(function(err, accounts) { + this.web3.eth.getAccounts(function(err, accounts) { //console.log("using address" + this.web3.eth.accounts[0]); // TODO: probably needs to be defaultAccount @@ -161,4 +166,3 @@ Deploy.prototype.deployAll = function(done) { }; module.exports = Deploy; -