Showing 15 of 17 total issues
`` has 31 functions (exceeds 20 allowed). Consider refactoring. Open
export default Mixin.create({
isSubmitting: false,
isDirty: false,
isLoaded: false,
isSaveError: false,
`` has 31 functions (exceeds 20 allowed). Consider refactoring. Open
export default ObjectProxy.extend(EmberValidations, FormObjectMixin, {
isNew: readOnly('model.isNew'),
propertiesServerErrors: computed(function() {
return {};
Function areTwoValuesEqual
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
function areTwoValuesEqual(a, b, opts = {}) {
const { takeOrderIntoAccount } = opts;
if (a === b) {
return 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
File form-object.js
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Ember from 'ember';
import { superWasCalled, ensureSuperWasCalled } from 'ember-form-object/utils/super';
import { normalizeValueForDirtyComparison, areTwoValuesEqual } from 'ember-form-object/utils/dirty-comparison';
import {
isThenable, runSafe, isFunction, isPlainObject, some, every, result, cloneDeep
Function areTwoValuesEqual
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function areTwoValuesEqual(a, b, opts = {}) {
const { takeOrderIntoAccount } = opts;
if (a === b) {
return true;
Function save
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
save() {
if (!this.get('isDirty') && !this.get('allowSaveIfNotDirty')) {
return RSVP.reject('Form object is not dirty');
}
Consider simplifying this complex logical expression. Open
if (res && ((res.errors && res.errors.length && res.errors[0].status) || res.isAdapterError)) {
const isServerValidationError = res.errors && res.errors.length && res.errors[0].status === '422';
return new EmberObject({
isAdapterError: true,
isServerValidationError,
Function some
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function some(obj, clb) {
const isObjArray = isArray(obj);
const keys = isObjArray ? obj : objectKeys(obj);
for (let i = 0; i < keys.length; i += 1) {
- 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 false;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return true;
Function _initProperty
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
_initProperty(initialProp, key) {
const prop = this.normalizePropertyDefinition(isPlainObject(initialProp) ? initialProp : {});
prop.state = this._getInitialPropertyState(prop);
if (prop.virtual) {
- 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 serverResponseError
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function serverResponseError(res) {
if (res && ((res.errors && res.errors.length && res.errors[0].status) || res.isAdapterError)) {
const isServerValidationError = res.errors && res.errors.length && res.errors[0].status === '422';
return new EmberObject({
isAdapterError: 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"