Function _updateContents
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
Item.prototype._updateContents = function (element) {
var content;
var changed;
var templateFunction;
var itemVisibleFrameContent;
- 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
File Item.js
has 338 lines of code (exceeds 250 allowed). Consider refactoring. Open
var Hammer = require('../../../module/hammer');
var util = require('../../../util');
var moment = require('../../../module/moment');
Function _repaintOnItemUpdateTimeTooltip
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
Item.prototype._repaintOnItemUpdateTimeTooltip = function (anchor) {
if (!this.options.tooltipOnItemUpdateTime) return;
var editable = (this.options.editable.updateTime ||
this.data.editable === true) &&
- 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 _updateContents
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Item.prototype._updateContents = function (element) {
var content;
var changed;
var templateFunction;
var itemVisibleFrameContent;
Function _repaintOnItemUpdateTimeTooltip
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Item.prototype._repaintOnItemUpdateTimeTooltip = function (anchor) {
if (!this.options.tooltipOnItemUpdateTime) return;
var editable = (this.options.editable.updateTime ||
this.data.editable === true) &&
Function _repaintDragCenter
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Item.prototype._repaintDragCenter = function () {
if (this.selected && this.options.editable.updateTime && !this.dom.dragCenter) {
var me = this;
// create and show drag area
var dragCenter = document.createElement('div');
Function _updateEditStatus
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Item.prototype._updateEditStatus = function() {
if (this.options) {
if(typeof this.options.editable === 'boolean') {
this.editable = {
updateTime: this.options.editable,
- 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 _repaintDragCenter
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Item.prototype._repaintDragCenter = function () {
if (this.selected && this.options.editable.updateTime && !this.dom.dragCenter) {
var me = this;
// create and show drag area
var dragCenter = document.createElement('div');
- 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 _repaintDeleteButton
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Item.prototype._repaintDeleteButton = function (anchor) {
var editable = ((this.options.editable.overrideItems || this.editable == null) && this.options.editable.remove) ||
(!this.options.editable.overrideItems && this.editable != null && this.editable.remove);
if (this.selected && editable && !this.dom.deleteButton) {
- 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 _updateDataAttributes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Item.prototype._updateDataAttributes = function(element) {
if (this.options.dataAttributes && this.options.dataAttributes.length > 0) {
var attributes = [];
if (Array.isArray(this.options.dataAttributes)) {
- 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 _updateEditStatus
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Item.prototype._updateEditStatus = function() {
if (this.options) {
if(typeof this.options.editable === 'boolean') {
this.editable = {
updateTime: this.options.editable,
Avoid deeply nested control flow statements. Open
if (!(this.data.type == 'background' && this.data.content === undefined)) {
throw new Error('Property "content" missing in item ' + this.id);
}
TODO found Open
* // TODO: describe available options
- Exclude checks
TODO found Open
// TODO: be able to destroy the delete button
- Exclude checks
TODO found Open
// TODO: in vis.js 5.0, we should change this to not reset options from the timeline configuration.
- Exclude checks
TODO found Open
var tooltipOffset = 50; // TODO: should be tooltip height (depends on template)
- Exclude checks
TODO found Open
// TODO: this.top for orientation:true is actually the items distance from the bottom...
- Exclude checks