Showing 27 of 84 total issues
Function run
has 212 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run() {
const logo = await Helpers.generateLogo('json-serverless');
this.log();
this.log(`${chalk.blueBright(logo)}`);
this.log();
Function run
has 181 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run() {
const logo = await Helpers.generateLogo('json-serverless');
this.log();
this.log(`${chalk.blueBright(logo)}`);
this.log();
File swaggerspec.ts
has 410 lines of code (exceeds 250 allowed). Consider refactoring. Open
import _ from 'lodash';
const listEndpoints = require('express-list-endpoints');
import express from 'express';
import {
Info,
File create-stack.ts
has 377 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as inquirer from 'inquirer';
import fs from 'fs-extra';
import { Command, flags } from '@oclif/command';
import Listr = require('listr');
import { AppConfig, LogLevel } from 'json-serverless-lib';
File helpers.ts
has 353 lines of code (exceeds 250 allowed). Consider refactoring. Open
import fs from 'fs-extra';
import * as path from 'path';
const util = require('util');
const exec = util.promisify(require('child_process').exec);
import figlet from 'figlet';
Function createCLIOutput
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
static createCLIOutput(
slsinfo: string,
appConfig: AppConfig,
stage: string,
s3bucketPath?: string,
File update-stack.ts
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
import fs from 'fs-extra';
import { Command, flags } from '@oclif/command';
import Listr = require('listr');
import * as path from 'path';
import { Helpers } from '../actions/helpers';
Function setupRoutes
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected async setupRoutes(
db: {},
middlewares,
router,
appConfig: AppConfig
Function run
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
async run() {
const logo = await Helpers.generateLogo('json-serverless');
this.log();
this.log(`${chalk.blueBright(logo)}`);
this.log();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getQueryParameterSchema
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
getQueryParameterSchema(): QueryParameter[] {
return [
{
name: '_page',
in: 'query',
Function run
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
async run() {
const logo = await Helpers.generateLogo('json-serverless');
this.log();
this.log(`${chalk.blueBright(logo)}`);
this.log();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function createCLIOutput
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
private createCLIOutput(
swagger: boolean,
apikeyauth: boolean,
apiRoute: string,
apiKey: string
Function initSpec
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
initSpec(
readOnly: boolean,
basePath: string,
routePath: string,
specPath: string
Function parseServerlessInfo
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static parseServerlessInfo(slsinfo: string) {
const rows = JSON.stringify(slsinfo).split('\\n') as any[];
const createKeyValues = rows.map((x, i, rows) => {
if (x.startsWith(' ANY -')) {
x = {
Function parseServerlessInfo
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private static parseServerlessInfo(slsinfo: string) {
const rows = JSON.stringify(slsinfo).split('\\n') as any[];
const createKeyValues = rows.map((x, i, rows) => {
if (x.startsWith(' ANY -')) {
x = {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function run
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run() {
const logo = await Helpers.generateLogo('json-serverless');
this.log(`${chalk.blueBright(logo)}`);
this.log();
const { args, flags } = this.parse(Run);
Function setupRoutes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected async setupRoutes(
db: {},
middlewares,
router,
appConfig: AppConfig
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function validate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
validate(): RuleEvent[] {
try {
if (this.jsonObject) {
const ajvObject = new ajv();
const result = ajvObject.validate(requestSchema, this.jsonObject);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function task
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
task: async (ctx, task) => {
if (
apiKeyValue &&
appConfig.enableApiKeyAuth !== flags.apikeyauth &&
flags.apikeyauth
Function constructor
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(server: express.Express, apiKey: string) {
this.server = server;
this.apiKey = apiKey;
this.authenticationMiddleware = (whiteList: string[]) => async (
req,