DaQuirm/nexus

View on GitHub

Showing 35 of 35 total issues

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

            nxt.Element('input',
                nxt.Attr('type', 'text'),
                nxt.Attr('id', 'login-input'),
                nxt.Binding(user.login, function(value) { return nxt.Text(value); }),
                nxt.Event('change', function() {
Severity: Major
Found in demos/auth/src/auth.js and 1 other location - About 2 hrs to fix
demos/auth/src/auth.js on lines 43..50

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

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

            nxt.Element('input',
                nxt.Attr('type', 'password'),
                nxt.Attr('id', 'password-input'),
                nxt.Binding(user.password, function(value) { return nxt.Text(value); }),
                nxt.Event('change', function() {
Severity: Major
Found in demos/auth/src/auth.js and 1 other location - About 2 hrs to fix
demos/auth/src/auth.js on lines 31..38

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

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

        switch (compareResult) {
            case nx.OrderTree.ComparisonResult.LESS:
            case nx.OrderTree.ComparisonResult.EQUAL:
                direction = nx.OrderTree.Direction.LEFT;
                break;
Severity: Major
Found in src/refinements/order-tree.js and 1 other location - About 2 hrs to fix
src/refinements/order-tree.js on lines 77..86

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

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

        switch (compareResult) {
            case nx.OrderTree.ComparisonResult.LESS:
            case nx.OrderTree.ComparisonResult.EQUAL:
                direction = nx.OrderTree.Direction.LEFT;
                break;
Severity: Major
Found in src/refinements/order-tree.js and 1 other location - About 2 hrs to fix
src/refinements/order-tree.js on lines 99..108

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

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 update has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

nxt.ContentRegion.prototype.update = function (state) {
    var hasRenderer = typeof state.renderer !== 'undefined';
    var noCommand = typeof state.command === 'undefined';
    if (hasRenderer) {
        if (noCommand) {
Severity: Minor
Found in src/nxt/content-region.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 AuthForm has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

AuthApp.Views.AuthForm = function(user) {
    return nxt.Element('div',
        nxt.Element('form',
            nxt.Element('label',
                nxt.Attr('for', 'login-input'),
Severity: Minor
Found in demos/auth/src/auth.js - About 1 hr to fix

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

            if (typeof domContext.content !== 'undefined') {
                domContext.container.insertBefore(data.fragment, domContext.content[0]);
                nxt.FragmentRenderer.unrender(domContext);
            } else if (typeof domContext.insertReference !== 'undefined') {
                domContext.container.insertBefore(data.fragment, domContext.insertReference);
    Severity: Major
    Found in src/nxt/renderers/fragment-renderer.js and 1 other location - About 1 hr to fix
    src/nxt/renderers/node-renderer.js on lines 16..22

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

    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

            if (typeof domContext.content !== 'undefined') {
                domContext.container.replaceChild(data.node, domContext.content);
            } else if (typeof domContext.insertReference !== 'undefined') {
                domContext.container.insertBefore(data.node, domContext.insertReference);
            } else {
    Severity: Major
    Found in src/nxt/renderers/node-renderer.js and 1 other location - About 1 hr to fix
    src/nxt/renderers/fragment-renderer.js on lines 7..14

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

    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 request has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    nx.AjaxModel.prototype.request = function (options) {
        var _this = this;
        var url = nx.Utils.interpolateString(options.url, this.data.value);
        this.xhr = new XMLHttpRequest();
        this.xhr.open(options.method, url, true);
    Severity: Minor
    Found in src/core/ajax-model.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 exports has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(grunt) {
        grunt.loadNpmTasks('grunt-coffee');
        grunt.loadNpmTasks('grunt-less');
    
        grunt.initConfig({
    Severity: Minor
    Found in demos/todo-list/grunt.js - About 1 hr to fix

      Function update has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      nxt.ContentRegion.prototype.update = function (state) {
          var hasRenderer = typeof state.renderer !== 'undefined';
          var noCommand = typeof state.command === 'undefined';
          if (hasRenderer) {
              if (noCommand) {
      Severity: Minor
      Found in src/nxt/content-region.js - About 1 hr to fix

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

        nx.Collection.prototype.filter = function (options) {
            options.source = this;
            return new nx.RefinedCollection(
                this,
                new nx.FilterRefinement(options),
        Severity: Major
        Found in src/core/collection.js and 1 other location - About 1 hr to fix
        src/core/collection.js on lines 118..125

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

        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

        nx.Collection.prototype.sort = function (options) {
            options.source = this;
            return new nx.RefinedCollection(
                this,
                new nx.SortRefinement(options),
        Severity: Major
        Found in src/core/collection.js and 1 other location - About 1 hr to fix
        src/core/collection.js on lines 109..116

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

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

        nx.AjaxModel.prototype.request = function (options) {
            var _this = this;
            var url = nx.Utils.interpolateString(options.url, this.data.value);
            this.xhr = new XMLHttpRequest();
            this.xhr.open(options.method, url, true);
        Severity: Minor
        Found in src/core/ajax-model.js - About 1 hr to fix

          Function map has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          nx.Mapping.prototype.map = function (source, target) {
              if (typeof this.pattern !== 'undefined') {
                  for (var item in this.pattern) {
                      if (item === '_' && typeof target !== 'undefined') {
                          target[this.pattern[item]] = source;
          Severity: Minor
          Found in src/core/mapping.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 render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              render: function (data, domContext) {
                  var attrMap = {};
                  if (typeof data.items !== 'undefined') {
                      for (var key in data.items) {
                          if (key === 'value') {
          Severity: Minor
          Found in src/nxt/renderers/attr-renderer.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 render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              render: function (data, domContext) {
                  if (typeof domContext.content !== 'undefined') {
                      domContext.container.replaceChild(data.node, domContext.content);
                  } else if (typeof domContext.insertReference !== 'undefined') {
                      domContext.container.insertBefore(data.node, domContext.insertReference);
          Severity: Minor
          Found in src/nxt/renderers/node-renderer.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 render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              render: function (data, domContext) {
                  if (typeof domContext.content !== 'undefined') {
                      domContext.container.replaceChild(data.node, domContext.content);
                  } else if (typeof domContext.insertReference !== 'undefined') {
                      domContext.container.insertBefore(data.node, domContext.insertReference);
          Severity: Minor
          Found in src/nxt/renderers/node-renderer.js - About 1 hr to fix

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

            nx.FilterRefinement.prototype.insertBefore = function (data, values) {
                var filtered = this._filterItems(data.items, values);
            
                var closestIndex = 0;
                while (this._indexes[closestIndex] < data.index) {
            Severity: Minor
            Found in src/refinements/filter-refinement.js - About 1 hr to fix

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

                      if (this.status === 200 || this.status === 201 || this.status === 204) {
                          handler = options.success;
                          _this.data.value = data;
                          _this.status.value = nx.AsyncStatus.DONE;
                      } else {
              Severity: Minor
              Found in src/core/ajax-model.js and 1 other location - About 50 mins to fix
              src/core/ajax-model.js on lines 44..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 52.

              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