scottohara/loot

View on GitHub

Showing 124 of 297 total issues

File edit.cy.ts has 377 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import type {
    Transaction,
    TransactionEdit,
    TransactionsContext,
} from "~/support/transactions/types";
Severity: Minor
Found in cypress/e2e/transactions/edit.cy.ts - About 5 hrs to fix

    File security.test.ts has 374 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import type {
        CacheFactoryMock,
        WindowMock,
    } from "~/mocks/node-modules/angular/types";
    import type {
    Severity: Minor
    Found in src/securities/models/security.test.ts - About 5 hrs to fix

      File index.cy.ts has 373 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import {
          checkRowMatches,
          checkSubtransactionRowValues,
          transactionSubtransactionsTableRows,
          transactionSubtransactionsToggleButton,
      Severity: Minor
      Found in cypress/e2e/transactions/index.cy.ts - About 4 hrs to fix

        File edit.cy.ts has 369 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import type { Schedule, ScheduleEdit } from "~/support/schedules/types";
        import { addDays, lightFormat, startOfDay } from "date-fns";
        import {
            cancelButton,
            invalidateForm,
        Severity: Minor
        Found in cypress/e2e/schedules/edit.cy.ts - About 4 hrs to fix

          Function constructor has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
          Open

              public constructor(
                  $window: angular.IWindowService,
                  $timeout: angular.ITimeoutService,
                  ogModalErrorService: OgModalErrorService,
              ) {

          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 payee.test.ts has 363 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import type {
              CacheFactoryMock,
              WindowMock,
          } from "~/mocks/node-modules/angular/types";
          import type {
          Severity: Minor
          Found in src/payees/models/payee.test.ts - About 4 hrs to fix

            File account.test.ts has 357 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import type { Account, Accounts } from "~/accounts/types";
            import type {
                CacheFactoryMock,
                WindowMock,
            } from "~/mocks/node-modules/angular/types";
            Severity: Minor
            Found in src/accounts/models/account.test.ts - About 4 hrs to fix

              File index.test.ts has 338 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import type {
                  StateMock,
                  UibModalMock,
                  UibModalMockResolves,
              } from "~/mocks/node-modules/angular/types";
              Severity: Minor
              Found in src/securities/controllers/index.test.ts - About 4 hrs to fix

                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
                Severity: Major
                Found in src/schedules/controllers/edit.ts - About 4 hrs to fix

                  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
                  Severity: Major
                  Found in src/transactions/controllers/edit.ts - About 4 hrs to fix

                    File states.ts has 330 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import type { Entity, EntityModel } from "~/loot/types";
                    import AccountIndexView from "~/accounts/views/index.html";
                    import type AccountModel from "~/accounts/models/account";
                    import type { Accounts } from "~/accounts/types";
                    import AuthenticationEditView from "~/authentication/views/edit.html";
                    Severity: Minor
                    Found in src/loot/providers/states.ts - About 3 hrs to fix

                      File index.test.ts has 328 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import type {
                          StateMock,
                          UibModalMock,
                          UibModalMockResolves,
                      } from "~/mocks/node-modules/angular/types";
                      Severity: Minor
                      Found in src/payees/controllers/index.test.ts - About 3 hrs to fix

                        File category.test.ts has 324 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import type {
                            CacheFactoryMock,
                            WindowMock,
                        } from "~/mocks/node-modules/angular/types";
                        import type {
                        Severity: Minor
                        Found in src/categories/models/category.test.ts - About 3 hrs to fix

                          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;
                          
                          
                          Severity: Minor
                          Found in src/transactions/controllers/index.ts - About 3 hrs to fix

                          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());
                          
                          
                          Severity: Minor
                          Found in src/transactions/controllers/index.ts - About 3 hrs to fix

                            Method closing_balance has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def closing_balance(balance_opts = {})
                                    as_at =
                                        begin
                                            ::Date.parse(balance_opts[:as_at]).to_s
                                        rescue ::TypeError, ::ArgumentError
                            Severity: Major
                            Found in app/models/concerns/transactable.rb - About 3 hrs to fix

                              ScheduleEditController has 27 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              export default class ScheduleEditController {
                                  public transaction: ScheduledTransaction;
                              
                                  public mode: "Add Schedule" | "Edit Schedule" | "Enter Transaction";
                              
                              
                              Severity: Minor
                              Found in src/schedules/controllers/edit.ts - About 3 hrs to fix

                                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;
                                
                                
                                Severity: Minor
                                Found in src/schedules/controllers/edit.ts - About 3 hrs to fix

                                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

                                    public categorySelected(index?: number): void {
                                        const transaction: SplitTransactionChild | Transaction = isNaN(
                                            Number(index),
                                        )
                                            ? this.transaction
                                Severity: Minor
                                Found in src/transactions/controllers/edit.ts - About 3 hrs to fix

                                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

                                    public categorySelected(index?: number): void {
                                        const transaction: SplitTransactionChild | Transaction = isNaN(
                                            Number(index),
                                        )
                                            ? this.transaction
                                Severity: Minor
                                Found in src/schedules/controllers/edit.ts - About 3 hrs to fix

                                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

                                Severity
                                Category
                                Status
                                Source
                                Language