bugsnag/bugsnag-js

View on GitHub
packages/plugin-network-breadcrumbs/network-breadcrumbs.js

Summary

Maintainability
D
2 days
Test Coverage

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

module.exports = (_ignoredUrls = [], win = window) => {
  let restoreFunctions = []
  const plugin = {
    load: client => {
      if (!client._isBreadcrumbTypeEnabled('request')) return
Severity: Minor
Found in packages/plugin-network-breadcrumbs/network-breadcrumbs.js - About 1 day 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 127 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = (_ignoredUrls = [], win = window) => {
  let restoreFunctions = []
  const plugin = {
    load: client => {
      if (!client._isBreadcrumbTypeEnabled('request')) return
Severity: Major
Found in packages/plugin-network-breadcrumbs/network-breadcrumbs.js - About 5 hrs to fix

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

        load: client => {
          if (!client._isBreadcrumbTypeEnabled('request')) return
    
          const ignoredUrls = [
            client._config.endpoints.notify,
    Severity: Major
    Found in packages/plugin-network-breadcrumbs/network-breadcrumbs.js - About 4 hrs to fix

      Function monkeyPatchFetch has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Wontfix

            function monkeyPatchFetch () {
              // only patch it if it exists and if it is not a polyfill (patching a polyfilled
              // fetch() results in duplicate breadcrumbs for the same request because the
              // implementation uses XMLHttpRequest which is also patched)
              if (!('fetch' in win) || win.fetch.polyfill) return
      Severity: Minor
      Found in packages/plugin-network-breadcrumbs/network-breadcrumbs.js - About 1 hr to fix

        Function fetch has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Wontfix

                win.fetch = function fetch () {
                  const urlOrRequest = arguments[0]
                  const options = arguments[1]
        
                  let method
        Severity: Minor
        Found in packages/plugin-network-breadcrumbs/network-breadcrumbs.js - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status