bugsnag/bugsnag-js

View on GitHub

Showing 191 of 352 total issues

BugsnagReactNativeImpl has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

class BugsnagReactNativeImpl {

  static final String MODULE_NAME = "BugsnagReactNative";

  private static final String UPDATE_CONTEXT = "ContextUpdate";

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

    module.exports = (doc = document, win = window) => ({
      load: (client) => {
        if (!client._config.trackInlineScripts) return
    
        const originalLocation = win.location.href
    Severity: Minor
    Found in packages/plugin-inline-script-content/inline-script-content.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

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

    module.exports = (BugsnagIpcRenderer = window.__bugsnag_ipc__) => ({
      load: client => {
        client.addOnError(async (event) => {
          const {
            app,
    Severity: Minor
    Found in packages/plugin-electron-renderer-event-data/renderer-event-data.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

    File client.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const config = require('./config')
    const Event = require('./event')
    const Breadcrumb = require('./breadcrumb')
    const Session = require('./session')
    const map = require('./lib/es-utils/map')
    Severity: Minor
    Found in packages/core/client.js - About 2 hrs to fix

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

      export async function configure (projectRoot: string, options: Options, logger: Logger): Promise<void> {
        const iosDir = path.join(projectRoot, 'ios')
      
        let xcodeprojDir
      
      
      Severity: Minor
      Found in packages/react-native-cli/src/lib/InfoPlist.ts - 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

      Function wrapHandler has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function wrapHandler (client, flushTimeoutMs, lambdaTimeoutNotifyMs, handler) {
        let _handler = handler
      
        if (handler.length > 2) {
          // This is a handler expecting a 'callback' argument, so we convert
      Severity: Major
      Found in packages/plugin-aws-lambda/src/index.js - About 2 hrs to fix

        Function run has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        export default async function run (argv: string[]): Promise<void> {
          try {
            const opts = commandLineArgs(topLevelDefs, { argv, stopAtFirstUnknown: true })
        
            if (opts.version) {
        Severity: Minor
        Found in packages/react-native-cli/src/bin/cli.ts - 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

        Function normaliseError has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const normaliseError = (maybeError, tolerateNonErrors, component, logger) => {
          let error
          let internalFrames = 0
        
          const createAndLogInputError = (reason) => {
        Severity: Major
        Found in packages/core/event.js - About 2 hrs to fix

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

          export default async function run (argv: string[]): Promise<void> {
            try {
              const opts = commandLineArgs(topLevelDefs, { argv, stopAtFirstUnknown: true })
          
              if (opts.version) {
          Severity: Major
          Found in packages/react-native-cli/src/bin/cli.ts - About 2 hrs to fix

            Function exports has 55 lines of code (exceeds 25 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: Major
            Found in packages/plugin-window-unhandled-rejection/unhandled-rejection.js - About 2 hrs to fix

              BugsnagReactNative has 21 methods (exceeds 20 allowed). Consider refactoring.
              Open

              public class BugsnagReactNative extends ReactContextBaseJavaModule {
              
                private final BugsnagReactNativeImpl impl;
              
                public BugsnagReactNative(ReactApplicationContext reactContext) {

                NativeBugsnagImpl has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                public class NativeBugsnagImpl extends NativeBugsnagSpec {
                  private final BugsnagReactNativeImpl impl;
                
                  public NativeBugsnagImpl(ReactApplicationContext reactContext) {
                    super(reactContext);

                  Function exports has 51 lines of code (exceeds 25 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: Major
                  Found in packages/plugin-electron-deliver-minidumps/send-minidump.js - About 2 hrs to fix

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

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

                      Function _notify has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        _notify (event, onError, postReportCallback = noop) {
                          event.app = assign({}, event.app, {
                            releaseStage: this._config.releaseStage,
                            version: this._config.appVersion,
                            type: this._config.appType
                      Severity: Minor
                      Found in packages/core/client.js - About 2 hrs to fix

                        Function configure has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export async function configure (projectRoot: string, options: Options, logger: Logger): Promise<void> {
                          const iosDir = path.join(projectRoot, 'ios')
                        
                          let xcodeprojDir
                        
                        
                        Severity: Minor
                        Found in packages/react-native-cli/src/lib/InfoPlist.ts - About 1 hr to fix

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

                          export default async function run (projectRoot: string, urls: OnPremiseUrls): Promise<boolean> {
                            try {
                              const { bugsnagCliIntegration } = await prompts({
                                type: 'confirm',
                                name: 'bugsnagCliIntegration',

                            Function load has a Cognitive Complexity of 15 (exceeds 5 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

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

                              load: client => {
                                const requestHandler = async (ctx, next) => {
                                  // Get a client to be scoped to this request. If sessions are enabled, use the
                                  // resumeSession() call to get a session client, otherwise, clone the existing client.
                                  const requestClient = client._config.autoTrackSessions ? client.resumeSession() : clone(client)
                            Severity: Minor
                            Found in packages/plugin-koa/src/koa.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 47 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              load (client) {
                                // load the actual session delegate from plugin-browser-session
                                sessionDelegate.load(client)
                            
                                if (isNativeClientEnabled(client)) {
                            Severity: Minor
                            Found in packages/plugin-electron-session/session.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language