bugsnag/bugsnag-js

View on GitHub

Showing 343 of 352 total issues

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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    const isRetryable = status => {
      return (
        status < 400 ||
        status > 499 ||
        [
    Severity: Minor
    Found in packages/delivery-electron/delivery.js and 1 other location - About 45 mins to fix
    packages/plugin-electron-deliver-minidumps/send-minidump.js on lines 75..84

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    const isRetryable = status => {
      return (
        status < 400 ||
        status > 499 ||
        [
    Severity: Minor
    Found in packages/plugin-electron-deliver-minidumps/send-minidump.js and 1 other location - About 45 mins to fix
    packages/delivery-electron/delivery.js on lines 187..195

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            client.clearMetadata = function (section, key) {
              const ret = origClearMetadata.apply(this, arguments)
              NativeClient.clearMetadata(section, key)
              return ret
            }
        Severity: Minor
        Found in packages/plugin-react-native-client-sync/client-sync.js and 1 other location - About 40 mins to fix
        packages/plugin-react-native-client-sync/client-sync.js on lines 54..58

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 49.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            client.addFeatureFlag = function (name, variant) {
              const ret = origAddFeatureFlag.apply(this, arguments)
              NativeClient.addFeatureFlag(name, variant)
              return ret
            }
        Severity: Minor
        Found in packages/plugin-react-native-client-sync/client-sync.js and 1 other location - About 40 mins to fix
        packages/plugin-react-native-client-sync/client-sync.js on lines 40..44

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 49.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                resumeSession: (client) => {
                  const result = defaultDelegate.resumeSession(client)
                  NativeClient.setSession(serializeForNativeEvent(client._session))
                  return result
                },
        Severity: Minor
        Found in packages/plugin-electron-session/session.js and 1 other location - About 40 mins to fix
        packages/plugin-electron-session/session.js on lines 35..39

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 48.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                pauseSession: (client) => {
                  const result = defaultDelegate.pauseSession(client)
                  NativeClient.setSession(serializeForNativeEvent(client._session))
                  return result
                }
        Severity: Minor
        Found in packages/plugin-electron-session/session.js and 1 other location - About 40 mins to fix
        packages/plugin-electron-session/session.js on lines 30..34

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 48.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                client._notify(event, onError, (e, event) => {
                  if (e) client._logger.error('Failed to send event to Bugsnag')
                  client._config.onUncaughtException(err, event, client._logger)
                })
        Severity: Minor
        Found in packages/plugin-contextualize/contextualize.js and 1 other location - About 40 mins to fix
        packages/plugin-node-uncaught-exception/uncaught-exception.js on lines 12..15

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 48.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

              client._notify(event, () => {}, (e, event) => {
                if (e) client._logger.error('Failed to send event to Bugsnag')
                client._config.onUncaughtException(err, event, client._logger)
              })
        Severity: Minor
        Found in packages/plugin-node-uncaught-exception/uncaught-exception.js and 1 other location - About 40 mins to fix
        packages/plugin-contextualize/contextualize.js on lines 21..24

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 48.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        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
            Severity
            Category
            Status
            Source
            Language