grafana/grafana-polystat-panel

View on GitHub
src/data/deframer.ts

Summary

Maintainability
A
1 hr
Test Coverage

Function InsertTime has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Wontfix

export function InsertTime(data: DataFrame[]): DataFrame[] {
  // TODO: time to insert can be taken from the first row if there are timeseries already
  // for now, just insert now
  const timeToInsert = Date.now();
  const newData: DataFrame[] = [];
Severity: Minor
Found in src/data/deframer.ts - About 7 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

Avoid deeply nested control flow statements.
Open

          if (aField.state) {
            copiedField.state = Object.assign({}, aField.state);
          }
Severity: Major
Found in src/data/deframer.ts - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Wontfix

              for (let rowNum = 0; rowNum < rowsOfField; rowNum++) {
                // only create a new field when the rowValue is not null
                if (aFieldValues[rowNum] !== null) {
                  if (aField.state) {
                    copiedField.state = Object.assign({}, aField.state);
    Severity: Major
    Found in src/data/deframer.ts - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                if (aField.state) {
                  copiedField.state = Object.assign({}, aField.state);
                }
      Severity: Major
      Found in src/data/deframer.ts - About 45 mins to fix

        There are no issues that match your filters.

        Category
        Status