airbnb/superset

View on GitHub
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx

Summary

Maintainability
C
1 day
Test Coverage

File BigNumberViz.tsx has 321 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file

    Function renderHeader has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      renderHeader(maxHeight: number) {
        const { bigNumber, headerFormatter, width, colorThresholdFormatters } =
          this.props;
        // @ts-ignore
        const text = bigNumber === null ? t('No data') : headerFormatter(bigNumber);

      Function render has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          const {
            showTrendLine,
            height,
            kickerFontSize,

        Function renderTrendline has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          renderTrendline(maxHeight: number) {
            const { width, trendLineData, echartOptions, refs } = this.props;
        
            // if can't find any non-null values, no point rendering the trendline
            if (!trendLineData?.some(d => d[1] !== null)) {

          Function renderSubheader has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            renderSubheader(maxHeight: number) {
              const { bigNumber, subheader, width, bigNumberFallback } = this.props;
              let fontSize = 0;
          
              const NO_DATA_OR_HASNT_LANDED = t(

            Function renderKicker has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              renderKicker(maxHeight: number) {
                const { timestamp, showTimestamp, formatTime, width } = this.props;
                if (
                  !formatTime ||
                  !showTimestamp ||

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

                renderTrendline(maxHeight: number) {
                  const { width, trendLineData, echartOptions, refs } = this.props;
              
                  // if can't find any non-null values, no point rendering the trendline
                  if (!trendLineData?.some(d => d[1] !== null)) {

              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 renderHeader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                renderHeader(maxHeight: number) {
                  const { bigNumber, headerFormatter, width, colorThresholdFormatters } =
                    this.props;
                  // @ts-ignore
                  const text = bigNumber === null ? t('No data') : headerFormatter(bigNumber);

              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