balanced/balanced-dashboard

View on GitHub

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/'
    }, {
Severity: Major
Found in Gruntfile.js - About 7 hrs to fix

    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";
    Severity: Minor
    Found in app/models/core/model.js - About 5 hrs to fix

      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);
          },
      Severity: Minor
      Found in app/lib/utils.js - About 5 hrs to fix

        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\/[^\/]*\/(.+)$/,
        Severity: Minor
        Found in app/lib/utils.js - About 4 hrs to fix

          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;
          Severity: Minor
          Found in app/adapters/ajax.js - About 2 hrs to fix

          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",
          Severity: Minor
          Found in app/lib/country-codes.js - About 2 hrs to fix

            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) {
            Severity: Minor
            Found in app/auth.js - About 2 hrs to fix

              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');
              Severity: Minor
              Found in app/routes/application.js - About 2 hrs to fix

              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",
              Severity: Major
              Found in app/views/results/invoice-table.js - About 2 hrs to fix

                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) {
                Severity: Major
                Found in app/models/card.js - About 2 hrs to fix

                  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";
                  
                  
                  Severity: Minor
                  Found in app/auth.js - About 2 hrs to fix

                    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) {
                    Severity: Major
                    Found in app/models/bank-account.js - About 2 hrs to fix

                      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');
                      Severity: Major
                      Found in app/routes/application.js - About 2 hrs to fix

                        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);
                                    };
                        Severity: Minor
                        Found in app/views/marketplaces/add-test-marketplace.js - About 1 hr to fix

                          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);
                          Severity: Minor
                          Found in app/models/core/model.js - About 1 hr to fix

                          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);
                          Severity: Minor
                          Found in app/models/core/model.js - About 1 hr to fix

                            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');
                            
                            
                            Severity: Minor
                            Found in app/models/core/model-array.js - About 1 hr to fix

                            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;
                            
                            
                            Severity: Minor
                            Found in app/serializers/rev1.js - About 1 hr to fix

                            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');
                            
                            
                            Severity: Minor
                            Found in app/models/core/model-array.js - About 1 hr to fix

                              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;
                              
                              
                              Severity: Minor
                              Found in app/serializers/rev1.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language