bbc/flashheart

View on GitHub

Showing 73 of 73 total issues

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

    map           : function ( query, iterator, thisobj ) {
        if ( sys.isPlainObject( query ) ) {
            thisobj = thisobj || this;
            return sys.map( this.find( query ), iterator, thisobj );
        } else {
Severity: Major
Found in docconfig/template/fixtures/documents/collector.js and 6 other locations - About 2 hrs to fix
docconfig/template/fixtures/documents/collector.js on lines 138..146
docconfig/template/fixtures/documents/collector.js on lines 157..165
docconfig/template/fixtures/documents/collector.js on lines 193..201
docconfig/template/fixtures/documents/collector.js on lines 211..219
docconfig/template/fixtures/documents/collector.js on lines 229..237
docconfig/template/fixtures/documents/collector.js on lines 338..346

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

        flatten     : function ( query, iterator, thisobj ) {
            if ( sys.isPlainObject( query ) ) {
                thisobj = thisobj || this;
                return sys.flatten( this.find( query ), iterator, thisobj );
            } else {
Severity: Major
Found in docconfig/template/fixtures/documents/collector.js and 6 other locations - About 2 hrs to fix
docconfig/template/fixtures/documents/collector.js on lines 99..107
docconfig/template/fixtures/documents/collector.js on lines 138..146
docconfig/template/fixtures/documents/collector.js on lines 157..165
docconfig/template/fixtures/documents/collector.js on lines 193..201
docconfig/template/fixtures/documents/collector.js on lines 211..219
docconfig/template/fixtures/documents/collector.js on lines 229..237

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

    sortBy        : function ( query, iterator, thisobj ) {
        if ( sys.isPlainObject( query ) ) {
            thisobj = thisobj || this;
            return sys.sortBy( this.find( query ), iterator, thisobj );
        } else {
Severity: Major
Found in docconfig/template/fixtures/documents/collector.js and 6 other locations - About 2 hrs to fix
docconfig/template/fixtures/documents/collector.js on lines 99..107
docconfig/template/fixtures/documents/collector.js on lines 138..146
docconfig/template/fixtures/documents/collector.js on lines 157..165
docconfig/template/fixtures/documents/collector.js on lines 211..219
docconfig/template/fixtures/documents/collector.js on lines 229..237
docconfig/template/fixtures/documents/collector.js on lines 338..346

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

    max           : function ( query, iterator, thisobj ) {
        if ( sys.isPlainObject( query ) ) {
            thisobj = thisobj || this;
            return sys.max( this.find( query ), iterator, thisobj );
        } else {
Severity: Major
Found in docconfig/template/fixtures/documents/collector.js and 6 other locations - About 2 hrs to fix
docconfig/template/fixtures/documents/collector.js on lines 99..107
docconfig/template/fixtures/documents/collector.js on lines 138..146
docconfig/template/fixtures/documents/collector.js on lines 157..165
docconfig/template/fixtures/documents/collector.js on lines 193..201
docconfig/template/fixtures/documents/collector.js on lines 229..237
docconfig/template/fixtures/documents/collector.js on lines 338..346

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

    groupBy       : function ( query, iterator, thisobj ) {
        if ( sys.isPlainObject( query ) ) {
            thisobj = thisobj || this;
            return sys.groupBy( this.find( query ), iterator, thisobj );
        } else {
Severity: Major
Found in docconfig/template/fixtures/documents/collector.js and 6 other locations - About 2 hrs to fix
docconfig/template/fixtures/documents/collector.js on lines 99..107
docconfig/template/fixtures/documents/collector.js on lines 138..146
docconfig/template/fixtures/documents/collector.js on lines 193..201
docconfig/template/fixtures/documents/collector.js on lines 211..219
docconfig/template/fixtures/documents/collector.js on lines 229..237
docconfig/template/fixtures/documents/collector.js on lines 338..346

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

Function constructor has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    constructor : function () {
        /**
         * The schema that defines the validation rules. This should probably be defined at the prototype for each
         * object or model classification. It can be an anonymous schema defined right here, or this can be
         * registered schema names to use, or just a single name
Severity: Minor
Found in docconfig/template/fixtures/documents/schema.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 pushin has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function pushin( path, record, setter, newValue ) {
    var context = record;
    var parent = record;
    var lastPart = null;
    var _i;
Severity: Major
Found in docconfig/template/fixtures/documents/probe.js - About 2 hrs to fix

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

        sys.each( parts, function ( part ) {
            lastParentName = part;
            lastParent = context;
            context = context[part];
            lastPartName = part;
    Severity: Major
    Found in docconfig/template/fixtures/documents/binder.js and 1 other location - About 2 hrs to fix
    docconfig/template/fixtures/documents/binder.js on lines 42..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 85.

    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

        sys.each( parts, function ( part ) {
            lastParentName = part;
            lastParent = context;
            context = context[part];
            lastPartName = part;
    Severity: Major
    Found in docconfig/template/fixtures/documents/binder.js and 1 other location - About 2 hrs to fix
    docconfig/template/fixtures/documents/binder.js on lines 100..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 85.

    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

      public async delete(uri: string, opts?: RequestOptions): Promise<Response> {
        const req = this.client.delete(uri);
        const res = await req
          .headers(_.get(opts, 'headers'))
          .query(_.get(opts, 'qs'))
    Severity: Major
    Found in src/httpTransport/client.ts and 1 other location - About 2 hrs to fix
    src/httpTransport/client.ts on lines 110..118

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

    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

      public async head(uri: string, opts?: RequestOptions): Promise<Response> {
        const req = this.client.head(uri);
        const res = await req
          .headers(_.get(opts, 'headers'))
          .query(_.get(opts, 'qs'))
    Severity: Major
    Found in src/httpTransport/client.ts and 1 other location - About 2 hrs to fix
    src/httpTransport/client.ts on lines 127..135

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

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

        function setUpBindings( mountPoint, mountName ) {
            mountPoint["__" + mountName + "__"] = mountPoint[mountName];
            Object.defineProperty( mountPoint, mountName, {
                get : function () {
                    if ( sys.isFunction( options.getter ) ) {
    Severity: Major
    Found in docconfig/template/fixtures/documents/binder.js - About 2 hrs to fix

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

                  case '$inc':
                      /**
                       * Increments a field by the amount you specify. It takes the form
                       * `{ $inc: { field1: amount } }`
                       * @name $inc
      Severity: Major
      Found in docconfig/template/fixtures/documents/probe.js and 1 other location - About 2 hrs to fix
      docconfig/template/fixtures/documents/probe.js on lines 244..263

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

      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

                  case '$dec':
                      /**
                       * Decrements a field by the amount you specify. It takes the form
                       * `{ $dec: { field1: amount }`
                       * @name $dec
      Severity: Major
      Found in docconfig/template/fixtures/documents/probe.js and 1 other location - About 2 hrs to fix
      docconfig/template/fixtures/documents/probe.js on lines 224..243

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

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

          constructor : function () {
              /**
               * The schema that defines the validation rules. This should probably be defined at the prototype for each
               * object or model classification. It can be an anonymous schema defined right here, or this can be
               * registered schema names to use, or just a single name
      Severity: Major
      Found in docconfig/template/fixtures/documents/schema.js - About 2 hrs to fix

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

            addDefaultOptions : function ( options ) {
                options = options || {};
                if ( this.options ) {options = sys.defaults( {}, sys.result( this, 'options' ), options );}
                this.options = options;
            },
        Severity: Major
        Found in docconfig/template/fixtures/base/index.js and 2 other locations - About 1 hr to fix
        docconfig/template/fixtures/base/index.js on lines 29..33
        docconfig/template/fixtures/mixins/signalable.js on lines 208..212

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

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

            addOptions        : function ( options ) {
                options = options || {};
                if ( this.options ) {options = sys.extend( {}, sys.result( this, 'options' ), options );}
                this.options = options;
            },
        Severity: Major
        Found in docconfig/template/fixtures/base/index.js and 2 other locations - About 1 hr to fix
        docconfig/template/fixtures/base/index.js on lines 40..44
        docconfig/template/fixtures/mixins/signalable.js on lines 208..212

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

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

            _addSignals : function ( signals ) {
                signals = signals || {};
                if ( this.options ) {signals = sys.extend( {}, sys.result( this, 'signals' ), signals );}
                this.signals = signals;
            },
        Severity: Major
        Found in docconfig/template/fixtures/mixins/signalable.js and 2 other locations - About 1 hr to fix
        docconfig/template/fixtures/base/index.js on lines 29..33
        docconfig/template/fixtures/base/index.js on lines 40..44

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

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

            constructor : function () {
                var that = this;
                probe.mixin( this );
        
                var idField = "_id";
        Severity: Minor
        Found in docconfig/template/fixtures/documents/model.js - About 1 hr to fix

          Function publish has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.publish = function(taffyData, opts, tutorials) {
              var docdash = env && env.conf && env.conf.docdash || {};
              data = taffyData;
          
              var conf = env.conf.templates || {};
          Severity: Minor
          Found in docconfig/template/publish.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

          Severity
          Category
          Status
          Source
          Language