verse/verse-javascript

View on GitHub
src/tag.js

Summary

Maintainability
F
1 wk
Test Coverage

File tag.js has 335 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Verse Websocket Asynchronous Module 
 *
 * The MIT License (MIT)
 *
Severity: Minor
Found in src/tag.js - About 4 hrs 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, tagGroupId, dataType, count, customType) {
      Severity: Minor
      Found in src/tag.js - About 35 mins to fix

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

            getTagSetFloat32 = function getTagSetFloat32(opCode, receivedView, bufferPosition) {
                var result = getTagSetCommons(opCode, receivedView, bufferPosition);
        
                result.VALUES[0] = receivedView.getFloat32(bufferPosition + 11);
        
        
        Severity: Major
        Found in src/tag.js and 4 other locations - About 7 hrs to fix
        src/tag.js on lines 56..78
        src/tag.js on lines 84..105
        src/tag.js on lines 112..133
        src/tag.js on lines 222..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 190.

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

            getTagSetUint8 = function getTagSetUint8(opCode, receivedView, bufferPosition) {
                
                var result = getTagSetCommons(opCode, receivedView, bufferPosition);
        
                result.VALUES[0] = receivedView.getUint8(bufferPosition + 11);
        Severity: Major
        Found in src/tag.js and 4 other locations - About 7 hrs to fix
        src/tag.js on lines 84..105
        src/tag.js on lines 112..133
        src/tag.js on lines 195..216
        src/tag.js on lines 222..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 190.

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

            getTagSetUint32 = function getTagSetUint32(opCode, receivedView, bufferPosition) {
                var result = getTagSetCommons(opCode, receivedView, bufferPosition);
        
                result.VALUES[0] = receivedView.getUint32(bufferPosition + 11);
        
        
        Severity: Major
        Found in src/tag.js and 4 other locations - About 7 hrs to fix
        src/tag.js on lines 56..78
        src/tag.js on lines 84..105
        src/tag.js on lines 195..216
        src/tag.js on lines 222..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 190.

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

            getTagSetUint16 = function getTagSetUint16(opCode, receivedView, bufferPosition) {
                var result = getTagSetCommons(opCode, receivedView, bufferPosition);
        
                result.VALUES[0] = receivedView.getUint16(bufferPosition + 11);
        
        
        Severity: Major
        Found in src/tag.js and 4 other locations - About 7 hrs to fix
        src/tag.js on lines 56..78
        src/tag.js on lines 112..133
        src/tag.js on lines 195..216
        src/tag.js on lines 222..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 190.

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

            getTagSetFloat64 = function getTagSetFloat64(opCode, receivedView, bufferPosition) {
                var result = getTagSetCommons(opCode, receivedView, bufferPosition);
        
                result.VALUES[0] = receivedView.getFloat64(bufferPosition + 11);
        
        
        Severity: Major
        Found in src/tag.js and 4 other locations - About 7 hrs to fix
        src/tag.js on lines 56..78
        src/tag.js on lines 84..105
        src/tag.js on lines 112..133
        src/tag.js on lines 195..216

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

        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

                destroy: function(nodeId, tagGroupId, tagId) {
                    var cmd, view;
                    cmd = command.template(11, 69);
                    view = new DataView(cmd);
                    view.setUint8(2, 0); //share
        Severity: Major
        Found in src/tag.js and 1 other location - About 3 hrs to fix
        src/node.js on lines 235..244

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

        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 (opCode > 82) {
                    lo = receivedView.getUint32(bufferPosition + 19);
                    hi = receivedView.getUint32(bufferPosition + 23); 
                    bigNumber = new Int64(hi, lo);
                    result.VALUES[1] = bigNumber.valueOf();
        Severity: Major
        Found in src/tag.js and 1 other location - About 2 hrs to fix
        src/tag.js on lines 160..165

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

        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 (opCode > 83) {
                    lo = receivedView.getUint32(bufferPosition + 27);
                    hi = receivedView.getUint32(bufferPosition + 31); 
                    bigNumber = new Int64(hi, lo);
                    result.VALUES[2] = bigNumber.valueOf();
        Severity: Major
        Found in src/tag.js and 1 other location - About 2 hrs to fix
        src/tag.js on lines 152..157

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

        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

                'REAL64': function setTagSetReal64(view, values) {
                    for (var i = 0; i < values.length; i++) {
                        view.setFloat64(11 + 8 * i, values[i]);
                    }
                },
        Severity: Major
        Found in src/tag.js and 3 other locations - About 1 hr to fix
        src/tag.js on lines 364..368
        src/tag.js on lines 369..373
        src/tag.js on lines 381..385

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

                'REAL32': function setTagSetReal32(view, values) {
                    for (var i = 0; i < values.length; i++) {
                        view.setFloat32(11 + 4 * i, values[i]);
                    }
                },
        Severity: Major
        Found in src/tag.js and 3 other locations - About 1 hr to fix
        src/tag.js on lines 364..368
        src/tag.js on lines 369..373
        src/tag.js on lines 386..390

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

                'UINT32': function setTagSetUint32(view, values) {
                    for (var i = 0; i < values.length; i++) {
                        view.setUint32(11 + 4 * i, values[i]);
                    }
                },
        Severity: Major
        Found in src/tag.js and 3 other locations - About 1 hr to fix
        src/tag.js on lines 364..368
        src/tag.js on lines 381..385
        src/tag.js on lines 386..390

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

                'UINT16': function setTagSetUint16(view, values) {
                    for (var i = 0; i < values.length; i++) {
                        view.setUint16(11 + 2 * i, values[i]);
                    }
                },
        Severity: Major
        Found in src/tag.js and 3 other locations - About 1 hr to fix
        src/tag.js on lines 369..373
        src/tag.js on lines 381..385
        src/tag.js on lines 386..390

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

        There are no issues that match your filters.

        Category
        Status