jedmao/iso-http

View on GitHub

Showing 28 of 28 total issues

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

var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
Severity: Major
Found in js/node/Http.js and 1 other location - About 3 hrs to fix
js/browser/Http.js on lines 2..7

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 110.

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

var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
Severity: Major
Found in js/browser/Http.js and 1 other location - About 3 hrs to fix
js/node/Http.js on lines 3..8

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 110.

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 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

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

            it('handles a failure', done => {
                request({
                    url: '//tunne127.com'
                }, response => {
                    expect(response.status).toEqual(0);
    Severity: Major
    Found in lib/browser/Http.spec.ts and 1 other location - About 2 hrs to fix
    lib/browser/Http.spec.ts on lines 12..18

    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 78.

    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

        it('handles a 404', function (done) {
            request({ url: 'http://localhost:9876/404' }, function (response) {
                expect(response.status).toEqual(404);
                expect(response.text).toEqual('NOT FOUND');
                done();
    Severity: Major
    Found in js/browser/Http.spec.js and 1 other location - About 2 hrs to fix
    js/browser/Http.spec.js on lines 34..42

    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 78.

    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

        it('handles a 404', done => {
            request({ url: 'http://localhost:9876/404' }, response => {
                expect(response.status).toEqual(404);
                expect(response.text).toEqual('NOT FOUND');
                done();
    Severity: Major
    Found in lib/browser/Http.spec.ts and 1 other location - About 2 hrs to fix
    lib/browser/Http.spec.ts on lines 43..51

    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 78.

    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

            it('handles a failure', function (done) {
                request({
                    url: '//tunne127.com'
                }, function (response) {
                    expect(response.status).toEqual(0);
    Severity: Major
    Found in js/browser/Http.spec.js and 1 other location - About 2 hrs to fix
    js/browser/Http.spec.js on lines 7..13

    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 78.

    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 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

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

              export function request(
                  options: IsoHttp.RequestOptions,
                  resolve?: IsoHttp.ResolveCallback,
                  reject?: IsoHttp.RejectCallback) {
                  new Agent(options).send(resolve, reject);
          Severity: Major
          Found in lib/browser/Http.ts and 1 other location - About 1 hr to fix
          lib/node/Http.ts on lines 10..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 60.

          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

              export function request(
                  options: IsoHttp.RequestOptions,
                  resolve?: IsoHttp.ResolveCallback,
                  reject?: IsoHttp.RejectCallback) {
                  new Agent(options).send(resolve, reject);
          Severity: Major
          Found in lib/node/Http.ts and 1 other location - About 1 hr to fix
          lib/browser/Http.ts on lines 7..12

          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 60.

          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

              var fakeHttp = browserify()
                  .require('./fake.js', { expose: 'iso-http/fake' })
                  .bundle()
                  .pipe(source('iso-http--fake.js'))
                  .pipe(gulp.dest('dist'));
          Severity: Major
          Found in tasks/browserify.js and 1 other location - About 1 hr to fix
          tasks/browserify.js on lines 26..30

          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 60.

          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

              var testUtils = browserify()
                  .require('./js/test/TestUtils.js', { expose: 'TestUtils' })
                  .bundle()
                  .pipe(source('test-utils.js'))
                  .pipe(gulp.dest('dist'));
          Severity: Major
          Found in tasks/browserify.js and 1 other location - About 1 hr to fix
          tasks/browserify.js on lines 20..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 60.

          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 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

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

                        it('joins the url and query with "?" if no "?" is found', function () {
                            var actual = Helpers.joinUrlWithQuery('foo', { bar: 'baz' });
                            var expected = 'foo?bar=baz';
                            expect(actual).toEqual(expected);
                        });
                Severity: Major
                Found in js/Helpers.spec.js and 1 other location - About 1 hr to fix
                js/Helpers.spec.js on lines 14..18

                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 57.

                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

                        it('joins the url and query with "&" if "?" is found', function () {
                            var actual = Helpers.joinUrlWithQuery('foo?bar=baz', { qux: 'quux' });
                            var expected = 'foo?bar=baz&qux=quux';
                            expect(actual).toEqual(expected);
                        });
                Severity: Major
                Found in js/Helpers.spec.js and 1 other location - About 1 hr to fix
                js/Helpers.spec.js on lines 9..13

                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 57.

                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

                        it('joins the url and query with "&" if "?" is found', () => {
                            var actual = Helpers.joinUrlWithQuery('foo?bar=baz', { qux: 'quux' });
                            var expected = 'foo?bar=baz&qux=quux';
                            expect(actual).toEqual(expected);
                        });
                Severity: Major
                Found in lib/Helpers.spec.ts and 1 other location - About 1 hr to fix
                lib/Helpers.spec.ts on lines 14..18

                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 57.

                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

                Severity
                Category
                Status
                Source
                Language