bugsnag/bugsnag-js

View on GitHub

Showing 191 of 352 total issues

Function constructor has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor (configuration, schema = config.schema, internalPlugins = [], notifier) {
    // notifier id
    this._notifier = notifier

    // intialise opts and config
Severity: Minor
Found in packages/core/client.js - About 1 hr to fix

    Function visit has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const visit = (obj) => {
        if (obj === null || obj === undefined) return obj
    
        if (isSafeLiteral(obj)) {
          return obj
    Severity: Minor
    Found in packages/core/lib/derecursify.js - About 1 hr to fix

      Function send has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const send = (opts, body, cb) => {
          let errorCallback = (error, response) => {
            // an error can still happen on both the request and response even after a response is received,
            // so we noop on subsequent calls to ensure this is only handled once
            errorCallback = noop
      Severity: Minor
      Found in packages/delivery-electron/delivery.js - About 1 hr to fix

        Function addBuildEndpoint has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export async function addBuildEndpoint (projectRoot: string, buildEndpoint: string, logger: Logger): Promise<void> {
          try {
            const appBuildGradlePath = path.join(projectRoot, 'android', 'app', 'build.gradle')
        
            await insertBugsnagConfigBlock(appBuildGradlePath, logger)
        Severity: Minor
        Found in packages/react-native-cli/src/lib/Gradle.ts - About 1 hr to fix

          Function addUploadEndpoint has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export async function addUploadEndpoint (projectRoot: string, uploadEndpoint: string, logger: Logger): Promise<void> {
            try {
              const appBuildGradlePath = path.join(projectRoot, 'android', 'app', 'build.gradle')
          
              await insertBugsnagConfigBlock(appBuildGradlePath, logger)
          Severity: Minor
          Found in packages/react-native-cli/src/lib/Gradle.ts - About 1 hr to fix

            Function _dispatch has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              _dispatch (event) {
                const originalSeverity = event.severity
            
                const callbacks = this.client._cbs.e.filter(e => !e._internal)
                runCallbacks(callbacks, event, this._onCallbackError, (err, shouldSend) => {
            Severity: Minor
            Found in packages/plugin-electron-ipc/bugsnag-ipc-main.js - About 1 hr to fix

              Function createNavigationContainer has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  const createNavigationContainer = (NavigationContainer) => React.forwardRef((props, ref) => {
                    const { onReady, onStateChange, ...forwardProps } = props
                    const navigationRef = ref || React.useRef(null)
                    const routeNameRef = React.useRef(undefined)
              
              
              Severity: Minor
              Found in packages/plugin-react-navigation/react-navigation.js - About 1 hr to fix

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

                module.exports = (nav = navigator, win = window) => ({
                  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

                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 create has a Cognitive Complexity of 11 (exceeds 5 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

                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 11 (exceeds 5 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

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

                function getNodeSelector (el, win) {
                  const parts = [el.tagName]
                  if (el.id) parts.push('#' + el.id)
                  if (el.className && el.className.length) parts.push(`.${el.className.split(' ').join('.')}`)
                  // Can't get much more advanced with the current browser
                Severity: Minor
                Found in packages/plugin-interaction-breadcrumbs/interaction-breadcrumbs.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 makeBrowserWindow has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                export function makeBrowserWindow ({ windows = [], focusedWindow = null } = {}): BrowserWindowStatic {
                  const FakeBrowserWindow: BrowserWindowStatic = class implements BrowserWindow {
                    public index: number
                
                    public readonly title: string
                Severity: Minor
                Found in packages/electron-test-helpers/src/BrowserWindow.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 exports has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = req => {
                  const connection = req.connection
                  const address = connection && connection.address && connection.address()
                  const portNumber = address && address.port
                  const port = (!portNumber || portNumber === 80 || portNumber === 443) ? '' : `:${portNumber}`
                Severity: Minor
                Found in packages/plugin-express/src/request-info.js - About 1 hr to fix

                  Function exports has 31 lines of code (exceeds 25 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

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

                      load: (client) => {
                        if (!client._config.autoDetectErrors) return
                        if (!client._config.enabledErrorTypes.unhandledExceptions) return
                        function onerror (messageOrEvent, url, lineNo, charNo, error) {
                          // Ignore errors with no info due to CORS settings
                    Severity: Minor
                    Found in packages/plugin-window-onerror/onerror.js - About 1 hr to fix

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

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

                        module.exports = req => {
                          const connection = req.connection
                          const address = connection && connection.address && connection.address()
                          const portNumber = address && address.port
                          const path = req.getPath() || req.url
                        Severity: Minor
                        Found in packages/plugin-restify/src/request-info.js - About 1 hr to fix

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

                              net.request = (...args) => {
                                const request = originalRequest.apply(net, args)
                          
                                // grab the final URL from the internal "_urlLoaderOptions" - there is some
                                // processing of the raw URL that we don't want to have to replicate here
                          Severity: Minor
                          Found in packages/plugin-electron-net-breadcrumbs/net-breadcrumbs.js - About 1 hr to fix

                            Function load has 29 lines of code (exceeds 25 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

                              Function getSuggestedBugsnagGradleVersion has 29 lines of code (exceeds 25 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
                                Severity
                                Category
                                Status
                                Source
                                Language