Showing 63 of 243 total issues
Function exports
has 184 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(grunt) {
var S3_CACHED_UPLOAD_CONFIGURATION = [{
src: 'dist/js/*',
dest: 'js/'
}, {
File model.js
has 413 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Ember from "ember";
import LoadPromise from "./mixins/load-promise";
import TypeMappings from "./type-mappings";
import Computed from "balanced-dashboard/utils/computed";
import Rev1Serializer from "balanced-dashboard/serializers/rev1";
Utils
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
var Utils = Ember.Namespace.create({
toDataUri: function(string) {
return "data:text/plain;charset=utf-8;base64," + window.btoa(string);
},
File utils.js
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Ember from "ember";
import Constants from "balanced-dashboard/utils/constants";
var FORMAT_NUMBER_REGEX = /\B(?=(\d{3})+(?!\d))/g,
PRETTY_LOG_URL_REGEX = /\/marketplaces\/[^\/]*\/(.+)$/,
Function ajax
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
ajax: function(url, type, settings) {
settings = settings || {};
settings.url = url;
settings.type = type;
settings.context = this;
- 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 country-codes.js
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Taken from https://github.com/umpirsky/country-list
var CountryCodesToNames = {
"AF": "Afghanistan",
"AL": "Albania",
"DZ": "Algeria",
Auth
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
var Auth = Ember.Namespace.extend(Ember.Evented).create({
loadCsrfTokenIfNotLoaded: function() {
return Ajax.loadCSRFTokenIfNotLoaded();
},
request: function(opts) {
Function error
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
error: function(error, transition) {
if (!window.TESTING) {
// Check for an infinite loop of error handling and short-circuit
// if we've seen too many errors in too short a period
var errorTimestamps = this.get('errorTimestamps');
- 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 feesByType
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
feesByType: function() {
if (this.get("model.isDispute")) {
return [{
className: "dispute-details-row",
type: "Dispute",
Function tokenizeAndCreate
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
tokenizeAndCreate: function(customerId) {
var self = this;
var promise = this.resolveOn('didCreate');
function errorCreatingCard(err) {
File auth.js
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
import ENV from "balanced-dashboard/config/environment";
import Ember from "ember";
import Utils from "./lib/utils";
import Marketplace from "balanced-dashboard/models/marketplace";
Function tokenizeAndCreate
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
tokenizeAndCreate: function(customerId) {
var self = this;
var deferred = Ember.RSVP.defer();
function errorCreatingBankAccount(err) {
Function error
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
error: function(error, transition) {
if (!window.TESTING) {
// Check for an infinite loop of error handling and short-circuit
// if we've seen too many errors in too short a period
var errorTimestamps = this.get('errorTimestamps');
Function add
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
add: function() {
var self = this;
var lookup = function(modelName) {
return self.get("container").lookupFactory("model:" + modelName);
};
Function _handleError
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
_handleError: function(jqXHR, textStatus, errorThrown) {
this.set('isSaving', false);
if (jqXHR.status >= 400 && jqXHR.status < 500) {
this.set('isValid', 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 _handleError
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
_handleError: function(jqXHR, textStatus, errorThrown) {
this.set('isSaving', false);
if (jqXHR.status >= 400 && jqXHR.status < 500) {
this.set('isValid', false);
Function _populateModels
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
_populateModels: function(json) {
var self = this;
var typeClass = this.get('typeClass');
- 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 _populateObject
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
_populateObject: function(modelObj, objType, rootJson) {
var linksValues = {};
linksValues[objType + '.id'] = modelObj.id;
linksValues[objType + '.self'] = modelObj.id;
- 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 _populateModels
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
_populateModels: function(json) {
var self = this;
var typeClass = this.get('typeClass');
Function _populateObject
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
_populateObject: function(modelObj, objType, rootJson) {
var linksValues = {};
linksValues[objType + '.id'] = modelObj.id;
linksValues[objType + '.self'] = modelObj.id;