doitintl/bigquery-grafana

View on GitHub
src/response_parser.ts

Summary

Maintainability
C
1 day
Test Coverage

Function _buildDataPoints has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  private static _buildDataPoints(results, timeIndex, metricIndex, valueIndexes) {
    const data = [];
    let targetName = '';
    let metricName = '';
    let i;
Severity: Minor
Found in src/response_parser.ts - About 3 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

Function _handleRecordFields has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  private static _handleRecordFields(results, res) {
    for (const fl of results) {
      if (fl.type === 'RECORD') {
        for (const f of fl.fields) {
          if (f.type !== 'RECORD') {
Severity: Minor
Found in src/response_parser.ts - About 2 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

Function transformAnnotationResponse has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  public transformAnnotationResponse(options, data) {
    const table = data.data;
    let timeColumnIndex = -1;
    let textColumnIndex = -1;
    let tagsColumnIndex = -1;
Severity: Minor
Found in src/response_parser.ts - 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

Function parseTableFields has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  public static parseTableFields(results, filter): IResultFormat[] {
    const fields: IResultFormat[] = [];
    if (!results || results.length === 0) {
      return fields;
    }
Severity: Minor
Found in src/response_parser.ts - 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 deeply nested control flow statements.
Open

            for (const ff of f.fields) {
              ff.name = fl.name + '.' + f.name + '.' + ff.name;
            }
Severity: Major
Found in src/response_parser.ts - About 45 mins to fix

    Function _toTimeSeries has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      private static _toTimeSeries(results) {
        let timeIndex = -1;
        let metricIndex = -1;
        const valueIndexes = [];
        for (let i = 0; i < results.schema.fields.length; i++) {
    Severity: Minor
    Found in src/response_parser.ts - About 45 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 parseData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      private static parseData(results, text, value): IResultFormat[] {
        const data: IResultFormat[] = [];
        if (!results || results.length === 0) {
          return data;
        }
    Severity: Minor
    Found in src/response_parser.ts - About 35 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 _handelWildCardTables has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      private _handelWildCardTables(tables) {
        let sorted = new Map();
        let newTables = [];
        for (const t of tables) {
          const partitioned = t.text.indexOf('__partitioned');
    Severity: Minor
    Found in src/response_parser.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

    There are no issues that match your filters.

    Category
    Status