bugsnag/bugsnag-js

View on GitHub

Showing 343 of 352 total issues

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

  load: client => {
    if (!client._config.sendCode) return

    const loadSurroundingCode = (stackframe, cache) => new Promise((resolve, reject) => {
      try {
Severity: Minor
Found in packages/plugin-node-surrounding-code/surrounding-code.js - About 1 hr to fix

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

      createClient: (opts) => {
        // handle very simple use case where user supplies just the api key as a string
        if (typeof opts === 'string') opts = { apiKey: opts }
        if (!opts) opts = {}
    
    
    Severity: Minor
    Found in packages/browser/src/notifier.js - About 1 hr to fix

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

      Event.create = function (maybeError, tolerateNonErrors, handledState, component, errorFramesToSkip = 0, logger) {
        const [error, internalFrames] = normaliseError(maybeError, tolerateNonErrors, component, logger)
        let event
        try {
          const stacktrace = Event.getStacktrace(
      Severity: Minor
      Found in packages/core/event.js - About 1 hr to fix

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

        module.exports = ctx => {
          if (!ctx) return {}
          const request = ctx.req
          const connection = request.connection
          const address = connection && connection.address && connection.address()
        Severity: Minor
        Found in packages/plugin-koa/src/request-info.js - About 1 hr to fix

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

                if (body.length > 10e5) {
                  client._logger.warn(`Event oversized (${(body.length / 10e5).toFixed(2)} MB)`)
                }
          Severity: Major
          Found in packages/delivery-node/delivery.js and 2 other locations - About 1 hr to fix
          packages/delivery-x-domain-request/delivery.js on lines 15..17
          packages/delivery-xml-http-request/delivery.js on lines 16..18

          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 55.

          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

                      if (body.length > 10e5) {
                        client._logger.warn(`Event oversized (${(body.length / 10e5).toFixed(2)} MB)`)
                      }
          Severity: Major
          Found in packages/delivery-xml-http-request/delivery.js and 2 other locations - About 1 hr to fix
          packages/delivery-node/delivery.js on lines 10..12
          packages/delivery-x-domain-request/delivery.js on lines 15..17

          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 55.

          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

                if (body.length > 10e5) {
                  client._logger.warn(`Event oversized (${(body.length / 10e5).toFixed(2)} MB)`)
                }
          Severity: Major
          Found in packages/delivery-x-domain-request/delivery.js and 2 other locations - About 1 hr to fix
          packages/delivery-node/delivery.js on lines 10..12
          packages/delivery-xml-http-request/delivery.js on lines 16..18

          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 55.

          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

              client.addFeatureFlags = (...args) => {
                const ret = origAddFeatureFlags.apply(client, args)
                emitter.emit('FeatureFlagUpdate', client._features)
                return ret
              }
          packages/plugin-electron-client-state-manager/client-state-manager.js on lines 48..52
          packages/plugin-electron-client-state-manager/client-state-manager.js on lines 62..66

          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 54.

          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

              client.addFeatureFlag = (...args) => {
                const ret = origAddFeatureFlag.apply(client, args)
                emitter.emit('FeatureFlagUpdate', client._features)
                return ret
              }
          packages/plugin-electron-client-state-manager/client-state-manager.js on lines 55..59
          packages/plugin-electron-client-state-manager/client-state-manager.js on lines 62..66

          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 54.

          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

              client.clearFeatureFlag = (...args) => {
                const ret = origClearFeatureFlag.apply(client, args)
                emitter.emit('FeatureFlagUpdate', client._features)
                return ret
              }
          packages/plugin-electron-client-state-manager/client-state-manager.js on lines 48..52
          packages/plugin-electron-client-state-manager/client-state-manager.js on lines 55..59

          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 54.

          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 exports has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = () => ({
            load: (client) => {
              client.addOnError(event => {
                if (event.errors && event.errors.length) {
                  event.errors[0].stacktrace.forEach(sf => {
          Severity: Minor
          Found in packages/plugin-react-native-hermes/hermes.js - 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 exports has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = net => ({
            load (client) {
              if (!client._isBreadcrumbTypeEnabled(BREADCRUMB_REQUEST)) {
                return
              }
          Severity: Minor
          Found in packages/plugin-electron-net-breadcrumbs/net-breadcrumbs.js - 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 exports has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = (win = window) => {
            const plugin = {
              load: (client) => {
                if (!('addEventListener' in win)) return
                if (!client._isBreadcrumbTypeEnabled('navigation')) return
          Severity: Minor
          Found in packages/plugin-navigation-breadcrumbs/navigation-breadcrumbs.js - 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 exports has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = (client, NativeClient) => ({
            sendEvent: (payload, cb = () => {}) => {
              const event = payload.events[0]
              let nativeStack
              if (event.originalError) {
          Severity: Minor
          Found in packages/delivery-react-native/delivery.js - 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 serialiseEvent has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          function serialiseEvent (event) {
            const json = event.toJSON()
            const serialisedEvent = {}
          
            for (let i = 0; i < supportedProperties.length; ++i) {
          Severity: Minor
          Found in packages/plugin-electron-deliver-minidumps/event-serialisation.js - 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 load has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            load: (client) => {
              // Do not attach any listeners if autoDetectErrors is disabled or unhandledRejections are not an enabled error type
              if (!client._config.autoDetectErrors || !client._config.enabledErrorTypes.unhandledRejections) return () => { }
          
              // Check if Hermes is available and is being used for promises
          Severity: Minor
          Found in packages/plugin-react-native-unhandled-rejection/rejection-handler.js - 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 rnInternalOnUnhandled has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          const rnInternalOnUnhandled = (id, rejection) => {
            let message
            let stack
          
            const stringValue = Object.prototype.toString.call(rejection)
          Severity: Minor
          Found in packages/plugin-react-native-unhandled-rejection/rejection-handler.js - 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 initializeFlipper has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            private static void initializeFlipper(
                Context context, ReactInstanceManager reactInstanceManager) {
              if (BuildConfig.DEBUG) {
                try {
                  /*

          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 initializeFlipper has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            private static void initializeFlipper(
                Context context, ReactInstanceManager reactInstanceManager) {
              if (BuildConfig.DEBUG) {
                try {
                  /*

          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 9 (exceeds 5 allowed). Consider refactoring.
          Open

            load: client => {
              const requestHandler = (req, res, next) => {
                const dom = domain.create()
          
                // Get a client to be scoped to this request. If sessions are enabled, use the
          Severity: Minor
          Found in packages/plugin-express/src/express.js - 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

          Severity
          Category
          Status
          Source
          Language