ghdna/athena-express

View on GitHub

Showing 5 of 5 total issues

Function query has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    async query(query) {
        const config = this.config;

        let initiateQueryInAthena = true;

Severity: Minor
Found in lib/athenaExpress.js - About 5 hrs to fix

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

File helpers.js has 273 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";
//helpers.js

const readline = require("readline"),
    csv = require("csvtojson");
Severity: Minor
Found in lib/helpers.js - About 2 hrs to fix

    Function getQueryResultsFromS3 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    async function getQueryResultsFromS3(params) {
        const s3Params = {
            Bucket: params.s3Output.split("/")[2],
            Key: params.s3Output.split("/").slice(3).join("/"),
        };
    Severity: Minor
    Found in lib/helpers.js - About 1 hr to fix

    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 { items: await getRawResultsFromS3(input) };
    Severity: Major
    Found in lib/helpers.js - About 30 mins to fix

      Function cleanUpPaginatedDML has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      async function cleanUpPaginatedDML(queryResults, paginationFactor) {
          const dataTypes = await getDataTypes();
          const columnNames = Object.keys(dataTypes).reverse();
          let rowObject = {};
          let unformattedS3RowArray = null;
      Severity: Minor
      Found in lib/helpers.js - About 25 mins to fix

      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

      Severity
      Category
      Status
      Source
      Language