diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e4cfc258c..06828fc32 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -135,9 +135,8 @@ In the spirit of being as lazy as possible towards maintaining code quality, I r You are welcome to fix any tech debt that you see in SaaS dashboards: * [Code Climate](https://codeclimate.com/github/bbyars/mountebank) -* [Codacy](https://www.codacy.com/app/brandonbyars/mountebank/dashboard) -* [Test Coverage](https://codeclimate.com/github/bbyars/mountebank/coverage) -* [SonarQube](https://sonarqube.com/dashboard?id=mountebank) +* [Codacy](https://app.codacy.com/gh/bbyars/mountebank/dashboard) +* [SonarQube](https://sonarcloud.io/dashboard?id=mountebank&branch=master) There are several linting tools run locally as well: diff --git a/mbTest/mb.js b/mbTest/mb.js index 2feab74cd..9b9823ca9 100644 --- a/mbTest/mb.js +++ b/mbTest/mb.js @@ -128,11 +128,11 @@ function create (port, includeStdout) { } async function save (args) { - return await execCommand('save', args); + return execCommand('save', args); } async function replay (args) { - return await execCommand('replay', args); + return execCommand('replay', args); } function get (endpoint) { diff --git a/mbTest/web/docsTester/testTypes/exec.js b/mbTest/web/docsTester/testTypes/exec.js index cd7418d47..1d285d742 100644 --- a/mbTest/web/docsTester/testTypes/exec.js +++ b/mbTest/web/docsTester/testTypes/exec.js @@ -36,7 +36,7 @@ async function runStep (step) { nextTestId += 1; try { - return await execute(`sh ./${filename}`); + return execute(`sh ./${filename}`); } catch (reason) { console.log(`Error executing following command: ${step.text}`); diff --git a/src/models/behaviors.js b/src/models/behaviors.js index fe1065c37..855fc3eeb 100644 --- a/src/models/behaviors.js +++ b/src/models/behaviors.js @@ -492,12 +492,11 @@ async function lookup (originalRequest, response, lookupConfig, logger) { try { const row = await lookupRow(lookupConfig, originalRequest, logger); replaceObjectValuesIn(response, lookupConfig.into, row, logger); - return response; } catch (error) { logger.error(error); - return response; } + return response; } /** diff --git a/src/models/filesystemBackedImpostersRepository.js b/src/models/filesystemBackedImpostersRepository.js index d02db530a..c87d7a476 100644 --- a/src/models/filesystemBackedImpostersRepository.js +++ b/src/models/filesystemBackedImpostersRepository.js @@ -207,7 +207,7 @@ function create (config, logger) { // with realpath = false, the file doesn't have to exist, but the directory does await ensureDir(filepath); - return await locker.lock(filepath, options); + return locker.lock(filepath, options); } async function readAndWriteFile (filepath, caller, transformer, defaultContents) { @@ -237,7 +237,7 @@ function create (config, logger) { // Ignore lock already released errors if (err.code !== 'ERELEASED') { metrics.lockErrors.inc({ caller, code: err.code }); - locker.unlock(filepath, { realpath: false }).catch(() => {}); + locker.unlock(filepath, { realpath: false }).catch(() => { /* ignore */ }); throw err; } } @@ -307,7 +307,7 @@ function create (config, logger) { .sort(timeSorter) .map(file => readFile(`${path}/${file}`)); - return await Promise.all(reads); + return Promise.all(reads); } function repeatsFor (response) { @@ -640,7 +640,7 @@ function create (config, logger) { }); const nonProxyStubs = allStubs.filter(stub => stub.responses.length > 0); - return await overwriteAll(nonProxyStubs); + return overwriteAll(nonProxyStubs); } /** @@ -663,7 +663,7 @@ function create (config, logger) { * @returns {Object} - the promise resolving to the array of requests */ async function loadRequests () { - return await loadAllInDir(`${baseDir}/requests`); + return loadAllInDir(`${baseDir}/requests`); } /** @@ -778,7 +778,7 @@ function create (config, logger) { * @returns {Object} - all imposters keyed by port */ async function all () { - return await Promise.all(Object.keys(imposterFns).map(get)); + return Promise.all(Object.keys(imposterFns).map(get)); } /** diff --git a/src/models/http/headersMap.js b/src/models/http/headersMap.js index 54b395264..57730353d 100644 --- a/src/models/http/headersMap.js +++ b/src/models/http/headersMap.js @@ -34,7 +34,7 @@ function of (headers) { * @returns {*} */ function get (headerName) { - return headers[headerNameFor(headerName, headers)]; + return headers[headerNameFor(headerName)]; } /** @@ -44,7 +44,7 @@ function of (headers) { * @param {String} value - the value */ function set (headerName, value) { - headers[headerNameFor(headerName, headers)] = value; + headers[headerNameFor(headerName)] = value; } /** diff --git a/src/models/inMemoryImpostersRepository.js b/src/models/inMemoryImpostersRepository.js index 50b4b5939..4b163c265 100644 --- a/src/models/inMemoryImpostersRepository.js +++ b/src/models/inMemoryImpostersRepository.js @@ -321,7 +321,7 @@ function create () { * @returns {Object} - all imposters keyed by port */ async function all () { - return await Promise.all(Object.keys(imposters).map(get)); + return Promise.all(Object.keys(imposters).map(get)); } /** diff --git a/src/models/responseResolver.js b/src/models/responseResolver.js index 6272f4824..73229e680 100644 --- a/src/models/responseResolver.js +++ b/src/models/responseResolver.js @@ -227,10 +227,10 @@ function create (stubs, proxy, callbackURL) { match = await stubs.first(filter, index + 1); if (match.success) { - return await match.stub.addResponse(newResponse); + return match.stub.addResponse(newResponse); } else { - return await stubs.add({ predicates: newPredicates, responses: [newResponse] }); + return stubs.add({ predicates: newPredicates, responses: [newResponse] }); } } diff --git a/src/mountebank.js b/src/mountebank.js index df8cdb305..87776438a 100644 --- a/src/mountebank.js +++ b/src/mountebank.js @@ -226,7 +226,7 @@ async function listen (app, options) { */ async function create (options) { const app = await createApp(options); - return await listen(app, options); + return listen(app, options); } module.exports = { create, createApp }; diff --git a/tasks/mb.js b/tasks/mb.js index 72b3cb254..88642557e 100755 --- a/tasks/mb.js +++ b/tasks/mb.js @@ -110,11 +110,11 @@ async function execCommand (command, args) { } async function save (args) { - return await execCommand('save', args); + return execCommand('save', args); } async function replay (args) { - return await execCommand('replay', args); + return execCommand('replay', args); } async function execute (command, args) {