bugsnag/bugsnag-js

View on GitHub

Showing 191 of 352 total issues

Function exports has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = (_ignoredUrls = [], win = window) => {
  let restoreFunctions = []
  const plugin = {
    load: client => {
      if (!client._isBreadcrumbTypeEnabled('request')) return
Severity: Minor
Found in packages/plugin-network-breadcrumbs/network-breadcrumbs.js - About 1 day 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

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

import { getSuggestedBugsnagGradleVersion, modifyAppBuildGradle, modifyRootBuildGradle, checkReactNativeMappings, addUploadEndpoint, addBuildEndpoint } from '../Gradle'
import logger from '../../Logger'
import path from 'path'
import { promises as fs } from 'fs'

Severity: Minor
Found in packages/react-native-cli/src/lib/__test__/Gradle.test.ts - About 6 hrs to fix

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

    module.exports = (_ignoredUrls = [], win = window) => {
      let restoreFunctions = []
      const plugin = {
        load: client => {
          if (!client._isBreadcrumbTypeEnabled('request')) return
    Severity: Major
    Found in packages/plugin-network-breadcrumbs/network-breadcrumbs.js - About 5 hrs to fix

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

        load (client) {
          const leaveBreadcrumb = (event, currentRouteName, previousRouteName) => {
            if (!client._isBreadcrumbTypeEnabled('navigation')) return
      
            client.leaveBreadcrumb(
      Severity: Minor
      Found in packages/plugin-react-navigation/react-navigation.js - About 4 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 load has 116 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        load: (client) => {
          if (!client._config.trackInlineScripts) return
      
          const originalLocation = win.location.href
          let html = ''
      Severity: Major
      Found in packages/plugin-inline-script-content/inline-script-content.js - About 4 hrs to fix

        Function delivery has 115 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const delivery = (client, filestore, net, app) => {
          const noop = () => {}
        
          const send = (opts, body, cb) => {
            let errorCallback = (error, response) => {
        Severity: Major
        Found in packages/delivery-electron/delivery.js - About 4 hrs to fix

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

              load: client => {
                if (!client._isBreadcrumbTypeEnabled('request')) return
          
                const ignoredUrls = [
                  client._config.endpoints.notify,
          Severity: Major
          Found in packages/plugin-network-breadcrumbs/network-breadcrumbs.js - About 4 hrs to fix

            Function delivery has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
            Open

            const delivery = (client, filestore, net, app) => {
              const noop = () => {}
            
              const send = (opts, body, cb) => {
                let errorCallback = (error, response) => {
            Severity: Minor
            Found in packages/delivery-electron/delivery.js - About 4 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 normaliseError has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

            const normaliseError = (maybeError, tolerateNonErrors, component, logger) => {
              let error
              let internalFrames = 0
            
              const createAndLogInputError = (reason) => {
            Severity: Minor
            Found in packages/core/event.js - About 4 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 exports has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = (client, win = window) => ({
              sendEvent: (event, cb = () => {}) => {
                try {
                  const url = client._config.endpoints.notify
                  const req = new win.XMLHttpRequest()
            Severity: Minor
            Found in packages/delivery-xml-http-request/delivery.js - 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 exports has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = (win = window, component = 'window onerror') => ({
              load: (client) => {
                if (!client._config.autoDetectErrors) return
                if (!client._config.enabledErrorTypes.unhandledExceptions) return
                function onerror (messageOrEvent, url, lineNo, charNo, error) {
            Severity: Minor
            Found in packages/plugin-window-onerror/onerror.js - 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 load has 94 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              load: (client) => {
                client.addOnBreadcrumb(breadcrumb => {
                  // we copy the breadcrumb's properties over to a new object to ensure its
                  // to JSON() method doesn't get called before passing the object over the
                  // bridge. This happens in the remote debugger and means the "message"
            Severity: Major
            Found in packages/plugin-react-native-client-sync/client-sync.js - About 3 hrs to fix

              Client has 30 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Client {
                constructor (configuration, schema = config.schema, internalPlugins = [], notifier) {
                  // notifier id
                  this._notifier = notifier
              
              
              Severity: Minor
              Found in packages/core/client.js - About 3 hrs to fix

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

                  load (client) {
                    const app = {}
                    const lastRunInfo = filestore.getLastRunInfo()
                    const updateApp = createAppUpdater(client, NativeClient, app)
                    const updateNextCrashLastRunInfo = createLastRunInfoUpdater(client, NativeClient)
                Severity: Major
                Found in packages/plugin-electron-app/app.js - About 3 hrs to fix

                  Function exports has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                  module.exports = (win = window) => {
                    const plugin = {
                      load: (client) => {
                        if (!client._config.autoDetectErrors || !client._config.enabledErrorTypes.unhandledRejections) return
                        const listener = evt => {
                  Severity: Minor
                  Found in packages/plugin-window-unhandled-rejection/unhandled-rejection.js - 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 load has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    load (client) {
                      const device = {}
                      let cachedDevice = {}
                  
                      try {
                  Severity: Major
                  Found in packages/plugin-electron-device/device.js - About 3 hrs to fix

                    Function updateBuildReactNativeTask has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                    async function updateBuildReactNativeTask (buildPhaseMap: Record<string, Record<string, unknown>>, iosDir: string, reactNativeVersion: string | undefined, logger: Logger): Promise<boolean> {
                      let didAnythingUpdate = false
                      let didThisUpdate
                    
                      for (const shellBuildPhaseKey in buildPhaseMap) {
                    Severity: Minor
                    Found in packages/react-native-cli/src/lib/Xcode.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 load has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      load: (client) => {
                        const emitter = new EventEmitter()
                    
                        // proxy all state updates from within the main process
                        // so that we can emit events for the changes
                    Severity: Major
                    Found in packages/plugin-electron-client-state-manager/client-state-manager.js - About 3 hrs to fix

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

                      import { insertJs, insertAndroid, insertIos } from '../Insert'
                      import logger from '../../Logger'
                      import path from 'path'
                      import { promises as fs } from 'fs'
                      import glob from 'glob'
                      Severity: Minor
                      Found in packages/react-native-cli/src/lib/__test__/Insert.test.ts - About 3 hrs to fix

                        Function exports has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                        Open

                        module.exports = function (data) {
                          const seen = []
                        
                          const visit = (obj) => {
                            if (obj === null || obj === undefined) return obj
                        Severity: Minor
                        Found in packages/core/lib/derecursify.js - About 2 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