Showing 6 of 6 total issues
File index.ts
has 389 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import * as Serverless from "serverless";
import Plugin = require("serverless/classes/Plugin");
import * as path from "path";
import * as AWS from "aws-sdk";
Function createRestApi
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private createRestApi(key: string, restApi: APIDefinition) {
const resources = this.serverless.service.provider
.compiledCloudFormationTemplate.Resources;
const stage = restApi.Stage || this.serverless.service.provider.stage;
const service = this.serverless.service.getServiceName();
Function createRestApi
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Open
private createRestApi(key: string, restApi: APIDefinition) {
const resources = this.serverless.service.provider
.compiledCloudFormationTemplate.Resources;
const stage = restApi.Stage || this.serverless.service.provider.stage;
const service = this.serverless.service.getServiceName();
- 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 updateApiDeployments
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async updateApiDeployments() {
const aws = this.serverless.getProvider("aws");
const region = aws.getRegion();
const options = this.pluginOptions;
Function createServiceRole
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private createServiceRole(
stackName: string,
service: string,
key: string,
functionNames: any[]
Function updateApiDeployments
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
private async updateApiDeployments() {
const aws = this.serverless.getProvider("aws");
const region = aws.getRegion();
const options = this.pluginOptions;
- 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"