dotledger/dotledger

View on GitHub

Showing 17 of 155 total issues

File app.js has 694 lines of code (exceeds 250 allowed). Consider refactoring.
Open

DotLedger.module('Routers', function () {
  var routes;
  routes = {
    // Root
    '': 'root',
Severity: Major
Found in app/assets/javascripts/dot_ledger/routers/app.js - About 1 day to fix

    Function showAccount has 90 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        showAccount: function (accountID) {
          var account, balanceGraph, show, transactions, updateTransactions;
    
          if (!this.QueryParams.has('tab')) {
            this.QueryParams.set({
    Severity: Major
    Found in app/assets/javascripts/dot_ledger/routers/app.js - About 3 hrs to fix

      Function templateHelpers has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          templateHelpers: function () {
            return {
              hasAccounts: _.bind(function () {
                return this.collection.length > 0;
              }, this),
      Severity: Major
      Found in app/assets/javascripts/dot_ledger/views/accounts/list_widget.js - About 2 hrs to fix

        Function incomeAndExpenses has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            incomeAndExpenses: function () {
              var categoryStatistics, filterView, renderReport, reportView;
              DotLedger.title('Reports', 'Income and Expenses');
              if (!this.QueryParams.has('period')) {
                this.QueryParams.set({
        Severity: Major
        Found in app/assets/javascripts/dot_ledger/routers/app.js - About 2 hrs to fix

          Function templateHelpers has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              templateHelpers: function () {
                return {
                  showAccountName: _.bind(function () {
                    return !!this.options.showAccountName;
                  }, this),
          Severity: Minor
          Found in app/assets/javascripts/dot_ledger/views/transactions/table_row.js - About 1 hr to fix

            Function search has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                search: function () {
                  var searchFilters, searchLayout, searchResults, searchSummary, transactions, updateTransactions;
                  if (!this.QueryParams.has('page')) {
                    this.QueryParams.set({
                      page: 1
            Severity: Minor
            Found in app/assets/javascripts/dot_ledger/routers/app.js - About 1 hr to fix

              Function templateHelpers has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  templateHelpers: function () {
                    return {
                      spentAmountTotal: _.bind(function () {
                        return DotLedger.Helpers.Format.money(this.collection.metadata.total_spent);
                      }, this),

                Function root has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    root: function () {
                      var accounts, categoryStatistics, categoryTypeStatistics, dashboard;
                      DotLedger.title('Dashboard');
                      dashboard = new DotLedger.Views.Application.Dashboard();
                
                
                Severity: Minor
                Found in app/assets/javascripts/dot_ledger/routers/app.js - About 1 hr to fix

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

                      save: function () {
                        var data, files;
                        this.ui.button.button('loading');
                  
                        // FIXME: this is a bit hacky
                  Severity: Minor
                  Found in app/assets/javascripts/dot_ledger/views/statements/form.js - About 1 hr to fix

                    Function Search has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      this.Search = function (input) {
                        var query = new DotLedger.Models.QueryParams();
                        var data = {};
                    
                        input.category = input.category || input.category_id;
                    Severity: Minor
                    Found in app/assets/javascripts/dot_ledger/helpers/search.js - About 1 hr to fix

                      Function listAccounts has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          listAccounts: function () {
                            var activeAccounts, archivedAccounts;
                            DotLedger.title('Accounts');
                      
                            list = new DotLedger.Views.Accounts.List();
                      Severity: Minor
                      Found in app/assets/javascripts/dot_ledger/routers/app.js - About 1 hr to fix

                        Function onRender has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            onRender: function () {
                              this.formErrors = new DotLedger.Helpers.FormErrors(this.model, this.$el);
                              DotLedger.on('options:change', this.renderPeriodFrom, this);
                              DotLedger.on('options:change', this.renderPeriodTo, this);
                              this.ui.review.append('<option value="">Any</option>');
                        Severity: Minor
                        Found in app/assets/javascripts/dot_ledger/views/saved_searches/form.js - About 1 hr to fix

                          Method index has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def index
                                @transactions = Transaction.includes(sorted_transaction: :category)
                          
                                @transactions = @transactions.where(account_id: account_id) if account_id.present?
                          
                          
                          Severity: Minor
                          Found in app/controllers/api/transactions_controller.rb - 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 listPayments has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              listPayments: function () {
                                var balanceGraph, list, payments, paymentsView;
                                this.QueryParams.on('change', _.bind(function () {
                                  DotLedger.navigate.listPayments(this.QueryParams.attributes, {
                                    replace: true
                          Severity: Minor
                          Found in app/assets/javascripts/dot_ledger/routers/app.js - About 1 hr to fix

                            Function listSortingRules has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                listSortingRules: function () {
                                  var list, sortingRules, updateSortingRules;
                                  if (!this.QueryParams.has('page')) {
                                    this.QueryParams.set({
                                      page: 1
                            Severity: Minor
                            Found in app/assets/javascripts/dot_ledger/routers/app.js - About 1 hr to fix

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

                                  balanceGraphOptions: function () {
                                    return {
                                      series: {
                                        shadowSize: 1,
                                        lines: {

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

                                    balanceGraphOptions: function () {
                                      return {
                                        series: {
                                          shadowSize: 1,
                                          lines: {
                                Severity: Minor
                                Found in app/assets/javascripts/dot_ledger/views/accounts/balance_graph.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language