Showing 132 of 132 total issues

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

_.extendProto(Scope, {
    _add: Scope$_add,
    _safeAdd: Scope$_safeAdd,
    _copy: Scope$_copy,
    _each: Scope$_each,
Severity: Major
Found in lib/components/scope.js and 1 other location - About 2 hrs to fix
lib/util/dragdrop.js on lines 43..57

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 List$_addItems has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

function List$_addItems(count, index) {
    check(count, Match.Integer);

    if (!this.itemSample)
        return logger.error('List$_addItems: Item sample missing.');
Severity: Minor
Found in lib/components/c_facets/List.js - About 2 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 _onReady has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

function _onReady(eventType, req, callback, resolve, reject) {
    if (req.readyState != 4) return;
    if (req[config.request.completedKey]) return;

    _.spliceItem(_pendingRequests, req);
Severity: Minor
Found in lib/util/request.js - About 2 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 ComponentFacet$onConfigMessages has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

function ComponentFacet$onConfigMessages(messageSubscribers) {
    var notYetRegisteredMap = _.mapKeys(messageSubscribers, function(subscriber, messages) {
        var subscriberType = typeof subscriber;
        if (subscriberType == 'function')
            return this.on(messages, subscriber);
Severity: Minor
Found in lib/components/c_facet.js - About 2 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 List$_addItems has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function List$_addItems(count, index) {
    check(count, Match.Integer);

    if (!this.itemSample)
        return logger.error('List$_addItems: Item sample missing.');
Severity: Minor
Found in lib/components/c_facets/List.js - About 1 hr to fix

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

    describe('registry of facets', function() {
        before(function() {
            config({ check: true });
        });
    
    
    Severity: Major
    Found in test/components/c_facets/cf_registry_test.js and 1 other location - About 1 hr to fix
    test/components/c_registry_test.js on lines 10..20

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

    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('registry of components', function() {
        before(function() {
            config({ check: true });
        });
    
    
    Severity: Major
    Found in test/components/c_registry_test.js and 1 other location - About 1 hr to fix
    test/components/c_facets/cf_registry_test.js on lines 10..20

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

    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('should apply css class regardless of model path structure', function (done) {
            runTests.call(this, done, [
                test('.nested.property', true, ['nested-example']), // Add class
                test('.nested.property', false, []), // Remove class
                test('.nested.property', {}, ['nested-example']), // Add class (truthy value, not boolean true)
    Severity: Major
    Found in test_browser/components/c_facets/Css_test.js and 1 other location - About 1 hr to fix
    test_browser/components/c_facets/Css_test.js on lines 65..72

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

    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('should apply css classes based on truthy values', function(done) {
            runTests.call(this, done, [
                test('.modelPath1', true, ['css-class-1']), // Add class
                test('.modelPath1', false, []), // Remove class
                test('.modelPath1', {}, ['css-class-1']), // Add class (truthy value, not boolean true)
    Severity: Major
    Found in test_browser/components/c_facets/Css_test.js and 1 other location - About 1 hr to fix
    test_browser/components/c_facets/Css_test.js on lines 56..63

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

    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 Data$_splice has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function Data$_splice(spliceIndex, spliceHowMany) { //, ... arguments
        var inTransaction = getTransactionFlag(Data$_splice);
    
        var listFacet = this.owner.list;
        if (! listFacet)
    Severity: Minor
    Found in lib/components/c_facets/Data.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 Decoder has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function Decoder() {
        var skip = 0; // how many bits we have from the previous character
        var byte = 0; // current byte we're producing
    
        this.output = '';
    Severity: Minor
    Found in lib/util/base32.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 Data$_splice has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Data$_splice(spliceIndex, spliceHowMany) { //, ... arguments
        var inTransaction = getTransactionFlag(Data$_splice);
    
        var listFacet = this.owner.list;
        if (! listFacet)
    Severity: Minor
    Found in lib/components/c_facets/Data.js - About 1 hr to fix

      Function onDragStart has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function onDragStart(eventType, event) {
          event.stopPropagation();
      
          if (this.config.off || ! targetInDragHandle.call(this)) {
              event.preventDefault();
      Severity: Minor
      Found in lib/components/c_facets/Drag.js - About 1 hr to fix

        Function request$file has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function request$file(opts, fileData, callback, progress) {
            var abort;
            return addAbortAbility(
                new Promise(function (resolve, reject) {
                    if (typeof opts == 'string')
        Severity: Minor
        Found in lib/util/request.js - About 1 hr to fix

          Function Data$_set has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function Data$_set(value) {
              var inTransaction = getTransactionFlag(Data$_set);
          
              var valueSet;
              if (value !== null && typeof value == 'object') {
          Severity: Minor
          Found in lib/components/c_facets/Data.js - About 1 hr to fix

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

            function createBinderScope(scopeEl, scopeObjectFactory, rootScope, bindRootElement, throwOnErrors) {
                scopeEl = scopeEl || document.body;
                var scope = rootScope || new Scope(scopeEl)
                    , addMethod = throwOnErrors === false ? '_safeAdd' : '_add';
            
            
            Severity: Minor
            Found in lib/binder.js - About 1 hr to fix

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

              function getNodeAtTreePath(rootEl, treePath, nearest) {
                  if (!treePath) return;
              
                  var len = treePath.length;
                  if (len === 0) return rootEl;
              Severity: Minor
              Found in lib/util/dom.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 find has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              function find(direction, iterator) {
                  if (! findDirections.hasOwnProperty(direction))
                      throw new Error('incorrect find direction: ' + direction);
              
                  var el = this.owner.el
              Severity: Minor
              Found in lib/components/c_facets/Dom.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 Encoder has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              function Encoder() {
                  var skip = 0; // how many bits we will skip from the first byte
                  var bits = 0; // 5 high bits, carry from one byte to the next
              
                  this.output = '';
              Severity: Minor
              Found in lib/util/base32.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

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

              function Events$init() {
                  ComponentFacet.prototype.init.apply(this, arguments);
              
                  var domEventsSource = new DOMEventsSource(this, undefined, undefined, this.owner);
                  this._setMessageSource(domEventsSource);
              Severity: Major
              Found in lib/components/c_facets/Events.js and 1 other location - About 1 hr to fix
              lib/components/c_facets/Frame.js on lines 88..95

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

              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