juice-shop/juice-shop

View on GitHub

Showing 24 of 152 total issues

File ContractABIs.ts has 1213 lines of code (exceeds 300 allowed). Consider refactoring.
Open

export const nftABI = [
  {
    inputs: [],
    stateMutability: 'nonpayable',
    type: 'constructor',
Severity: Major
Found in frontend/src/assets/public/ContractABIs.ts - About 2 days to fix

    File contractABIs.ts has 569 lines of code (exceeds 300 allowed). Consider refactoring.
    Open

    export const nftABI = [
      {
        inputs: [],
        stateMutability: 'nonpayable',
        type: 'constructor'
    Severity: Major
    Found in data/static/contractABIs.ts - About 1 day to fix

      File 2faSpec.ts has 381 lines of code (exceeds 300 allowed). Consider refactoring.
      Open

      /*
       * Copyright (c) 2014-2024 Bjoern Kimminich & the OWASP Juice Shop contributors.
       * SPDX-License-Identifier: MIT
       */
      
      
      Severity: Minor
      Found in test/api/2faSpec.ts - About 3 hrs to fix

        File configValidationSpec.ts has 377 lines of code (exceeds 300 allowed). Consider refactoring.
        Open

        /*
         * Copyright (c) 2014-2024 Bjoern Kimminich & the OWASP Juice Shop contributors.
         * SPDX-License-Identifier: MIT
         */
        
        
        Severity: Minor
        Found in test/server/configValidationSpec.ts - About 3 hrs to fix

          File dataExportApiSpec.ts has 355 lines of code (exceeds 300 allowed). Consider refactoring.
          Open

          /*
           * Copyright (c) 2014-2024 Bjoern Kimminich & the OWASP Juice Shop contributors.
           * SPDX-License-Identifier: MIT
           */
          
          
          Severity: Minor
          Found in test/api/dataExportApiSpec.ts - About 3 hrs to fix

            Function setupNodeEvents has 77 lines of code (exceeds 30 allowed). Consider refactoring.
            Open

                setupNodeEvents (on: any) {
                  on('before:browser:launch', (browser: any = {}, launchOptions: any) => { // TODO Remove after upgrade to Cypress >=12.5.0 <or> Chrome 119 become available on GitHub Workflows, see https://github.com/cypress-io/cypress-documentation/issues/5479
                    if (browser.name === 'chrome' && browser.isHeadless) {
                      launchOptions.args = launchOptions.args.map((arg: any) => {
                        if (arg === '--headless') {
            Severity: Major
            Found in cypress.config.ts - About 2 hrs to fix

              Function checkDiffs has 66 lines of code (exceeds 30 allowed). Consider refactoring.
              Open

              const checkDiffs = async (keys: string[]) => {
                const data: CacheData = keys.reduce((prev, curr) => {
                  return {
                    ...prev,
                    [curr]: {
              Severity: Major
              Found in rsn/rsnUtil.ts - About 2 hrs to fix

                Function invokeFunction has 65 lines of code (exceeds 30 allowed). Consider refactoring.
                Open

                  async invokeFunction (func) {
                    if (!this.session) {
                      this.snackBarHelperService.open('PLEASE_CONNECT_WEB3_WALLET', 'errorBar')
                      return
                    }
                Severity: Major
                Found in frontend/src/app/web3-sandbox/web3-sandbox.component.ts - About 2 hrs to fix

                  File app.module.ts has 315 lines of code (exceeds 300 allowed). Consider refactoring.
                  Open

                  /*
                   * Copyright (c) 2014-2024 Bjoern Kimminich & the OWASP Juice Shop contributors.
                   * SPDX-License-Identifier: MIT
                   */
                  
                  
                  Severity: Minor
                  Found in frontend/src/app/app.module.ts - About 2 hrs to fix

                    File quantityApiSpec.ts has 313 lines of code (exceeds 300 allowed). Consider refactoring.
                    Open

                    /*
                     * Copyright (c) 2014-2024 Bjoern Kimminich & the OWASP Juice Shop contributors.
                     * SPDX-License-Identifier: MIT
                     */
                    
                    
                    Severity: Minor
                    Found in test/api/quantityApiSpec.ts - About 2 hrs to fix

                      Function handleAuth has 56 lines of code (exceeds 30 allowed). Consider refactoring.
                      Open

                        async handleAuth () {
                          try {
                            const { isConnected } = getAccount()
                      
                            if (isConnected) {
                      Severity: Major
                      Found in frontend/src/app/wallet-web3/wallet-web3.component.ts - About 2 hrs to fix

                        Function invokeFunction has a Cognitive Complexity of 17 (exceeds 7 allowed). Consider refactoring.
                        Open

                          async invokeFunction (func) {
                            if (!this.session) {
                              this.snackBarHelperService.open('PLEASE_CONNECT_WEB3_WALLET', 'errorBar')
                              return
                            }
                        Severity: Minor
                        Found in frontend/src/app/web3-sandbox/web3-sandbox.component.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 deploySelectedContract has 48 lines of code (exceeds 30 allowed). Consider refactoring.
                        Open

                          async deploySelectedContract () {
                            if (!this.session) {
                              this.snackBarHelperService.open('PLEASE_CONNECT_WEB3_WALLET', 'errorBar')
                              return
                            }
                        Severity: Minor
                        Found in frontend/src/app/web3-sandbox/web3-sandbox.component.ts - About 1 hr to fix

                          Function handleAuth has 46 lines of code (exceeds 30 allowed). Consider refactoring.
                          Open

                            async handleAuth () {
                              try {
                                const { isConnected } = getAccount()
                          
                                if (isConnected) {
                          Severity: Minor
                          Found in frontend/src/app/web3-sandbox/web3-sandbox.component.ts - About 1 hr to fix

                            Function setupNodeEvents has a Cognitive Complexity of 15 (exceeds 7 allowed). Consider refactoring.
                            Open

                                setupNodeEvents (on: any) {
                                  on('before:browser:launch', (browser: any = {}, launchOptions: any) => { // TODO Remove after upgrade to Cypress >=12.5.0 <or> Chrome 119 become available on GitHub Workflows, see https://github.com/cypress-io/cypress-documentation/issues/5479
                                    if (browser.name === 'chrome' && browser.isHeadless) {
                                      launchOptions.args = launchOptions.args.map((arg: any) => {
                                        if (arg === '--headless') {
                            Severity: Minor
                            Found in cypress.config.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 findFilesWithCodeChallenges has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring.
                            Open

                            export const findFilesWithCodeChallenges = async (paths: readonly string[]): Promise<FileMatch[]> => {
                              const matches = []
                              for (const currPath of paths) {
                                if ((await fs.lstat(currPath)).isDirectory()) {
                                  const files = await fs.readdir(currPath)
                            Severity: Minor
                            Found in lib/codingChallenges.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 checkData has a Cognitive Complexity of 11 (exceeds 7 allowed). Consider refactoring.
                            Open

                            function checkData (data: CacheData, fileData: CacheData) {
                              const filesWithDiff = []
                              for (const key in data) {
                                const fileDataValueAdded = fileData[key].added.sort((a, b) => a - b)
                                const dataValueAdded = data[key].added.sort((a, b) => a - b)
                            Severity: Minor
                            Found in rsn/rsnUtil.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 seePatch has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
                            Open

                            async function seePatch (file: string) {
                              const fileData = fs.readFileSync(fixesPath + '/' + file).toString()
                              const snippet = await retrieveCodeSnippet(file.split('_')[0])
                              if (snippet == null) return
                              const patch = Diff.structuredPatch(file, file, filterString(snippet.snippet), filterString(fileData))
                            Severity: Minor
                            Found in rsn/rsnUtil.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

                            Avoid too many return statements within this function.
                            Open

                                return { enabled: false, disabledBecause: 'Gitpod' }
                            Severity: Major
                            Found in lib/utils.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return { enabled: false, disabledBecause: 'Windows' }
                              Severity: Major
                              Found in lib/utils.ts - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language