src/schedules/controllers/edit.ts
File edit.ts
has 692 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import type {
Account,
AccountType,
Accounts,
StoredAccountType,
Function categorySelected
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public categorySelected(index?: number): void {
const transaction: SplitTransactionChild | Transaction = isNaN(
Number(index),
)
? this.transaction
ScheduleEditController
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export default class ScheduleEditController {
public transaction: ScheduledTransaction;
public mode: "Add Schedule" | "Edit Schedule" | "Enter Transaction";
Function updateInvestmentDetails
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
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 categorySelected
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
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 constructor
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public constructor(
$scope: angular.IScope,
private readonly $uibModalInstance: angular.ui.bootstrap.IModalInstanceService,
private readonly $timeout: angular.ITimeoutService,
private readonly filterFilter: angular.IFilterFilter,
Function updateInvestmentDetails
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public updateInvestmentDetails(): void {
const QUANTITY_DECIMAL_PLACES = 4,
PRICE_DECIMAL_PLACES = 3,
AMOUNT_DECIMAL_PLACES = 2;
Function calculateNextDue
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private calculateNextDue(): void {
const WEEK = 1,
FORTNIGHT = 2,
MONTH = 1,
BIMONTH = 2,
Function investmentCategorySelected
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Open
public categories(
filter: string,
limit: number,
parent?: Category | null,
includeSplits = false,
Function useLastTransaction
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private useLastTransaction(
transaction?: Partial<ScheduledTransaction>,
): void {
if (undefined === transaction) {
return;
Function getSubtransactions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private getSubtransactions(
transaction?: Transaction,
): angular.IPromise<SplitTransaction> | Transaction | undefined {
if (undefined === transaction) {
return undefined;