bugsnag/bugsnag-js

View on GitHub

Showing 191 of 352 total issues

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

module.exports = (app, client) => {
  const prev = app.config.errorHandler

  const handler = (err, vm, info) => {
    const handledState = { severity: 'error', unhandled: true, severityReason: { type: 'unhandledException' } }
Severity: Minor
Found in packages/plugin-vue/src/vue.js - 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 _configure has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  _configure (opts, internalPlugins) {
    const schema = reduce(internalPlugins, (schema, plugin) => {
      if (plugin && plugin.configSchema) return assign({}, schema, plugin.configSchema)
      return schema
    }, this._schema)
Severity: Minor
Found in packages/core/client.js - 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 getSuggestedBugsnagGradleVersion has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export async function getSuggestedBugsnagGradleVersion (projectRoot: string, logger: Logger): Promise<string> {
  let fileContents: string
  try {
    fileContents = await fs.readFile(path.join(projectRoot, 'android', 'build.gradle'), 'utf8')
  } catch (e) {
Severity: Minor
Found in packages/react-native-cli/src/lib/Gradle.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 _configure has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _configure (opts, internalPlugins) {
    const schema = reduce(internalPlugins, (schema, plugin) => {
      if (plugin && plugin.configSchema) return assign({}, schema, plugin.configSchema)
      return schema
    }, this._schema)
Severity: Minor
Found in packages/core/client.js - About 1 hr to fix

    Function buildAndroid has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      buildAndroid: function buildAndroid (sourceFixturesIn, destFixturesIn) {
        try {
          const baseDir = process.env.PWD
          const sourceFixtures = `${baseDir}/${sourceFixturesIn}`
          const destFixtures = `${baseDir}/${destFixturesIn}`
    Severity: Minor
    Found in scripts/react-native-cli-helper.js - About 1 hr to fix

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

        load: (client) => {
          if (!isEnabledFor(client)) {
            return
          }
      
      
      Severity: Minor
      Found in packages/plugin-electron-deliver-minidumps/deliver-minidumps.js - About 1 hr to fix

        Function sendSessionSummary has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const sendSessionSummary = client => sessionCounts => {
          // exit early if the current releaseStage is not enabled
          if (client._config.enabledReleaseStages !== null && !client._config.enabledReleaseStages.includes(client._config.releaseStage)) {
            client._logger.warn('Session not sent due to releaseStage/enabledReleaseStages configuration')
            return
        Severity: Minor
        Found in packages/plugin-server-session/session.js - About 1 hr to fix

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

              load: (client) => {
                if (!client._config.autoDetectErrors || !client._config.enabledErrorTypes.unhandledRejections) return
                const listener = evt => {
                  let error = evt.reason
                  let isBluebird = false
          Severity: Minor
          Found in packages/plugin-window-unhandled-rejection/unhandled-rejection.js - About 1 hr to fix

            Function insertAndroid has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export async function insertAndroid (projectRoot: string, logger: Logger): Promise<void> {
              logger.info('Adding Bugsnag to the Android layer')
            
              let mainApplicationPath
              try {
            Severity: Minor
            Found in packages/react-native-cli/src/lib/Insert.ts - About 1 hr to fix

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

              module.exports = api => {
                // NB: This function can be called without an api argument, e.g. by bin/bundle
              
                const presets = []
                const plugins = []
              Severity: Minor
              Found in babel.config.js - About 1 hr to fix

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

                const createClient = (createProcessClient, process) => {
                  const Bugsnag = {
                    _client: null,
                    lastRunInfo: null,
                    start: (opts) => {
                Severity: Minor
                Found in packages/electron/src/client/createClient.js - About 1 hr to fix

                  Function exports has 37 lines of code (exceeds 25 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 1 hr to fix

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

                    module.exports = (NativeClient, process, electronApp, BrowserWindow, filestore, NativeApp = native) => ({
                      name: 'electronApp',
                      load (client) {
                        const app = {}
                        const lastRunInfo = filestore.getLastRunInfo()
                    Severity: Minor
                    Found in packages/plugin-electron-app/app.js - 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 exports has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports = (net, client) => {
                      const send = (opts, formData) => {
                        return new Promise((resolve, reject) => {
                          const req = net.request(opts, response => {
                            response.on('error', reject)
                    Severity: Minor
                    Found in packages/plugin-electron-deliver-minidumps/send-minidump.js - 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 load has a Cognitive Complexity of 12 (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-restify/src/restify.js - 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 deserialiseEvent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function deserialiseEvent (json, minidumpPath) {
                      if (!json || typeof json !== 'object') {
                        return
                      }
                    
                    
                    Severity: Minor
                    Found in packages/plugin-electron-deliver-minidumps/event-serialisation.js - 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 start has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      start: (opts) => {
                        if (Bugsnag._client) {
                          Bugsnag._client._logger.warn('Bugsnag.start() was called more than once. Ignoring.')
                          return Bugsnag._client
                        }
                    Severity: Minor
                    Found in packages/react-native/src/notifier.js - About 1 hr to fix

                      Function writeToPackageJson has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      async function writeToPackageJson (packageJsonPath: string, uploadUrl?: string, buildUrl?: string): Promise<void> {
                        try {
                          const data = await fs.readFile(packageJsonPath, 'utf8')
                          const packageJson = JSON.parse(data)
                      
                      

                        Function _redeliver has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          async _redeliver () {
                            try {
                              if (this._sending) {
                                return
                              }
                        Severity: Minor
                        Found in packages/delivery-electron/payload-loop.js - About 1 hr to fix

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

                            load: client => {
                              client.addOnError(async (event) => {
                                const {
                                  app,
                                  breadcrumbs,
                          Severity: Minor
                          Found in packages/plugin-electron-renderer-event-data/renderer-event-data.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language