bugsnag/bugsnag-js

View on GitHub

Showing 191 of 352 total issues

Function modifyAppBuildGradle has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function modifyAppBuildGradle (projectRoot: string, logger: Logger): Promise<void> {
  logger.debug('Looking for android/app/build.gradle')
  const appBuildGradlePath = path.join(projectRoot, 'android', 'app', 'build.gradle')
  logger.debug('Applying com.bugsnag.android.gradle plugin')

Severity: Minor
Found in packages/react-native-cli/src/lib/Gradle.ts - About 1 hr to fix

    Function modifyRootBuildGradle has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export async function modifyRootBuildGradle (projectRoot: string, pluginVersion: string, logger: Logger): Promise<void> {
      logger.debug('Looking for android/build.gradle')
      const topLevelBuildGradlePath = path.join(projectRoot, 'android', 'build.gradle')
      logger.debug('Adding \'bugsnag-android-gradle-plugin\' to the build script classpath')
      try {
    Severity: Minor
    Found in packages/react-native-cli/src/lib/Gradle.ts - About 1 hr to fix

      Function runMaybeAsyncCallback has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const runMaybeAsyncCallback = (fn, cb) => {
          if (typeof fn !== 'function') return cb(null)
          try {
            // if function appears sync…
            if (fn.length !== 2) {
      Severity: Minor
      Found in packages/core/lib/callback-runner.js - About 1 hr to fix

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

            load (client) {
              if (!client._isBreadcrumbTypeEnabled(BREADCRUMB_STATE)) {
                return
              }
        
        
        Severity: Minor
        Found in packages/plugin-electron-screen-breadcrumbs/screen-breadcrumbs.js - About 1 hr to fix

          Function install has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export async function install (projectRoot: string, logger: Logger): Promise<void> {
            if (platform() !== 'darwin') {
              logger.warn('Detected platform is not macOS, skipping')
              return
            }
          Severity: Minor
          Found in packages/react-native-cli/src/lib/Pod.ts - About 1 hr to fix

            Method toWritableArray has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              static WritableArray toWritableArray(Collection<? extends Object> collection) {
                WritableArray writableArray = Arguments.createArray();
            
                if (collection == null) {
                  return writableArray;

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

            module.exports = (BugsnagIpcRenderer = window.__bugsnag_ipc__) => ({
              load: (client) => {
                client.addOnBreadcrumb(breadcrumb => {
                  try {
                    BugsnagIpcRenderer.leaveBreadcrumb(Object.assign({}, breadcrumb))

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

            module.exports = (callbacks, event, onCallbackError, cb) => {
              // This function is how we support different kinds of callback:
              //  - synchronous - return value
              //  - node-style async with callback - cb(err, value)
              //  - promise/thenable - resolve(value)
            Severity: Minor
            Found in packages/core/lib/callback-runner.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

            Method toWritableMap has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              @SuppressWarnings("unchecked")
              static WritableMap toWritableMap(Map<String, ? extends Object> javaMap) {
                WritableMap writableMap = Arguments.createMap();
            
                if (javaMap == null) {

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

            const formatComponentName = (vm, includeFile) => {
              if (vm.$root === vm) return '<Root>'
              const options = typeof vm === 'function' && vm.cid != null
                ? vm.options
                : vm._isVue
            Severity: Minor
            Found in packages/plugin-vue/src/vue2.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 mergeOptions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports.mergeOptions = (additionalSchemaKeys, mainOpts, rendererOpts) => {
              return Object.keys(module.exports.schema).concat(additionalSchemaKeys).reduce((accum, k) => {
                if (Object.prototype.hasOwnProperty.call(rendererOpts, k)) {
                  if (ALLOWED_IN_RENDERER.includes(k)) {
                    if (k === 'metadata') {
            Severity: Minor
            Found in packages/electron/src/config/renderer.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 10 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = (NativeClient) => ({
              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
            Severity: Minor
            Found in packages/plugin-react-native-client-sync/client-sync.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 10 (exceeds 5 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

            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 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              load: (client) => {
                const device = {
                  locale: nav.browserLanguage || nav.systemLanguage || nav.userLanguage || nav.language,
                  userAgent: nav.userAgent
                }
            Severity: Minor
            Found in packages/plugin-browser-device/device.js - About 1 hr to fix

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

                Function listener has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      const listener = evt => {
                        let error = evt.reason
                        let isBluebird = false
                
                        // accessing properties on evt.detail can throw errors (see #394)
                Severity: Minor
                Found in packages/plugin-window-unhandled-rejection/unhandled-rejection.js - About 1 hr to fix

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

                    load: (client) => {
                      const sessionTracker = new SessionTracker(client._config.sessionSummaryInterval)
                      sessionTracker.on('summary', sendSessionSummary(client))
                      sessionTracker.start()
                      client._sessionDelegate = {
                  Severity: Minor
                  Found in packages/plugin-server-session/session.js - About 1 hr to fix

                    Function sendMinidump has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const sendMinidump = async (minidumpPath, event) => {
                        const apiKey = (event && event.apiKey) || client._config.apiKey
                        const url = new URL(client._config.endpoints.minidumps)
                        url.pathname = `${url.pathname.replace(/\/$/, '')}/minidump`
                        url.searchParams.set('api_key', apiKey)
                    Severity: Minor
                    Found in packages/plugin-electron-deliver-minidumps/send-minidump.js - About 1 hr to fix

                      Function run has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export default async function run (projectRoot: string, urls: OnPremiseUrls): Promise<boolean> {
                        try {
                          const { apiKey } = await prompts({
                            type: 'text',
                            name: 'apiKey',
                      Severity: Minor
                      Found in packages/react-native-cli/src/commands/ConfigureCommand.ts - About 1 hr to fix

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

                        const _createClient = (opts, jsOpts) => {
                          if (jsOpts && typeof jsOpts === 'object') {
                            // mutate the options with anything supplied in JS. This will throw
                            Object.keys(jsOpts).forEach(k => { opts[k] = jsOpts[k] })
                          }
                        Severity: Minor
                        Found in packages/react-native/src/notifier.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language