Gandi/hieraviz

View on GitHub
app/public/js/nodes.js

Summary

Maintainability
F
3 days
Test Coverage

Function build_hierarchy has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function build_hierarchy(top, node) {
    var hierarchy = document.createElement('div');
    hierarchy.className = 'hierarchy';
    top.insertBefore(hierarchy, top.firstChild);
    fetch('/v1/' + base + '/node/' + node + '/hierarchy', auth_header()).
Severity: Major
Found in app/public/js/nodes.js - About 3 hrs to fix

    File nodes.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* 
    We don't need jQuery fat mama
    http://youmightnotneedjquery.com/
    https://github.com/oneuijs/You-Dont-Need-jQuery
    
    
    Severity: Minor
    Found in app/public/js/nodes.js - About 3 hrs to fix

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

        function build_line(top, file, key, value, overriden) {
      Severity: Minor
      Found in app/public/js/nodes.js - About 35 mins to fix

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

            info: function(node) {
              start_wait(meat);
              fetch('/v1/' + base + '/node/' + node + '/info', auth_header()).
                then(res => res.json()).
                then(j => {
        Severity: Major
        Found in app/public/js/nodes.js and 1 other location - About 7 hrs to fix
        app/public/js/nodes.js on lines 310..327

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

        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

            allparams: function(node) {
              start_wait(meat);
              fetch('/v1/' + base + '/node/' + node + '/allparams', auth_header()).
                then(res => res.json()).
                then(j => {
        Severity: Major
        Found in app/public/js/nodes.js and 1 other location - About 7 hrs to fix
        app/public/js/nodes.js on lines 291..308

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

        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

            fetch(req, auth_header()).
              then(res => res.json()).
              then(j => {
                if (j.error !== undefined) {
                  show_error(hierachy, j['error']);
        Severity: Major
        Found in app/public/js/nodes.js and 1 other location - About 2 hrs to fix
        app/public/js/nodes.js on lines 93..101

        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

            fetch(req, auth_header()).
              then(res => res.json()).
              then(j => {
                if (j.error !== undefined) {
                  show_error(hierachy, j['error']);
        Severity: Major
        Found in app/public/js/nodes.js and 1 other location - About 2 hrs to fix
        app/public/js/nodes.js on lines 118..126

        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

                  Array.prototype.forEach.call(Object.keys(j.files), (item, k) => {
                    addTo(nodefiles, "<div>"+j.files[item]+"</div>");
                  });
        Severity: Major
        Found in app/public/js/nodes.js and 1 other location - About 1 hr to fix
        app/public/js/nodes.js on lines 145..147

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

        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

                  Array.prototype.forEach.call(Object.keys(j.hiera), (item, k) => {
                    addTo(hierafiles, "<div>"+j.hiera[item]+"</div>");
                  });
        Severity: Major
        Found in app/public/js/nodes.js and 1 other location - About 1 hr to fix
        app/public/js/nodes.js on lines 230..232

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

        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

              fetch('/v1/' + base + '/node/' + node, auth_header()).
                then(res => res.json()).
                then(j => {
                  // console.log(auth_header().headers.getAll('x-auth'));
                  build_top(node);
        Severity: Minor
        Found in app/public/js/nodes.js and 1 other location - About 30 mins to fix
        app/public/js/farms.js on lines 55..69

        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

        There are no issues that match your filters.

        Category
        Status