scottohara/loot

View on GitHub

Showing 124 of 298 total issues

Method to_ledger_json has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def to_ledger_json(trx)
        {
            id: trx['id'],
            transaction_type: trx['transaction_type'],
            transaction_date: trx['transaction_date'],
Severity: Minor
Found in app/models/concerns/transactable.rb - About 1 hr 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 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) {
Severity: Minor
Found in src/transactions/controllers/index.ts - About 1 hr to fix

    Function keyHandler has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                    scope.keyHandler = (event: JQueryKeyEventObject): void => {
                        if (ogTableNavigableService.enabled) {
                            // Check if the key pressed was a movement key
                            if (
                                undefined !==

      Function constructor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public constructor(
              payeeMockProvider: PayeeMockProvider,
              payeesMockProvider: PayeesMockProvider,
              $qMockProvider: QMockProvider,
          ) {
      Severity: Minor
      Found in src/mocks/payees/models/payee.ts - About 1 hr to fix

        Function categories has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public categories(
                filter: string,
                limit: number,
                parent?: Category | null,
                includeSplits = false,
        Severity: Minor
        Found in src/schedules/controllers/edit.ts - About 1 hr to fix

          Function categories has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public categories(
                  filter: string,
                  limit: number,
                  parent?: Category | null,
                  includeSplits = false,
          Severity: Minor
          Found in src/transactions/controllers/edit.ts - About 1 hr to fix

            Function getValuesFrom has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function getValuesFrom(row: JQuery<HTMLTableRowElement>): Transaction {
                const subcategoryOrAccountName = row.find(
                        transactionSubcategoryOrAccountName,
                    ),
                    creditAmount = row.find(transactionCreditAmount),
            Severity: Minor
            Found in cypress/support/transactions/index.ts - About 1 hr to fix

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

                Function useLastTransaction has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private useLastTransaction(
                        transaction?: Partial<ScheduledTransaction>,
                    ): void {
                        if (undefined === transaction) {
                            return;
                Severity: Minor
                Found in src/schedules/controllers/edit.ts - About 1 hr to fix

                  Function populateFormWith has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function populateFormWith(transaction: TransactionEdit): void {
                      const {
                          rawTransactionDate,
                          payeeName,
                          securityName,
                  Severity: Minor
                  Found in cypress/support/transactions/edit.ts - About 1 hr 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 constructor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public constructor(
                          $sce: angular.ISCEService,
                          transactionModel: TransactionModel,
                          accountModel: AccountModel,
                          ogModalErrorService: OgModalErrorService,
                  Severity: Minor
                  Found in src/transactions/directives/status.ts - About 1 hr 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 link has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              link(
                                  scope: OgInputCurrencyScope,
                                  iElement: JQuery<Element>,
                                  _: angular.IAttributes,
                                  ngModel: angular.INgModelController,
                  Severity: Minor
                  Found in src/og-components/og-input-currency/directives/og-input-currency.ts - About 1 hr to fix

                    Function useLastTransaction has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private useLastTransaction(transaction?: Partial<Transaction>): void {
                            if (undefined === transaction) {
                                return;
                            }
                    
                    
                    Severity: Minor
                    Found in src/transactions/controllers/edit.ts - About 1 hr to fix

                      Function getSubtransactions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private getSubtransactions(
                              transaction?: Transaction,
                          ): angular.IPromise<SplitTransaction> | Transaction | undefined {
                              if (undefined === transaction) {
                                  return undefined;
                      Severity: Minor
                      Found in src/schedules/controllers/edit.ts - About 1 hr to fix

                        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,
                        Severity: Minor
                        Found in src/transactions/controllers/index.ts - About 55 mins 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 checkRowMatches has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function checkRowMatches(
                            expectedValues: Transaction | TransactionEdit,
                        ): void {
                            const {
                                transactionDate,
                        Severity: Minor
                        Found in cypress/support/transactions/index.ts - About 55 mins 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

                        Method update_from_json has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def update_from_json(json)
                                original_account_type = account_type
                        
                                self.name = json['name']
                                self.account_type = json['account_type']
                        Severity: Minor
                        Found in app/models/account.rb - About 55 mins 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 editSecurity has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public editSecurity(index?: number): void {
                                // Helper function to sort by security current holding and name
                                function byHoldingAndName(a: Security, b: Security): number {
                                    let x: boolean, y: boolean;
                        
                        
                        Severity: Minor
                        Found in src/securities/controllers/index.ts - About 45 mins 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 getValuesFrom has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function getValuesFrom(row: JQuery<HTMLTableRowElement>): Transaction {
                            const subcategoryOrAccountName = row.find(
                                    transactionSubcategoryOrAccountName,
                                ),
                                creditAmount = row.find(transactionCreditAmount),
                        Severity: Minor
                        Found in cypress/support/transactions/index.ts - About 45 mins 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 constructor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public constructor($stateProvider: angular.ui.IStateProvider) {
                                const transactionViews: Record<string, angular.ui.IState> = {
                                    "@root": {
                                        templateUrl: TransactionIndexView,
                                        controller: "TransactionIndexController",
                        Severity: Minor
                        Found in src/loot/providers/states.ts - About 35 mins 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