Showing 11 of 11 total issues
Function getTest
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
private getTest(key: ArchFitTestName) {
const input: Record<string, any> = {
data: this.data,
region: this.config.region,
period: this.config.period
Function checkProvisioning
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkProvisioning(
dynamoDBMaxUtilization: DynamoDBCapacityUtilization,
dynamoDBTables: TableDescription[],
threshold: number
): Record<string, any> {
Function getDataForAPIGateway
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async getDataForAPIGateway(region: string, period: number) {
if (
(this.hasTest('APIGatewayErrorRate') ||
this.hasTest('APIGatewayRequestValidation')) &&
!this.dataStore.hasData('apiGatewayInstances')
Function main
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function main() {
const config: ArchFitConfiguration = {
region: 'eu-north-1',
currency: 'EUR',
period: 30,
Function getDataForDynamoDB
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async getDataForDynamoDB(region: string, period: number) {
if (
this.hasTest('DynamoDBOnDemandMode') ||
this.hasTest('DynamoDBProvisionedThroughput')
) {
Function costs
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const costs = (period: number) => {
const {
firstDayOfCurrentMonth,
firstDayOfPeriod,
midpointOfPeriod,
Consider simplifying this complex logical expression. Open
if (
(this.hasTest('LambdaArchitecture') ||
this.hasTest('LambdaDeadLetterQueueUsage') ||
this.hasTest('LambdaMemoryCap') ||
this.hasTest('LambdaRuntimes') ||
Function getOtherData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private async getOtherData(region: string) {
if (this.hasTest('RatioServersToServerless')) {
if (!this.dataStore.hasData('ec2Instances'))
this.dataStore.store('ec2Instances', await getEC2Instances(region));
if (!this.dataStore.hasData('fargateTasks'))
- 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 getPublicS3Buckets
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export async function getPublicS3Buckets(region: string): Promise<string[]> {
const client = new S3Client({ region });
const buckets = await getS3Buckets(region);
const publicBuckets: string[] = [];
- 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 getDataForDynamoDB
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private async getDataForDynamoDB(region: string, period: number) {
if (
this.hasTest('DynamoDBOnDemandMode') ||
this.hasTest('DynamoDBProvisionedThroughput')
) {
- 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 getDataForAPIGateway
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private async getDataForAPIGateway(region: string, period: number) {
if (
(this.hasTest('APIGatewayErrorRate') ||
this.hasTest('APIGatewayRequestValidation')) &&
!this.dataStore.hasData('apiGatewayInstances')
- 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"