nnnick/Chart.js

View on GitHub
src/scales/scale.time.js

Summary

Maintainability
C
1 day
Test Coverage

File scale.time.js has 384 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import adapters from '../core/core.adapters.js';
import {callback as call, isFinite, isNullOrUndef, mergeIf, valueOrDefault} from '../helpers/helpers.core.js';
import {toRadians, isNumber, _limitValue} from '../helpers/helpers.math.js';
import Scale from '../core/core.scale.js';
import {_arrayUnique, _filterBetween, _lookup} from '../helpers/helpers.collection.js';
Severity: Minor
Found in src/scales/scale.time.js - About 5 hrs to fix

    TimeScale has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default class TimeScale extends Scale {
    
      static id = 'time';
    
      /**
    Severity: Minor
    Found in src/scales/scale.time.js - About 2 hrs to fix

      Function determineDataLimits has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring.
      Open

        determineDataLimits() {
          const options = this.options;
          const adapter = this._adapter;
          const unit = options.time.unit || 'day';
          // eslint-disable-next-line prefer-const
      Severity: Minor
      Found in src/scales/scale.time.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 _generate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _generate() {
          const adapter = this._adapter;
          const min = this.min;
          const max = this.max;
          const options = this.options;
      Severity: Minor
      Found in src/scales/scale.time.js - About 1 hr to fix

        Function parse has a Cognitive Complexity of 11 (exceeds 7 allowed). Consider refactoring.
        Open

        function parse(scale, input) {
          if (isNullOrUndef(input)) {
            return null;
          }
        
        
        Severity: Minor
        Found in src/scales/scale.time.js - About 55 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 initOffsets has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
        Open

          initOffsets(timestamps = []) {
            let start = 0;
            let end = 0;
            let first, last;
        
        
        Severity: Minor
        Found in src/scales/scale.time.js - 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 _generate has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
        Open

          _generate() {
            const adapter = this._adapter;
            const min = this.min;
            const max = this.max;
            const options = this.options;
        Severity: Minor
        Found in src/scales/scale.time.js - 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

        There are no issues that match your filters.

        Category
        Status