balanced/balanced-dashboard

View on GitHub

Showing 243 of 243 total issues

Similar blocks of code found in 5 locations. Consider refactoring.
Open

var MarketplaceOrdersRoute = AuthRoute.extend({
    pageTitle: 'Orders',
    model: function() {
        var marketplace = this.modelFor("marketplace");
        return marketplace.getOrdersLoader();
Severity: Major
Found in app/routes/marketplace/orders.js and 4 other locations - About 1 hr to fix
app/routes/marketplace/customers.js on lines 3..9
app/routes/marketplace/invoices.js on lines 3..9
app/routes/marketplace/logs.js on lines 3..9
app/routes/marketplace/transactions.js on lines 3..9

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        if (object.existing_customer_name_or_email !== undefined) {
            creditCreator = ExistingCustomerCreditCreator.createFromQuery(marketplace, object);
        } else {
            creditCreator = NewCustomerCreditCreator.create({
                csvFields: object
Severity: Major
Found in app/lib/file-readers/credit_creator.js and 1 other location - About 1 hr to fix
app/lib/file-readers/credit-creator.js on lines 96..102

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 5 locations. Consider refactoring.
Open

var MarketplaceCustomersRoute = AuthRoute.extend({
    pageTitle: 'Customers',
    model: function() {
        var marketplace = this.modelFor("marketplace");
        return marketplace.getCustomersLoader();
Severity: Major
Found in app/routes/marketplace/customers.js and 4 other locations - About 1 hr to fix
app/routes/marketplace/invoices.js on lines 3..9
app/routes/marketplace/logs.js on lines 3..9
app/routes/marketplace/orders.js on lines 3..9
app/routes/marketplace/transactions.js on lines 3..9

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 5 locations. Consider refactoring.
Open

var MarketplaceTransactionsRoute = AuthRoute.extend({
    pageTitle: 'Transactions',
    model: function() {
        var marketplace = this.modelFor("marketplace");
        return marketplace.getTransactionsLoader();
Severity: Major
Found in app/routes/marketplace/transactions.js and 4 other locations - About 1 hr to fix
app/routes/marketplace/customers.js on lines 3..9
app/routes/marketplace/invoices.js on lines 3..9
app/routes/marketplace/logs.js on lines 3..9
app/routes/marketplace/orders.js on lines 3..9

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            return [{
                className: "dispute-details-row",
                type: "Dispute",
                quantity: "disputes_count",
                txnAmount: "disputes_total_amount",
Severity: Major
Found in app/views/results/invoice-table.js and 1 other location - About 1 hr to fix
app/views/results/invoice-table.js on lines 51..58

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        return [{
                className: "hold-details-row",
                type: "Hold",
                quantity: "holds_count",
                txnAmount: "holds_total_amount",
Severity: Major
Found in app/views/results/invoice-table.js and 1 other location - About 1 hr to fix
app/views/results/invoice-table.js on lines 41..48

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function save has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    save: function() {
        var Debit = BalancedApp.__container__.lookupFactory("model:debit");
        var self = this;
        this.validate();
        if (this.get("isValid")) {

    Consider simplifying this complex logical expression.
    Open

                if (record.hasOwnProperty(prop) &&
                    $.inArray(prop, computedProps) === -1 &&
                    $.inArray(prop, lifecycleProperties) === -1 &&
                    $.inArray(prop, this.privateProperties) === -1 &&
                    prop.indexOf('__ember') < 0 &&
    Severity: Major
    Found in app/serializers/rev0.js - About 1 hr to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          twitter_url: function() {
              if (this.get('twitter_id')) {
                  return 'http://twitter.com/' + this.get('twitter_id');
              } else {
                  return undefined;
      Severity: Major
      Found in app/models/customer.js and 1 other location - About 1 hr to fix
      app/models/customer.js on lines 101..107

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 55.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Consider simplifying this complex logical expression.
      Open

                  if (record.hasOwnProperty(prop) &&
                      $.inArray(prop, computedProps) === -1 &&
                      $.inArray(prop, lifecycleProperties) === -1 &&
                      $.inArray(prop, this.privateProperties) === -1 &&
                      prop.indexOf('__ember') < 0 &&
      Severity: Major
      Found in app/serializers/rev1.js - About 1 hr to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            facebook_url: function() {
                if (this.get('facebook_id')) {
                    return 'http://facebook.com/' + this.get('facebook_id');
                } else {
                    return undefined;
        Severity: Major
        Found in app/models/customer.js and 1 other location - About 1 hr to fix
        app/models/customer.js on lines 109..115

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 55.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            yearName: function() {
                var name = this.get("name");
                if (name) {
                    return name + "_year";
                }
        Severity: Minor
        Found in app/views/form-fields/month-year-select-form-field.js and 1 other location - About 55 mins to fix
        app/views/form-fields/month-year-select-form-field.js on lines 17..25

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 54.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            onSuccess: function() {
                Auth.get("user").reload();
                var message = 'Your email address has been updated.';
                this.get('controller.controllers.notification_center').alertSuccess(message);
            },
        Severity: Minor
        Found in app/views/modals/change-email-modal.js and 1 other location - About 55 mins to fix
        app/views/modals/change-password-modal.js on lines 41..45

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 54.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            monthName: function() {
                var name = this.get("name");
                if (name) {
                    return name + "_month";
                }
        Severity: Minor
        Found in app/views/form-fields/month-year-select-form-field.js and 1 other location - About 55 mins to fix
        app/views/form-fields/month-year-select-form-field.js on lines 7..15

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 54.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            onSuccess: function() {
                Auth.get("user").reload();
                var message = 'Your password has been updated.';
                this.get('controller.controllers.notification_center').alertSuccess(message);
            },
        Severity: Minor
        Found in app/views/modals/change-password-modal.js and 1 other location - About 55 mins to fix
        app/views/modals/change-email-modal.js on lines 39..43

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 54.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function applyUriFilters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            applyUriFilters: function(uri, params) {
                if (!uri) {
                    return uri;
                }
        
        
        Severity: Minor
        Found in app/lib/utils.js - About 55 mins 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 validateAndSave has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            validateAndSave: function(settings) {
                this.get("validationErrors").clear();
                this.validate();
                if (this.get("isValid")) {
                    var Adapter = this.constructor.getAdapter();
        Severity: Minor
        Found in app/models/core/model.js - About 55 mins 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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            onModelSaved: function (model) {
                this.get("controller").transitionToRoute(model.get("route_name"), model);
                this.close();
                return model;
            },
        Severity: Minor
        Found in app/views/modals/debit-customer-modal.js and 1 other location - About 50 mins to fix
        app/views/modals/customer-card-create-modal.js on lines 36..40

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 52.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            onModelSaved: function (model) {
                this.get("controller").transitionToRoute(model.get("route_name"), model);
                this.close();
                return model;
            },
        Severity: Minor
        Found in app/views/modals/customer-card-create-modal.js and 1 other location - About 50 mins to fix
        app/views/modals/debit-customer-modal.js on lines 28..32

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 52.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        var DebitExistingCardTransactionFactory = DebitExistingFundingInstrumentTransactionFactory.extend({
            validations: {
                dollar_amount: ValidationHelpers.positiveDollarAmount,
                appears_on_statement_as: ValidationHelpers.cardTransactionAppearsOnStatementAs,
        
        
        Severity: Minor
        Found in app/models/factories/debit-existing-card-transaction-factory.js and 1 other location - About 50 mins to fix
        app/models/factories/debit-existing-bank-account-transaction-factory.js on lines 4..13

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 51.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Severity
        Category
        Status
        Source
        Language