File marker.js
has 694 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as utils from "base/utils";
import Model from "base/model";
/*!
* HOOK MODEL
Marker
has 46 functions (exceeds 20 allowed). Consider refactoring. Open
const Marker = Model.extend({
getClassDefaults() {
const defaults = {
select: [],
Function getFrames
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
getFrames(forceFrame, selected) {
const _this = this;
if (!this.cachedFrames) this.cachedFrames = {};
const KEYS = utils.unique(this._getAllDimensions({ exceptType: "time" }));
Function getKeys
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
getKeys(KEYS) {
const _this = this;
let resultKeys;
KEYS = KEYS || utils.unique(this._getAllDimensions({ exceptType: "time" }));
Function getEntityLimits
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
getEntityLimits(entity) {
const _this = this;
const timePoints = this._parent.time.getAllSteps();
const selectedEdgeTimes = [];
const hooks = [];
Function cachePath
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.frameQueues[cachePath] = new Promise((resolve, reject) => {
_this.partialResult[cachePath] = {};
_this.partialResult[cachePath].timeOrConstantHooks = [];
steps.forEach(t => { _this.partialResult[cachePath][t] = {}; });
Function getFrame
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
getFrame(time, cb, keys) {
//keys = null;
const _this = this;
if (!this.cachedFrames) this.cachedFrames = {};
Function getFrames
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
getFrames(forceFrame, selected) {
const _this = this;
if (!this.cachedFrames) this.cachedFrames = {};
const KEYS = utils.unique(this._getAllDimensions({ exceptType: "time" }));
- 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 getFrame
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
getFrame(time, cb, keys) {
//keys = null;
const _this = this;
if (!this.cachedFrames) this.cachedFrames = {};
- 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 setSpace
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
setSpace(newSpace) {
const subHooks = Object.keys(this.getSubhooks(true));
const setProps = {};
const setWhichProps = {};
const newDimModels = setProps["space"] = this._root.dimensionManager.getDimensionModelsForSpace(this._space, newSpace);
Function listenFramesQueue
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
listenFramesQueue(keys, cb) {
const _this = this;
const KEYS = utils.unique(this._getAllDimensions({ exceptType: "time" }));
const TIME = this._getFirstDimension({ type: "time" });
const steps = this._parent.time.getAllSteps();
Function _interpolateBetweenFrames
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_interpolateBetweenFrames(time, nextFrameIndex, steps, cb, keys) {
const _this = this;
if (nextFrameIndex == 0) {
//getFrame makes sure the frane is ready because a frame with non-existing data might be adressed
Function getEntityLimits
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
getEntityLimits(entity) {
const _this = this;
const timePoints = this._parent.time.getAllSteps();
const selectedEdgeTimes = [];
const hooks = [];
- 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 init
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
init(name, value, parent, binds, persistent) {
Function _interpolateBetweenFrames
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
_interpolateBetweenFrames(time, nextFrameIndex, steps, cb, keys) {
Function getAvailableConcept
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getAvailableConcept({ index: index = 0, type: type = null, includeOnlyIDs: includeOnlyIDs = [], excludeIDs: excludeIDs = [] } = { }) {
if (!type && includeOnlyIDs.length == 0 && excludeIDs.length == 0) {
return null;
}
- 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
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return null;
Similar blocks of code found in 2 locations. Consider refactoring. Open
isHighlighted(d) {
const _this = this;
const value = JSON.stringify(this._createValue(d));
return this.highlight
.map(d => JSON.stringify(_this._createValue(d)) === value)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 87.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
isSelected(d) {
const _this = this;
const value = JSON.stringify(this._createValue(d));
return this.select
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 87.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
getAvailableConcept({ index: index = 0, type: type = null, includeOnlyIDs: includeOnlyIDs = [], excludeIDs: excludeIDs = [] } = { }) {
if (!type && includeOnlyIDs.length == 0 && excludeIDs.length == 0) {
return null;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 46.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (hook._type === "label" && hook.getEntity().dim === key) {
names.label = name;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 45.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (hook._type !== "label" && hook.getEntity().dim === key) {
names.key = name;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 45.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76