mjackson/mach

View on GitHub

Showing 382 of 382 total issues

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

  describe('for a message with a filename and modification-date param', function () {
    beforeEachParseFixture('filename_and_modification_param');

    it('correctly parses the file name', function () {
      assert(parts.files);
Severity: Major
Found in modules/multipart/__tests__/Parser-test.js and 5 other locations - About 5 hrs to fix
modules/multipart/__tests__/Parser-test.js on lines 104..121
modules/multipart/__tests__/Parser-test.js on lines 146..163
modules/multipart/__tests__/Parser-test.js on lines 165..182
modules/multipart/__tests__/Parser-test.js on lines 184..201
modules/multipart/__tests__/Parser-test.js on lines 222..239

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

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 6 locations. Consider refactoring.
Open

  describe('for a message with a filename with percent escaped quotes', function () {
    beforeEachParseFixture('filename_with_percent_escaped_quotes');

    it('correctly parses the file name', function () {
      assert(parts.files);
Severity: Major
Found in modules/multipart/__tests__/Parser-test.js and 5 other locations - About 5 hrs to fix
modules/multipart/__tests__/Parser-test.js on lines 104..121
modules/multipart/__tests__/Parser-test.js on lines 146..163
modules/multipart/__tests__/Parser-test.js on lines 165..182
modules/multipart/__tests__/Parser-test.js on lines 203..220
modules/multipart/__tests__/Parser-test.js on lines 222..239

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

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 6 locations. Consider refactoring.
Open

  describe('for a text file upload using IE-style filename', function () {
    beforeEachParseFixture('text_ie');

    it('correctly parses and clean up the file name', function () {
      assert(parts.files);
Severity: Major
Found in modules/multipart/__tests__/Parser-test.js and 5 other locations - About 5 hrs to fix
modules/multipart/__tests__/Parser-test.js on lines 146..163
modules/multipart/__tests__/Parser-test.js on lines 165..182
modules/multipart/__tests__/Parser-test.js on lines 184..201
modules/multipart/__tests__/Parser-test.js on lines 203..220
modules/multipart/__tests__/Parser-test.js on lines 222..239

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

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 6 locations. Consider refactoring.
Open

  describe('for a message with a filename with unescaped quotes and modification-date param', function () {
    beforeEachParseFixture('filename_with_unescaped_quotes_and_modification_param');

    it('correctly parses the file name', function () {
      assert(parts.files);
Severity: Major
Found in modules/multipart/__tests__/Parser-test.js and 5 other locations - About 5 hrs to fix
modules/multipart/__tests__/Parser-test.js on lines 104..121
modules/multipart/__tests__/Parser-test.js on lines 146..163
modules/multipart/__tests__/Parser-test.js on lines 165..182
modules/multipart/__tests__/Parser-test.js on lines 184..201
modules/multipart/__tests__/Parser-test.js on lines 203..220

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

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 support has 143 lines of code (exceeds 25 allowed). Consider refactoring.
Open

jQuery.support = (function() {

    var support,
        all,
        a,
Severity: Major
Found in modules/middleware/__tests__/fixtures/jquery-1.8.3.js - About 5 hrs to fix

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

    module.exports = function (mach) {
      mach.bind = require('../utils/bindApp');
      mach.createConnection = require('../utils/createConnection');
      mach.serve = require('../utils/serveApp');
    
    
    Severity: Minor
    Found in modules/extensions/server.js - About 5 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 createRouter has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    function createRouter(app, map) {
      // Allow mach.router(map)
      if (typeof app === 'object') {
        map = app;
        app = null;
    Severity: Minor
    Found in modules/middleware/router.js - About 5 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

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

      desc('when a session is saved', function () {
        var value;
        beforeEach(function () {
          var session = { count: 1 };
          return store.save(session).then(function (newValue) {
    Severity: Major
    Found in modules/middleware/session/__tests__/describeSessionStore.js and 1 other location - About 5 hrs to fix
    modules/middleware/session/__tests__/describeSessionStore.js on lines 59..74

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

    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

        describe('and a session is not expired', function () {
          var value;
          beforeEach(function () {
            var session = { count: 1 };
            return store.save(session).then(function (newValue) {
    Severity: Major
    Found in modules/middleware/session/__tests__/describeSessionStore.js and 1 other location - About 5 hrs to fix
    modules/middleware/session/__tests__/describeSessionStore.js on lines 33..48

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

    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

        function parseURL(url) {
          var origin = ORIGIN_MATCHER.exec(url) || {};
    
          var anchor = document.createElement("a");
          anchor.href = url;
    Severity: Major
    Found in lib/umd/mach.js and 1 other location - About 5 hrs to fix
    modules/utils/parseURL-browser.js on lines 3..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 138.

    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

    function parseURL(url) {
      var origin = ORIGIN_MATCHER.exec(url) || {};
    
      var anchor = document.createElement('a');
      anchor.href = url;
    Severity: Major
    Found in modules/utils/parseURL-browser.js and 1 other location - About 5 hrs to fix
    lib/umd/mach.js on lines 1012..1027

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

    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 Callbacks has 127 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    jQuery.Callbacks = function( options ) {
    
        // Convert options from String-formatted to Object-formatted if needed
        // (we check in cache first)
        options = typeof options === "string" ?
    Severity: Major
    Found in modules/middleware/__tests__/fixtures/jquery-1.8.3.js - About 5 hrs to fix

      Consider simplifying this complex logical expression.
      Open

                  if ( event.pageX == null && original.clientX != null ) {
                      eventDoc = event.target.ownerDocument || document;
                      doc = eventDoc.documentElement;
                      body = eventDoc.body;
      
      
      Severity: Critical
      Found in modules/middleware/__tests__/fixtures/jquery-1.8.3.js - About 5 hrs to fix

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

          describe('with no value', function () {
            beforeEach(function () {
              header = new AcceptLanguage;
            });
        
        
        Severity: Major
        Found in modules/headers/__tests__/AcceptLanguage-test.js and 1 other location - About 4 hrs to fix
        modules/headers/__tests__/Accept-test.js on lines 9..25

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

        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

          describe('with no value', function () {
            beforeEach(function () {
              header = new Accept;
            });
        
        
        Severity: Major
        Found in modules/headers/__tests__/Accept-test.js and 1 other location - About 4 hrs to fix
        modules/headers/__tests__/AcceptLanguage-test.js on lines 9..25

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

        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

          describe('when the path is set', function () {
            describe('with a search', function () {
              it('has the correct href', function () {
                location.path = '/another/path?another=query';
                expect(location.href).toEqual('http://user:pass@example.com:5000/another/path?another=query');
        Severity: Major
        Found in modules/__tests__/Location-test.js and 1 other location - About 4 hrs to fix
        modules/__tests__/Location-test.js on lines 116..130

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

        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

          describe('when the host is set', function () {
            describe('with a port', function () {
              it('has the correct href', function () {
                location.host = 'example.net:8080';
                expect(location.href).toEqual('http://user:pass@example.net:8080/the/path?the=query');
        Severity: Major
        Found in modules/__tests__/Location-test.js and 1 other location - About 4 hrs to fix
        modules/__tests__/Location-test.js on lines 146..160

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

        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

          addHeader: d(function (headerName, value) {
            headerName = normalizeHeaderName(headerName);
        
            var headers = this.headers;
            if (headerName in headers) {
        Severity: Major
        Found in modules/Message.js and 1 other location - About 4 hrs to fix
        lib/umd/mach.js on lines 700..713

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

        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

            function pipeContent(xhr, stream, offset) {
              var content = getContent(xhr);
        
              if (content != null) {
                if (content.toString().match(/ArrayBuffer/)) {
        Severity: Major
        Found in lib/umd/mach.js and 1 other location - About 4 hrs to fix
        modules/utils/sendRequest-browser.js on lines 27..43

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

        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

                it('persists session data', function () {
                  return callApp(app).then(function (conn) {
                    var cookie = getSessionCookie(conn.response.headers['Set-Cookie']);
        
                    return callApp(app, {
        Severity: Major
        Found in modules/middleware/__tests__/session-test.js and 1 other location - About 4 hrs to fix
        modules/middleware/__tests__/session-test.js on lines 107..117

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

        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