bugsnag/bugsnag-js

View on GitHub

Showing 191 of 352 total issues

Function install has a Cognitive Complexity of 9 (exceeds 5 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 55 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 insertAndroid has a Cognitive Complexity of 9 (exceeds 5 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 55 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 getPrefixedConsole has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const getPrefixedConsole = () => {
  return ['debug', 'info', 'warn', 'error'].reduce((accum, method) => {
    // keep references to initial console methods, since the
    // console breadcrumb plugin wraps them later
    const { debug, info, warn, error } = console
Severity: Minor
Found in packages/react-native/src/config.js - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = (arr, fn, cb) => {
  let index = 0

  const next = () => {
    if (index >= arr.length) return cb(null, true)
Severity: Minor
Found in packages/core/lib/async-every.js - About 45 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 _listMinidumpFiles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  async _listMinidumpFiles () {
    const dirs = [this._paths.minidumps]
    const minidumpFiles = []
    while (dirs.length) {
      const dir = dirs.pop()
Severity: Minor
Found in packages/electron-filestore/filestore.js - About 45 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 create has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

Event.create = function (maybeError, tolerateNonErrors, handledState, component, errorFramesToSkip = 0, logger) {
Severity: Minor
Found in packages/core/event.js - About 45 mins to fix

    Function createClient has a Cognitive Complexity of 8 (exceeds 5 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 45 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 add has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const add = (state, section, keyOrObj, maybeVal) => {
      if (!section) return
      let updates
    
      // addMetadata("section", null) -> clears section
    Severity: Minor
    Found in packages/core/lib/metadata-delegate.js - About 45 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 buildAndroid has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      buildAndroid: function buildAndroid (sourceFixtures, destFixtures) {
        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 45 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 createClass has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const createClass = (React, client) => class ErrorBoundary extends React.Component {
      constructor (props) {
        super(props)
        this.state = {
          error: null,
    Severity: Minor
    Found in packages/plugin-react/src/index.js - About 45 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 deeply nested control flow statements.
    Open

              if (didThisUpdate) {
                didAnythingUpdate = true
              }
    Severity: Major
    Found in packages/react-native-cli/src/lib/Xcode.ts - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                if (didThisUpdate) {
                  didAnythingUpdate = true
                }
      Severity: Major
      Found in packages/react-native-cli/src/lib/Xcode.ts - About 45 mins to fix

        Function makeClientForPlugin has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export function makeClientForPlugin ({
          config = {},
          schema = {},
          plugins = []
        }: { config?: object, schema?: object, plugins?: Plugin[] } = {}): ClientTestHelpers {
        Severity: Minor
        Found in packages/electron-test-helpers/src/client.ts - About 45 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 onerror has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            function onerror (messageOrEvent, url, lineNo, charNo, error) {
        Severity: Minor
        Found in packages/plugin-window-onerror/onerror.js - About 35 mins to fix

          Function insertValueAfterPattern has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          async function insertValueAfterPattern (file: string, patterns: RegExp[], value: string, presencePattern: RegExp, logger: Logger): Promise<void> {
          Severity: Minor
          Found in packages/react-native-cli/src/lib/Gradle.ts - About 35 mins to fix

            Function install has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            export async function install (packageManager: PackageManager, module: string, version: string, dev: boolean, projectRoot: string): Promise<void> {
            Severity: Minor
            Found in packages/react-native-cli/src/lib/Npm.ts - About 35 mins to fix

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

              const decorateStack = (stack, url, lineNo, charNo) => {
                if (!stack[0]) stack.push({})
                const culprit = stack[0]
                if (!culprit.file && typeof url === 'string') culprit.file = url
                if (!culprit.lineNumber && isActualNumber(lineNo)) culprit.lineNumber = lineNo
              Severity: Minor
              Found in packages/plugin-window-onerror/onerror.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 wrapHistoryFn has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              const wrapHistoryFn = (client, target, fn, win) => {
                const orig = target[fn]
                target[fn] = (state, title, url) => {
                  client.leaveBreadcrumb(`History ${fn}`, stateChangeToMetadata(win, state, title, url), 'navigation')
                  // if throttle plugin is in use, reset the event sent count
              Severity: Minor
              Found in packages/plugin-navigation-breadcrumbs/navigation-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

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

                load: client => {
                  if (!client._isBreadcrumbTypeEnabled('state')) return
              
                  let lastOrientation
              
              
              Severity: Minor
              Found in packages/plugin-react-native-orientation-breadcrumbs/orientation.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 exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              module.exports = obj => {
                // stripped down version of
                // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/Keys
                const result = []
                let prop
              Severity: Minor
              Found in packages/core/lib/es-utils/keys.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

              Severity
              Category
              Status
              Source
              Language