Showing 18 of 74 total issues
Function Template
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
export function Template(): ITemplate {
return {
AWSTemplateFormatVersion: '2010-09-09',
Conditions: {},
Mappings: {},
- 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 Template
has 235 lines of code (exceeds 150 allowed). Consider refactoring. Open
export function Template(): ITemplate {
return {
AWSTemplateFormatVersion: '2010-09-09',
Conditions: {},
Mappings: {},
Function Bucket
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
const Bucket: TransformFunctionType = function(
name: string,
AWSClient: AWS.S3,
logical: string
): Promise<IResource> {
- 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 _cleanObject
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function _cleanObject(object: any) {
if (Array.isArray(object)) {
for (let v = 0; v < object.length; v++) {
object[v] = _cleanObject(object[v]);
}
- 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 buildIntrinsic
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export function buildIntrinsic(input) {
if (input['Fn::Equals']) {
return FnEquals(
buildIntrinsic(input['Fn::Equals'][0]),
buildIntrinsic(input['Fn::Equals'][1])
- 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
Consider simplifying this complex logical expression. Open
if (
!properties[p].kind &&
(properties[p].kind !== 'Ref' && !properties[p].Ref) &&
(properties[p].kind !== 'FnGetAZs' &&
typeof properties[p]['Fn::GetAZ'] !== 'undefined') &&
Function _buildFnSelect
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function _buildFnSelect(t: IFnSelect) {
if (Array.isArray(t.FnSelect)) {
const values = t.FnSelect.map(x => {
if (typeof x === 'string') {
return 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 _buildResource
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function _buildResource(t: IResource) {
const newT = cloneDeep(t);
const {
Type,
Properties,
- 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 Output
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function Output(name: string, properties: IOutputProperties): IOutput {
if (!name || !properties || !properties.Value) {
throw new SyntaxError(
`New Output with ${JSON.stringify({
name,
- 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
Avoid deeply nested control flow statements. Open
if (mapping) {
element = mapping;
} else {
throw new SyntaxError(`Could not find ${JSON.stringify(e)}`);
}
Function _validateRef
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function _validateRef(t: ITemplate, ref: IRef): void | SyntaxError {
if (ref.Ref) {
if (!(t.Parameters[ref.Ref] || t.Resources[ref.Ref])) {
if (!Object.values(Pseudo).includes(ref.Ref)) {
throw new SyntaxError(`Could not find ${JSON.stringify(ref)}`);
- 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
Avoid too many return
statements within this function. Open
return input;
Avoid too many return
statements within this function. Open
return FnIf(input['Fn::If'].map(x => buildIntrinsic(x)));
Avoid too many return
statements within this function. Open
return FnNot(input['Fn::Not'].map(x => buildIntrinsic(x)));
Avoid too many return
statements within this function. Open
return FnAnd(
buildIntrinsic(input['Fn::And'][0]),
buildIntrinsic(input['Fn::And'][1])
);
Function Resource
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function Resource(name: string, properties, options): IResource {
if (!name) {
throw new SyntaxError(`New Resource is invalid. A Name is required.`);
}
if (!properties) {
- 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 _buildFnJoin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function _buildFnJoin(t: IFnJoin) {
if (Array.isArray(t.Values)) {
const jsonValues = t.Values.map(x => {
if (typeof x === 'string') {
return 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 _calcFromExistingTemplate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function _calcFromExistingTemplate(t: ITemplate, inputTemplate: any) {
if (inputTemplate.Description) {
t = t.add(Description(inputTemplate.Description));
}
if (inputTemplate.Parameters) {
- 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"