jedmao/iso-http

View on GitHub

Showing 10 of 28 total issues

Function Agent has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var Agent = (function (_super) {
        __extends(Agent, _super);
        function Agent(options) {
            _super.call(this, options);
            var xrw = 'x-requested-with';
Severity: Major
Found in js/browser/Http.js - About 2 hrs to fix

    Function Agent has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var Agent = (function () {
            function Agent(options) {
                this.headers = {};
                if (!options || !Object.keys(options).length) {
                    throw new Error('Missing options.');
    Severity: Minor
    Found in js/IsoHttp.js - About 1 hr to fix

      Function Agent has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var Agent = (function (_super) {
              __extends(Agent, _super);
              function Agent() {
                  _super.apply(this, arguments);
              }
      Severity: Minor
      Found in js/node/Http.js - About 1 hr to fix

        Function exports has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(config) {
            config.set({
        
                // base path that will be used to resolve all patterns (eg. files, exclude)
                basePath: '',
        Severity: Minor
        Found in karma.conf.js - About 1 hr to fix

          Function send has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  Agent.prototype.send = function (resolve, reject) {
                      var _this = this;
                      var parsedUrl = url.parse(this.url);
                      var options = {
                          host: parsedUrl.host,
          Severity: Minor
          Found in js/node/Http.js - About 1 hr to fix

            Function send has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    send(resolve?: IsoHttp.ResolveCallback, reject?: IsoHttp.RejectCallback) {
                        var parsedUrl = url.parse(this.url);
                        var options: any = {
                            host: parsedUrl.host,
                            hostname: parsedUrl.hostname,
            Severity: Minor
            Found in lib/node/Http.ts - About 1 hr to fix

              Function send has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      Agent.prototype.send = function (resolve, reject) {
                          var _this = this;
                          var url = (this.method === 'GET')
                              ? Helpers.joinUrlWithQuery(this.url, this.data)
                              : this.url;
              Severity: Minor
              Found in js/browser/Http.js - About 1 hr to fix

                Function send has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        send(resolve?: IsoHttp.ResolveCallback, reject?: IsoHttp.RejectCallback) {
                            var url = (this.method === 'GET')
                                ? Helpers.joinUrlWithQuery(this.url, this.data)
                                : this.url;
                            var xhr = this.createXhr();
                Severity: Minor
                Found in lib/browser/Http.ts - About 1 hr to fix

                  Function send has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                          send(resolve?: IsoHttp.ResolveCallback, reject?: IsoHttp.RejectCallback) {
                              var url = (this.method === 'GET')
                                  ? Helpers.joinUrlWithQuery(this.url, this.data)
                                  : this.url;
                              var xhr = this.createXhr();
                  Severity: Minor
                  Found in lib/browser/Http.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 constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                          constructor(options: RequestOptions) {
                              if (!options || !Object.keys(options).length) {
                                  throw new Error('Missing options.');
                              }
                              if (!options.url) {
                  Severity: Minor
                  Found in lib/IsoHttp.ts - About 25 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