Showing 22 of 22 total issues
File controller.js
has 829 lines of code (exceeds 250 allowed). Consider refactoring. Open
import tinycolor from 'tinycolor2';
export default class AngularColorPickerController {
constructor(_$scope, _$element, _$document, _$timeout, _ColorPickerOptions) {
// set angular injected variables
AngularColorPickerController
has 57 functions (exceeds 20 allowed). Consider refactoring. Open
export default class AngularColorPickerController {
constructor(_$scope, _$element, _$document, _$timeout, _ColorPickerOptions) {
// set angular injected variables
this.$scope = _$scope;
this.$element = _$element;
Function template
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function template($templateCache) {
$templateCache.put('template/color-picker/directive.html',
'<div class="color-picker-wrapper" ng-class="{' +
'\'color-picker-disabled\': AngularColorPickerController.options.disabled,' +
'\'color-picker-swatch-only\': AngularColorPickerController.options.swatchOnly,' +
Function initWatchers
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
initWatchers() {
// ngModel
this.$scope.$watch('AngularColorPickerController.internalNgModel', this.watchInternalNgModel.bind(this));
Function initMouseEvents
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
initMouseEvents() {
const eventHandlers = {
mouseDown: this.onMouseDown.bind(this),
mouseUp: this.onMouseUp.bind(this),
mouseMove: this.onMouseMove.bind(this),
Function constructor
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor() {
return {
// input attributes
id: undefined,
name: undefined,
Function setupApi
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
setupApi() {
if (!this.api) {
this.api = {};
}
Function update
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
update() {
if (!this.areAllValuesSet()) {
return false;
}
Function setupApi
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
setupApi() {
if (!this.api) {
this.api = {};
}
- 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 getColorValue
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
getColorValue(dynamicValues = true, includeOpacity = true) {
let value = {
h: this.hue,
s: dynamicValues ? `${this.saturation}%` : '100%',
v: dynamicValues ? `${this.lightness}%`: '100%'
- 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 checkDirty
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
checkDirty(color) {
// check dirty/pristine state
if (this.hasOwnProperty('initialNgModel')) {
if (color === this.initialNgModel) {
if (typeof this.$scope.control[0].$setPristine === 'function') {
- 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 offset
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
offset(el) {
var docElem, win, rect, doc, elem = el[0];
if (!elem) {
return;
Function updateHueBackground
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateHueBackground(color) {
var el = this.find('.color-picker-hue .color-picker-overlay');
var direction = this.options.horizontal ? 'left' : 'top';
var zero_sixths = this.getColorValue(this.options.dynamicHue);
Function valueUpdate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
valueUpdate(type) {
if (this[type] !== undefined) {
if (type === 'saturation') {
this[`${type}Pos`] = this[type];
} else {
- 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 setColorValue
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
setColorValue(color) {
let noMouseEvents = !this.anyMouseEvents();
let hsl = this.options.round ? color.toHsl() : color.toHsv();
if (noMouseEvents || this.hueMouse) {
- 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 mergeOptions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
mergeOptions(options, defaultOptions) {
for (var attr in defaultOptions) {
if (defaultOptions.hasOwnProperty(attr)) {
if (!options || !options.hasOwnProperty(attr)) {
options[attr] = defaultOptions[attr];
- 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 update
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
update() {
if (!this.areAllValuesSet()) {
return false;
}
- 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 find
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
find(selector) {
var context = this.wrapper ? this.wrapper[0] : this.$element[0],
results = [],
nodeType;
- 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 watchNgModelSet
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
watchNgModelSet(newValue) {
if (newValue !== undefined && newValue !== null) {
var color = tinycolor(newValue);
var isValid = this.isColorValid(color);
- 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 offset
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
offset(el) {
var docElem, win, rect, doc, elem = el[0];
if (!elem) {
return;
- 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"