Showing 10 of 20 total issues
File run.ts
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
import yargs from "yargs";
import * as dotenv from "dotenv";
import LabeledProcessRunner from "./runner.js";
import * as fs from "fs";
import { ServerlessStageDestroyer } from "@stratiformdigital/serverless-stage-destroyer";
Function createTopics
has 65 lines of code (exceeds 40 allowed). Consider refactoring. Open
export async function createTopics(brokerString, topicsConfig) {
const topics = topicsConfig;
const brokers = brokerString.split(",");
const kafka = new Kafka({
Function myHandler
has 61 lines of code (exceeds 40 allowed). Consider refactoring. Open
async function myHandler(event, context, callback) {
const cluster = process.env.cluster;
const service = process.env.service;
const RUNNING = "RUNNING";
Function create
has 54 lines of code (exceeds 40 allowed). Consider refactoring. Open
const create = async () => {
await admin.connect();
//fetch topics from MSK and filter out __ internal management topic
const existingTopicList = _.filter(await admin.listTopics(), function (n) {
Function getMeanTimeToRecover
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const getMeanTimeToRecover = async (branch: string) => {
const response = await octokit.paginate(
"GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs",
{
owner: "Enterprise-CMCS",
- 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 handler
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
exports.handler = async function (event, context) {
console.log("Request:", JSON.stringify(event, undefined, 2));
const responseData = {};
let responseStatus = SUCCESS;
try {
- 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 getMeanTimeToRecover
has 42 lines of code (exceeds 40 allowed). Consider refactoring. Open
export const getMeanTimeToRecover = async (branch: string) => {
const response = await octokit.paginate(
"GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs",
{
owner: "Enterprise-CMCS",
Function formattedPrefix
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private formattedPrefix(prefix: string): string {
let color: string;
if (prefix! in this.prefixColors) {
color = this.prefixColors[prefix];
- 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_command_and_output
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async run_command_and_output(
prefix: string,
cmd: string[],
cwd: string | null,
catchAll = false,
- 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 install_deps
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function install_deps(runner: LabeledProcessRunner, dir: string) {
if (process.env.CI == "true") {
if (!fs.existsSync(`${dir}/node_modules`)) {
await frozenInstall(runner, dir);
}
- 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"