Showing 17 of 155 total issues
File app.js
has 694 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
DotLedger.module('Routers', function () {
var routes;
routes = {
// Root
'': 'root',
Function showAccount
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
showAccount: function (accountID) {
var account, balanceGraph, show, transactions, updateTransactions;
if (!this.QueryParams.has('tab')) {
this.QueryParams.set({
Function templateHelpers
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
templateHelpers: function () {
return {
hasAccounts: _.bind(function () {
return this.collection.length > 0;
}, this),
Function incomeAndExpenses
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
incomeAndExpenses: function () {
var categoryStatistics, filterView, renderReport, reportView;
DotLedger.title('Reports', 'Income and Expenses');
if (!this.QueryParams.has('period')) {
this.QueryParams.set({
Function templateHelpers
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
templateHelpers: function () {
return {
showAccountName: _.bind(function () {
return !!this.options.showAccountName;
}, this),
Function search
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
search: function () {
var searchFilters, searchLayout, searchResults, searchSummary, transactions, updateTransactions;
if (!this.QueryParams.has('page')) {
this.QueryParams.set({
page: 1
Function templateHelpers
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Open
root: function () {
var accounts, categoryStatistics, categoryTypeStatistics, dashboard;
DotLedger.title('Dashboard');
dashboard = new DotLedger.Views.Application.Dashboard();
Function save
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
save: function () {
var data, files;
this.ui.button.button('loading');
// FIXME: this is a bit hacky
Function Search
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.Search = function (input) {
var query = new DotLedger.Models.QueryParams();
var data = {};
input.category = input.category || input.category_id;
Function listAccounts
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
listAccounts: function () {
var activeAccounts, archivedAccounts;
DotLedger.title('Accounts');
list = new DotLedger.Views.Accounts.List();
Function onRender
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
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>');
Method index
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def index
@transactions = Transaction.includes(sorted_transaction: :category)
@transactions = @transactions.where(account_id: account_id) if account_id.present?
- 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 listPayments
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
listPayments: function () {
var balanceGraph, list, payments, paymentsView;
this.QueryParams.on('change', _.bind(function () {
DotLedger.navigate.listPayments(this.QueryParams.attributes, {
replace: true
Function listSortingRules
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
listSortingRules: function () {
var list, sortingRules, updateSortingRules;
if (!this.QueryParams.has('page')) {
this.QueryParams.set({
page: 1
Function balanceGraphOptions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
balanceGraphOptions: function () {
return {
series: {
shadowSize: 1,
lines: {
Function balanceGraphOptions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
balanceGraphOptions: function () {
return {
series: {
shadowSize: 1,
lines: {