jormaechea/open-api-mocker

View on GitHub

Showing 5 of 7 total issues

Function generate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

static generate(schemaResponse, preferredExampleName) {
 
if((typeof schemaResponse.example !== 'undefined' && !schemaResponse['x-faker']) ||
(schemaResponse.examples && Object.values(schemaResponse.examples).length)) {
const bestExample = this.getBestExample(schemaResponse, preferredExampleName);
Severity: Minor
Found in lib/response-generator/index.js - About 55 mins to fix

Function generateBySchema has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

static generateBySchema(schemaResponse) {
 
const fakerExtension = schemaResponse['x-faker'];
if(fakerExtension) {
try {
Severity: Minor
Found in lib/response-generator/index.js - About 45 mins to fix

Function sendResponse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

sendResponse(req, res, body, statusCode, headers, responseMimeType = '') {
 
statusCode = statusCode || 200;
headers = headers || {};
 
 
Severity: Minor
Found in lib/mocker/express/server.js - About 35 mins to fix

Function validateRequestBody has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

validateRequestBody(requestBody) {
 
if(!this.requestBody)
return [];
 
 
Severity: Minor
Found in lib/paths/path.js - About 35 mins to fix

Function load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

load(schemaPath) {
 
this.schemaPath = path.isAbsolute(schemaPath) ? schemaPath : path.join(process.cwd(), schemaPath);
 
try {
Severity: Minor
Found in lib/schema-loaders/local-loader.js - About 25 mins to fix
Severity
Category
Status
Source
Language