bugsnag/bugsnag-js

View on GitHub

Showing 343 of 352 total issues

Avoid too many return statements within this function.
Open

        if (!await configure(projectRoot, urls)) return
Severity: Major
Found in packages/react-native-cli/src/bin/cli.ts - About 30 mins to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      removeOnError (fn) {
        this._cbs.e = filter(this._cbs.e, f => f !== fn)
      }
    Severity: Minor
    Found in packages/core/client.js and 2 other locations - About 30 mins to fix
    packages/core/client.js on lines 235..237
    packages/core/client.js on lines 243..245

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Avoid too many return statements within this function.
    Open

          return
    Severity: Major
    Found in packages/react-native-cli/src/lib/Insert.ts - About 30 mins to fix

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        removeOnSession (fn) {
          this._cbs.s = filter(this._cbs.s, f => f !== fn)
        }
      Severity: Minor
      Found in packages/core/client.js and 2 other locations - About 30 mins to fix
      packages/core/client.js on lines 223..225
      packages/core/client.js on lines 243..245

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 45.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Avoid too many return statements within this function.
      Open

        return parts.join('')
      Severity: Major
      Found in packages/plugin-interaction-breadcrumbs/interaction-breadcrumbs.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          if (el.parentNode) return `${getNodeSelector(el.parentNode, win)} > ${parts.join('')}`
        Severity: Major
        Found in packages/plugin-interaction-breadcrumbs/interaction-breadcrumbs.js - About 30 mins to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                runtimeVersions: {
                  node: process.versions.node,
                  chrome: process.versions.chrome,
                  electron: process.versions.electron
                }
          Severity: Minor
          Found in packages/plugin-electron-device/device.js and 1 other location - About 30 mins to fix
          packages/plugin-server-session/session.js on lines 82..86

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

            on (event: ScreenEvent, callback: Function): void {
              this.callbacks[event].push(callback)
            }
          Severity: Minor
          Found in packages/electron-test-helpers/src/Screen.ts and 2 other locations - About 30 mins to fix
          packages/electron-test-helpers/src/App.ts on lines 62..64
          packages/electron-test-helpers/src/PowerMonitor.ts on lines 41..43

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

            on (event: PowerMonitorEvent, callback: Function): void {
              this.callbacks[event].push(callback)
            }
          Severity: Minor
          Found in packages/electron-test-helpers/src/PowerMonitor.ts and 2 other locations - About 30 mins to fix
          packages/electron-test-helpers/src/App.ts on lines 62..64
          packages/electron-test-helpers/src/Screen.ts on lines 27..29

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

            on (event: AppEvent, callback: Function): void {
              this.callbacks[event].push(callback)
            }
          Severity: Minor
          Found in packages/electron-test-helpers/src/App.ts and 2 other locations - About 30 mins to fix
          packages/electron-test-helpers/src/PowerMonitor.ts on lines 41..43
          packages/electron-test-helpers/src/Screen.ts on lines 27..29

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function _deliverMinidump has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            async _deliverMinidump (minidump) {
              let shouldSendMinidump = true
              let eventJson = await this._readEvent(minidump.eventPath)
          
              if (eventJson && this._onSendError.length > 0) {
          Severity: Minor
          Found in packages/plugin-electron-deliver-minidumps/minidump-loop.js - About 25 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 exports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = app => ({
            load (client) {
              if (!client._config.autoDetectErrors) return
              if (!client._config.enabledErrorTypes.unhandledExceptions) return
          
          
          Severity: Minor
          Found in packages/plugin-electron-preload-error/preload-error.js - About 25 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 peek has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            async peek () {
              try {
                const payloads = await this._getPayloads()
                // loop from first to last until we find a valid payload
                for (const filepath of payloads) {
          Severity: Minor
          Found in packages/delivery-electron/queue.js - About 25 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 exports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = (app, screen, process, filestore, NativeClient, powerMonitor) => ({
            load (client) {
              const device = {}
              let cachedDevice = {}
          
          
          Severity: Minor
          Found in packages/plugin-electron-device/device.js - About 25 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 exports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = (ErrorUtils = global.ErrorUtils) => ({
            load: (client) => {
              if (!client._config.autoDetectErrors) return
              if (!client._config.enabledErrorTypes.unhandledExceptions) return
              if (!ErrorUtils) {
          Severity: Minor
          Found in packages/plugin-react-native-global-error-handler/error-handler.js - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
          Open

            constructor (...args) {
              // Fetch Vue from the window object, if it exists
              const globalVue = typeof window !== 'undefined' && window.Vue
          
              this.name = 'vue'
          Severity: Minor
          Found in packages/plugin-vue/src/index.js - About 25 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 hasValueForProperty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function hasValueForProperty (object, name) {
            if (!Object.prototype.hasOwnProperty.call(object, name)) {
              return false
            }
          
          
          Severity: Minor
          Found in packages/plugin-electron-deliver-minidumps/event-serialisation.js - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
          Open

            constructor (...args) {
              // Fetch React from the window object, if it exists
              const globalReact = typeof window !== 'undefined' && window.React
          
              this.name = 'react'
          Severity: Minor
          Found in packages/plugin-react/src/index.js - About 25 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 load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            load (client) {
              if (this.Vue && this.Vue.config) {
                installVue2(this.Vue, client)
                return {
                  installVueErrorHandler: () => client._logger.warn('installVueErrorHandler() was called unnecessarily')
          Severity: Minor
          Found in packages/plugin-vue/src/index.js - About 25 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 formatComponentStack has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          const formatComponentStack = str => {
            const lines = str.split(/\n/g)
            let ret = ''
            for (let line = 0, len = lines.length; line < len; line++) {
              if (lines[line].length) ret += `${ret.length ? '\n' : ''}${lines[line].trim()}`
          Severity: Minor
          Found in packages/plugin-react/src/index.js - About 25 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