File edit.ts
has 701 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type { Account, StoredAccountType } from "~/accounts/types";
import type {
CashTransaction,
CategorisableTransaction,
PayeeCashTransaction,
Function categorySelected
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
public categorySelected(index?: number): void {
const transaction: SplitTransactionChild | Transaction = isNaN(
Number(index),
)
? this.transaction
Function categorySelected
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public categorySelected(index?: number): void {
const transaction: SplitTransactionChild | Transaction = isNaN(
Number(index),
)
? this.transaction
- 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 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
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 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();
TransactionEditController
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
export default class TransactionEditController {
public transaction: Transaction;
public readonly mode: "Add" | "Edit";
Function updateInvestmentDetails
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public updateInvestmentDetails(): void {
const QUANTITY_DECIMAL_PLACES = 4,
PRICE_DECIMAL_PLACES = 3,
AMOUNT_DECIMAL_PLACES = 2;
Function constructor
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public constructor(
$scope: angular.IScope,
private readonly $uibModalInstance: angular.ui.bootstrap.IModalInstanceService,
private readonly $q: angular.IQService,
private readonly $timeout: angular.ITimeoutService,
Function investmentCategorySelected
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public investmentCategorySelected(): void {
let { transaction_type, direction } = this.transaction;
// Check the category selection
if ("object" === typeof this.transaction.category) {
Function categories
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public categories(
filter: string,
limit: number,
parent?: Category | null,
includeSplits = false,
Function useLastTransaction
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private useLastTransaction(transaction?: Partial<Transaction>): void {
if (undefined === transaction) {
return;
}
Function updateLruCaches
has a Cognitive Complexity of 6 (exceeds 5 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();
- 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"