File index.ts
has 779 lines of code (exceeds 250 allowed). Consider refactoring. Open
import "~/transactions/css/index.css";
import type { Account, AccountType } from "~/accounts/types";
import type {
CashTransaction,
CategorisableTransaction,
Function editTransaction
has 134 lines of code (exceeds 25 allowed). Consider refactoring. Open
private editTransaction(index?: number): void {
// Helper function to sort by transaction date, then by transaction id
function byTransactionDateAndId(a: Transaction, b: Transaction): number {
let x: Date | number, y: Date | number;
Function editTransaction
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private editTransaction(index?: number): void {
// Helper function to sort by transaction date, then by transaction id
function byTransactionDateAndId(a: Transaction, b: Transaction): number {
let x: Date | number, y: Date | number;
- 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
TransactionIndexController
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
export default class TransactionIndexController {
public readonly tableActions: OgTableActions;
public readonly today: Date = startOfDay(new Date());
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 reconcile
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public reconcile(): void {
if (!this.reconciling) {
// Disable navigation on the table
this.ogTableNavigableService.enabled = false;
Function transitionSuccessHandler
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private transitionSuccessHandler(transactionId: number): void {
if (isNaN(this.focusTransaction(transactionId))) {
// Transaction was not found in the current set
// Get the transaction details from the server
Function getTransactions
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public getTransactions(
direction: TransactionFetchDirection,
fromDate?: Date,
transactionIdToFocus?: number,
): void {
Function updateClosingBalance
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private updateClosingBalance(
originalTransaction?: Transaction,
newTransaction?: Transaction,
): void {
// Only proceed if the context has a closing balance (ie. not in search mode)
- 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 contextChanged
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private contextChanged(transaction: Transaction): boolean {
let currentContext: Entity | null | undefined;
// Check if the transaction still matches the context
switch (this.contextType) {
Function promptToSwitchAccounts
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private promptToSwitchAccounts(
message: string,
transaction: SplitTransactionChild | Transaction,
): void {
// Disable navigation on the table
Function constructor
has a Cognitive Complexity of 9 (exceeds 5 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,
- 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 getTransactions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public getTransactions(
direction: TransactionFetchDirection,
fromDate?: Date,
transactionIdToFocus?: number,
): void {
- 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"