kuasha/cosmos

View on GitHub
samples/simple/app/serviceapi.js

Summary

Maintainability
D
3 days
Test Coverage

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

function do_operation(url, method, data, callback, error_callback){
Severity: Minor
Found in samples/simple/app/serviceapi.js - About 35 mins to fix

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

    function loadItem(){
        var name = jQuery("#name").val();
        var data = jQuery("#data").val();
        var columns = jQuery("#columns").val();
        var filter = jQuery("#filter").val();
    Severity: Major
    Found in samples/simple/app/serviceapi.js and 1 other location - About 7 hrs to fix
    samples/adminpanel/app/lib/cosmos/js/serviceapi.js on lines 52..74

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

    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

    function subscribe (monitor_endpoint, object_name, callback) {
        //TODO: Unify the observer to listen to many objects at a time using different callback
        //var monitor_endpoint = "ws://localhost:8080/changemonitor"
        var websocket = new WebSocket(monitor_endpoint);
        var fn = callback;
    Severity: Major
    Found in samples/simple/app/serviceapi.js and 1 other location - About 6 hrs to fix
    samples/adminpanel/app/lib/cosmos/js/serviceapi.js on lines 85..112

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

    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

    function do_operation(url, method, data, callback, error_callback){
        jQuery("#result").val("");
        jQuery("#status").html("");
        console.log(method+ ": "+url)
        $.ajax({
    Severity: Major
    Found in samples/simple/app/serviceapi.js and 1 other location - About 3 hrs to fix
    samples/adminpanel/app/lib/cosmos/js/serviceapi.js on lines 22..33

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

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

    function insertService(){
        var name = jQuery("#name").val();
        var data = jQuery("#data").val();
    
        var url =  getServiceUrl(name);
    Severity: Major
    Found in samples/simple/app/serviceapi.js and 5 other locations - About 1 hr to fix
    samples/adminpanel/app/lib/cosmos/js/serviceapi.js on lines 35..41
    samples/adminpanel/app/lib/cosmos/js/serviceapi.js on lines 43..50
    samples/adminpanel/app/lib/cosmos/js/serviceapi.js on lines 76..83
    samples/simple/app/serviceapi.js on lines 43..50
    samples/simple/app/serviceapi.js on lines 76..83

    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

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

    function updateItem(){
        var name = jQuery("#name").val();
        var data = jQuery("#data").val();
    
        var url =  getServiceUrl(name);
    Severity: Major
    Found in samples/simple/app/serviceapi.js and 5 other locations - About 1 hr to fix
    samples/adminpanel/app/lib/cosmos/js/serviceapi.js on lines 35..41
    samples/adminpanel/app/lib/cosmos/js/serviceapi.js on lines 43..50
    samples/adminpanel/app/lib/cosmos/js/serviceapi.js on lines 76..83
    samples/simple/app/serviceapi.js on lines 35..41
    samples/simple/app/serviceapi.js on lines 43..50

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 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

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

    function deleteItem(){
        var name = jQuery("#name").val();
        var data = jQuery("#data").val();
    
        var url =  getServiceUrl(name);
    Severity: Major
    Found in samples/simple/app/serviceapi.js and 5 other locations - About 1 hr to fix
    samples/adminpanel/app/lib/cosmos/js/serviceapi.js on lines 35..41
    samples/adminpanel/app/lib/cosmos/js/serviceapi.js on lines 43..50
    samples/adminpanel/app/lib/cosmos/js/serviceapi.js on lines 76..83
    samples/simple/app/serviceapi.js on lines 35..41
    samples/simple/app/serviceapi.js on lines 76..83

    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

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

    function getServiceUrl(service) {
        var root = document.URL;
        if(service[0] == '/'){
            service = service.substring(1);
        }
    Severity: Major
    Found in samples/simple/app/serviceapi.js and 1 other location - About 1 hr to fix
    samples/adminpanel/app/lib/cosmos/js/serviceapi.js on lines 14..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 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

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

    function processSuccess(data){
        var data2 = JSON.parse(data);
        jQuery("#result").val(JSON.stringify(data2,undefined, 2));
    }
    Severity: Minor
    Found in samples/simple/app/serviceapi.js and 1 other location - About 40 mins to fix
    samples/adminpanel/app/lib/cosmos/js/serviceapi.js on lines 9..12

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

    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