Showing 124 of 297 total issues
Function updateInvestmentDetails
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public updateInvestmentDetails(): void {
const QUANTITY_DECIMAL_PLACES = 4,
PRICE_DECIMAL_PLACES = 3,
AMOUNT_DECIMAL_PLACES = 2;
- 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 index.test.ts
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type { Account, Accounts } from "~/accounts/types";
import type {
ControllerTestFactory,
JQueryKeyEventObjectMock,
} from "~/mocks/types";
Function invalidateCaches
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
private invalidateCaches(
savedTransaction: Transaction,
): angular.IPromise<Transaction> {
// Create a deferred so that we return a promise
const q: angular.IDeferred<Transaction> = this.$q.defer(),
Function editSchedule
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
private editSchedule(index?: number): void {
// Helper function to sort by next due date, then by transaction id
function byNextDueDateAndId(
a: ScheduledTransaction,
b: ScheduledTransaction,
Function updateLruCaches
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
private updateLruCaches(
transaction: Transaction,
): angular.IPromise<Transaction> {
// Create a deferred so that we return a promise
const q: angular.IDeferred<Transaction> = this.$q.defer();
Function editCategory
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public editCategory(index?: number): void {
// Helper function to sort by direction, then by category name, then by subcategory name
function byDirectionAndName(a: Category, b: Category): number {
let x: string, y: string;
Function constructor
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public constructor(
private readonly $q: QMock = {
defer<T>(): DeferredMock<T> {
let isResolved = false,
promiseValue: PromiseMock<T> | T | undefined,
- 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 index.cy.ts
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { addDays, lightFormat, startOfDay } from "date-fns";
import {
checkRowMatches,
checkSubtransactionRowValues,
scheduleSubtransactionsTableRows,
Function populateFormWith
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function populateFormWith(schedule: ScheduleEdit): void {
const {
primaryAccountName,
frequency,
rawNextDueDate,
TransactionEditController
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
export default class TransactionEditController {
public transaction: Transaction;
public readonly mode: "Add" | "Edit";
Function deleteCategory
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public deleteCategory(index: number): void {
// Check if the category can be deleted
this.categoryModel
.find(Number(this.categories[index].id))
.then((category: Category): void => {
Method ledger_query
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ledger_query(opts)
# Get the specified number of transactions up to the given date
transactions
.for_ledger(opts)
.select(
Function transactionsState
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function transactionsState(parentContext: string): angular.ui.IState {
return {
url: "/transactions",
data: {
title: `${
Function constructor
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public constructor(
$scope: angular.IScope,
private readonly $uibModalInstance: angular.ui.bootstrap.IModalInstanceService,
private readonly $timeout: angular.ITimeoutService,
private readonly filterFilter: angular.IFilterFilter,
Function constructor
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public constructor(
$scope: angular.IScope,
$transitions: angular.ui.IStateParamsService,
private readonly $uibModal: angular.ui.bootstrap.IModalService,
private readonly $timeout: angular.ITimeoutService,
Function transaction
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
transaction: ():
| angular.IPromise<Transaction>
| Partial<SecurityTransaction | Transaction>
| Transaction => {
// If we didn't get an index, we're adding a new transaction
Function constructor
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public constructor(
$sce: angular.ISCEService,
transactionModel: TransactionModel,
accountModel: AccountModel,
ogModalErrorService: OgModalErrorService,
File layout.test.ts
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type {
StateMock,
UibModalMock,
} from "~/mocks/node-modules/angular/types";
import type { AuthenticationModelMock } from "~/mocks/authentication/types";
Method closing_balance
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def closing_balance(balance_opts = {})
as_at =
begin
::Date.parse(balance_opts[:as_at]).to_s
rescue ::TypeError, ::ArgumentError
- 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 populateFormWith
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function populateFormWith(transaction: TransactionEdit): void {
const {
rawTransactionDate,
payeeName,
securityName,