verse/verse-javascript

View on GitHub

Showing 104 of 104 total issues

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

            nodeUnSubscribe: function nodeUnSubscribe(prio, nodeId) {
                var buf = node.unsubscribe(nodeId);
                buf = request.message(buf);
                myWebscoket.send(buf);
            },
Severity: Major
Found in src/verse.js and 3 other locations - About 1 hr to fix
src/verse.js on lines 221..225
src/verse.js on lines 232..236
src/verse.js on lines 279..283

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 57.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    var parseFeature = function parseFeature(feature, receivedView, bufferPosition, length) {
        var value,
            stringFeatures = {
                3: 'HOST_URL',
                4: 'TOKEN',
Severity: Minor
Found in src/negotiation.js - About 1 hr to fix

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

            parse: function(buffer) {
                var opCode, cmdLen, result, payload;
                var receivedView = new DataView(buffer);
                var bufferPosition = 2;
    
    
    Severity: Minor
    Found in src/response.js - About 1 hr to fix

      Function getLayerSetUint64 has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          getLayerSetUint64 = function getLayerSetUint64(opCode, receivedView, bufferPosition) {
              var result, hi, lo, bigNumber;
      
              result = getLayerCmdCommons(opCode, receivedView, bufferPosition);
      
      
      Severity: Minor
      Found in src/layer.js - About 1 hr to fix

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

        module.exports = function(grunt) {
            'use strict';
        
            // Project configuration.
            //neco
        Severity: Minor
        Found in Gruntfile.js - About 55 mins 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 tagSet has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                    tagSet: function tagSet(prio, nodeId, tagGroupId, tagId, dataType, values) {
        Severity: Minor
        Found in src/verse.js - About 45 mins to fix

          Function layerCreate has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                      layerCreate: function layerCreate(prio, nodeId, parentLayerId, dataType, count, customType) {
          Severity: Minor
          Found in src/verse.js - About 45 mins to fix

            Function tagCreate has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                        tagCreate: function tagCreate(prio, nodeId, tagGroupId, dataType, count, customType) {
            Severity: Minor
            Found in src/verse.js - About 45 mins to fix

              Function set has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                       set: function(nodeId, tagGroupId, tagId, dataType, values) {
              Severity: Minor
              Found in src/tag.js - About 35 mins to fix

                Function create has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        create: function(nodeId, parentLayerId, dataType, count, customType) {
                Severity: Minor
                Found in src/layer.js - About 35 mins to fix

                  Function layerSetItems has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                              layerSetItems: function layerSetItems(prio, nodeId, layerId, dataTypes, items) {
                  Severity: Minor
                  Found in src/verse.js - About 35 mins to fix

                    Function create has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            create: function(nodeId, tagGroupId, dataType, count, customType) {
                    Severity: Minor
                    Found in src/tag.js - About 35 mins to fix

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

                          data_type_len = {
                              'UINT8': 1,
                              'UINT16': 2,
                              'UINT32': 4,
                              'UINT64': 8,
                      Severity: Major
                      Found in src/layer.js and 3 other locations - About 35 mins to fix
                      src/layer.js on lines 389..397
                      src/layer.js on lines 415..423
                      src/tag.js on lines 422..430

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

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

                          data_type_len = {
                              'UINT8': 1,
                              'UINT16': 2,
                              'UINT32': 4,
                              'UINT64': 8,
                      Severity: Major
                      Found in src/tag.js and 3 other locations - About 35 mins to fix
                      src/layer.js on lines 389..397
                      src/layer.js on lines 402..410
                      src/layer.js on lines 415..423

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

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

                          op_codes = {
                              'UINT8': 133,
                              'UINT16': 137,
                              'UINT32': 141,
                              'UINT64': 145,
                      Severity: Major
                      Found in src/layer.js and 3 other locations - About 35 mins to fix
                      src/layer.js on lines 389..397
                      src/layer.js on lines 402..410
                      src/tag.js on lines 422..430

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

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

                          data_types = {
                              'UINT8': 1,
                              'UINT16': 2,
                              'UINT32': 3,
                              'UINT64': 4,
                      Severity: Major
                      Found in src/layer.js and 3 other locations - About 35 mins to fix
                      src/layer.js on lines 402..410
                      src/layer.js on lines 415..423
                      src/tag.js on lines 422..430

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

                      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

                      Avoid too many return statements within this function.
                      Open

                                  return {
                                      'group': 'LAYER',
                                      'cmd': cmdValues
                                  };
                      Severity: Major
                      Found in src/response.js - About 30 mins to fix

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

                                connectionTerminatedCallback: function(event) {
                                    /*
                                     *  callback function for end of session handling
                                     * called when onClose websocket event is fired
                                     */
                        Severity: Minor
                        Found in example/app_standalone.js and 1 other location - About 30 mins to fix
                        example/app_amd.js on lines 80..87

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

                        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

                                39: function getNodeUmask(opCode, receivedView, bufferPosition) {
                                    return {
                                        CMD: commands[opCode],
                                        PERMISSIONS: receivedView.getUint8(bufferPosition + 2)
                                    };
                        Severity: Minor
                        Found in src/node.js and 1 other location - About 30 mins to fix
                        src/node.js on lines 65..70

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

                        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

                        Avoid too many return statements within this function.
                        Open

                                    return {
                                        'group': 'NEGO',
                                        'cmd': {
                                            CMD: opCode,
                                            MESSAGE: '@TODO - opCode not implemented'
                        Severity: Major
                        Found in src/response.js - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language