binary-com/binary-charts

View on GitHub

Showing 13 of 57 total issues

File ticks.js has 4025 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { nowAsEpoch } from 'binary-utils';

export default [
    { epoch: 0, quote: 50 },
    { epoch: 1, quote: 40 },
Severity: Major
Found in .storybook/ticks.js - About 1 wk to fix

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

        render() {
            const { allowOHLC, assetName, className, compactToolbar, hideTimeFrame, hideToolbar,
                showTooltips, hideZoomControls, showAllTimeFrame, theme, ticks, type, highContrast,
                id, symbol, noData, pipSize, events, shiftMode, contract, trade, hideIntervalPicker,
            } = this.props;
    Severity: Major
    Found in src/BinaryChart.js - About 2 hrs to fix

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

          render() {
              const { allowOHLC, assetName, compact, type, getChart, pickerShown, interval, showTooltips,
                  onShowPicker, onIntervalChange, onTypeChange, onIndicatorChange, hideIntervalPicker } = this.props;
              const tooltips = showTooltips ? defaultTooltips : {};
      
      
      Severity: Minor
      Found in src/toolbar/Toolbar.js - About 1 hr to fix

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

        const replacePlotObj = (axis, allPlotObjs: PlotObject[], newPlotObjs: PlotObject[], addFuncName, removeFuncName) => {
            allPlotObjs.forEach(plotObj => {
                const newObj = newPlotObjs.find(x => x.id === plotObj.id);
                if (!newObj) {
                    axis[removeFuncName](plotObj.id);
        Severity: Minor
        Found in src/config/updateContract.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

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

            render() {
                const { data, showAllTimeFrame, interval } = this.props;
        
                let opt = options;
        
        
        Severity: Minor
        Found in src/toolbar/TimeFramePicker.js - About 1 hr to fix

          Function componentDidMount has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              componentDidMount() {
                  api.events.on('ohlc', response => {
                      const { ticks, type } = this.state;
          
                      if (type === 'line' || type === 'area' || ticks.length < 3) {
          Severity: Minor
          Found in .storybook/charts/DynamicOHLCChart.js - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                if (ticksDiffer || contractsDiffer || tradingTimesDiffer
                    || pipSizeDiffer || futureUpdated || minRangeUpdated || indicatorsDiffer) {
                    chart.redraw(false);
                }
            Severity: Major
            Found in src/config/updateChart.js - About 1 hr to fix

              Avoid too many return statements within this function.
              Open

                          return true;
              Severity: Major
              Found in src/config/updateStartLater.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return cloned;
                Severity: Major
                Found in src/config/mergeTradeWithContract.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return cloned;
                  Severity: Major
                  Found in src/config/mergeTradeWithContract.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return false;
                    Severity: Major
                    Found in src/config/updateStartLater.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return cloned;
                      Severity: Major
                      Found in src/config/mergeTradeWithContract.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return {
                                        ...cloned,
                                        barrier: +barrier,
                                    };
                        Severity: Major
                        Found in src/config/mergeTradeWithContract.js - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language