avegao/aws-athena-node-client

View on GitHub

Showing 4 of 8 total issues

Function setColumnParsers has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private setColumnParsers(results: ResultSet): Column[] {
        return results.ResultSetMetadata?.ColumnInfo?.map((columnInfo, index) => {
            const name = columnInfo.Name ?? `column_${index}`;
            let parse: ColumnParse;

Severity: Minor
Found in src/index.ts - About 1 hr to fix

    Function startQueryExecution has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private async startQueryExecution<T>(query: Query<T>): Promise<string> {
            const input: StartQueryExecutionCommandInput = {
                QueryExecutionContext: {
                    Database: this._config.database,
                },
    Severity: Minor
    Found in src/index.ts - About 1 hr to fix

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

          private async getQueryResults<T extends object>(query: Query<T>, nextToken?: string): Promise<T[]> {
              const input: GetQueryResultsInput = {
                  NextToken: nextToken,
                  QueryExecutionId: query.athenaId,
              };
      Severity: Minor
      Found in src/index.ts - 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

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

          public static parseArray(arrayInString: string): number[] | string[] {
              arrayInString = arrayInString.replace(/[\[\]]/gi, '');
      
              if (arrayInString == null || arrayInString === '') {
                  return [];
      Severity: Minor
      Found in src/Column.ts - 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