bugsnag/bugsnag-js

View on GitHub

Showing 191 of 352 total issues

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

module.exports = (app, net, filestore, NativeClient) => ({
  name: 'deliverMinidumps',
  load: (client) => {
    if (!isEnabledFor(client)) {
      return
Severity: Minor
Found in packages/plugin-electron-deliver-minidumps/deliver-minidumps.js - 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

Function leaveBreadcrumb has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  leaveBreadcrumb (message, metadata, type) {
    // coerce bad values so that the defaults get set
    message = typeof message === 'string' ? message : ''
    type = (typeof type === 'string' && includes(BREADCRUMB_TYPES, type)) ? type : 'manual'
    metadata = typeof metadata === 'object' && metadata !== null ? metadata : {}
Severity: Minor
Found in packages/core/client.js - 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

Function buildIOS has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  buildIOS: function buildIOS () {
    try {
      const version = process.env.NOTIFIER_VERSION || common.determineVersion()
      const rnVersion = process.env.REACT_NATIVE_VERSION
      const registryUrl = process.env.REGISTRY_URL
Severity: Minor
Found in scripts/react-native-helper.js - 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

Function configure has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export async function configure (projectRoot: string, options: Options, logger: Logger): Promise<void> {
  const manifestPath = path.join(projectRoot, 'android', 'app', 'src', 'main', 'AndroidManifest.xml')

  try {
    const manifest = await fs.readFile(manifestPath, 'utf8')
Severity: Minor
Found in packages/react-native-cli/src/lib/AndroidManifest.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

Function insertIos has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export async function insertIos (projectRoot: string, logger: Logger): Promise<void> {
  logger.info('Adding Bugsnag to the iOS layer')

  const iosDir = path.join(projectRoot, 'ios')
  let appDelegatePath
Severity: Minor
Found in packages/react-native-cli/src/lib/Insert.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

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

module.exports = (win = window) => ({
  load: (client) => {
    if (!('addEventListener' in win)) return
    if (!client._isBreadcrumbTypeEnabled('user')) return

Severity: Minor
Found in packages/plugin-interaction-breadcrumbs/interaction-breadcrumbs.js - 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 safeArray
Severity: Major
Found in packages/core/lib/derecursify.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      return true
    Severity: Major
    Found in packages/plugin-electron-deliver-minidumps/event-serialisation.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return throwsMessage(err)
      Severity: Major
      Found in packages/core/lib/derecursify.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return safeObj
        Severity: Major
        Found in packages/core/lib/derecursify.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return '[Circular]'
          Severity: Major
          Found in packages/core/lib/derecursify.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

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

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

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

                  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

                    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

                      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

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language