File controller.bar.js
has 470 lines of code (exceeds 250 allowed). Consider refactoring. Open
import DatasetController from '../core/core.datasetController.js';
import {
_arrayUnique, isArray, isNullOrUndef,
valueOrDefault, resolveObjectKey, sign, defined
} from '../helpers/index.js';
Function _calculateBarValuePixels
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
_calculateBarValuePixels(index) {
const {_cachedMeta: {vScale, _stacked, index: datasetIndex}, options: {base: baseValue, minBarLength}} = this;
const actualBase = baseValue || 0;
const parsed = this.getParsed(index);
const custom = parsed._custom;
Function updateElements
has a Cognitive Complexity of 17 (exceeds 7 allowed). Consider refactoring. Open
updateElements(bars, start, count, mode) {
const reset = mode === 'reset';
const {index, _cachedMeta: {vScale}} = this;
const base = vScale.getBasePixel();
const horizontal = vScale.isHorizontal();
- Read upRead up
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 _getStacks
has a Cognitive Complexity of 15 (exceeds 7 allowed). Consider refactoring. Open
_getStacks(last, dataIndex) {
const {iScale} = this._cachedMeta;
const metasets = iScale.getMatchingVisibleMetas(this._type)
.filter(meta => meta.controller.options.grouped);
const stacked = iScale.options.stacked;
- Read upRead up
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 _calculateBarValuePixels
has a Cognitive Complexity of 15 (exceeds 7 allowed). Consider refactoring. Open
_calculateBarValuePixels(index) {
const {_cachedMeta: {vScale, _stacked, index: datasetIndex}, options: {base: baseValue, minBarLength}} = this;
const actualBase = baseValue || 0;
const parsed = this.getParsed(index);
const custom = parsed._custom;
- Read upRead up
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 _getStacks
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_getStacks(last, dataIndex) {
const {iScale} = this._cachedMeta;
const metasets = iScale.getMatchingVisibleMetas(this._type)
.filter(meta => meta.controller.options.grouped);
const stacked = iScale.options.stacked;
Function updateElements
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateElements(bars, start, count, mode) {
const reset = mode === 'reset';
const {index, _cachedMeta: {vScale}} = this;
const base = vScale.getBasePixel();
const horizontal = vScale.isHorizontal();
Function computeMinSampleSize
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
function computeMinSampleSize(meta) {
const scale = meta.iScale;
const values = getAllScaleValues(scale, meta.type);
let min = scale._length;
let i, ilen, curr, prev;
- Read upRead up
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 setBorderSkipped
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
function setBorderSkipped(properties, options, stack, index) {
let edge = options.borderSkipped;
const res = {};
if (!edge) {
- Read upRead up
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 _calculateBarIndexPixels
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
_calculateBarIndexPixels(index, ruler) {
const scale = ruler.scale;
const options = this.options;
const skipNull = options.skipNull;
const maxBarThickness = valueOrDefault(options.maxBarThickness, Infinity);
- Read upRead up
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"