teamdigitale/italia-app

View on GitHub
ts/utils/whatwg-fetch.js

Summary

Maintainability
D
2 days
Test Coverage

File whatwg-fetch.js has 454 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// this file is a copy of https://github.com/github/fetch/tree/v2.0.4
// the lines marked with PATCH has been changed to make this
// work with react-native

var self = global; // PATCH
Severity: Minor
Found in ts/utils/whatwg-fetch.js - About 6 hrs to fix

    Function Body has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

    function Body() {
      this.bodyUsed = false;
    
      this._initBody = function(body) {
        this._bodyInit = body;
    Severity: Minor
    Found in ts/utils/whatwg-fetch.js - About 6 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 Body has 91 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Body() {
      this.bodyUsed = false;
    
      this._initBody = function(body) {
        this._bodyInit = body;
    Severity: Major
    Found in ts/utils/whatwg-fetch.js - About 3 hrs to fix

      Function fetch has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function fetch(input, init) {
        return new Promise(function(resolve, reject) {
          var request = new Request(input, init);
      
          if (request.signal && request.signal.aborted) {
      Severity: Major
      Found in ts/utils/whatwg-fetch.js - About 2 hrs to fix

        Function _initBody has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          this._initBody = function(body) {
            this._bodyInit = body;
            if (!body) {
              this._bodyText = "";
            } else if (typeof body === "string") {
        Severity: Minor
        Found in ts/utils/whatwg-fetch.js - About 1 hr to fix

          Function Request has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          export function Request(input, options) {
            options = options || {};
            var body = options.body;
          
            if (input instanceof Request) {
          Severity: Minor
          Found in ts/utils/whatwg-fetch.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 Request has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function Request(input, options) {
            options = options || {};
            var body = options.body;
          
            if (input instanceof Request) {
          Severity: Minor
          Found in ts/utils/whatwg-fetch.js - About 1 hr to fix

            There are no issues that match your filters.

            Category
            Status