netdata/netdata

View on GitHub
src/web/gui/src/dashboard.js/units-conversion.js

Summary

Maintainability
F
3 wks
Test Coverage

Function get has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
Open

    get: function (uuid, min, max, units, desired_units, common_units_name, switch_units_callback) {
        // validate the parameters
        if (typeof units === 'undefined') {
            units = 'undefined';
        }
Severity: Minor
Found in src/web/gui/src/dashboard.js/units-conversion.js - About 1 day 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

File units-conversion.js has 399 lines of code (exceeds 250 allowed). Consider refactoring.
Open

NETDATA.unitsConversion = {
    keys: {},       // keys for data-common-units
    latest: {},     // latest selected units for data-common-units

    globalReset: function () {
Severity: Minor
Found in src/web/gui/src/dashboard.js/units-conversion.js - About 5 hrs to fix

    Function get has 124 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        get: function (uuid, min, max, units, desired_units, common_units_name, switch_units_callback) {
            // validate the parameters
            if (typeof units === 'undefined') {
                units = 'undefined';
            }
    Severity: Major
    Found in src/web/gui/src/dashboard.js/units-conversion.js - About 4 hrs to fix

      Function get has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          get: function (uuid, min, max, units, desired_units, common_units_name, switch_units_callback) {
      Severity: Major
      Found in src/web/gui/src/dashboard.js/units-conversion.js - About 50 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if (this.convertibleUnits[units].hasOwnProperty(x)) {
                                if (this.convertibleUnits[units][x].check(max)) {
                                    //console.log('DEBUG: ' + uuid.toString() + ' converting ' + units.toString() + ' to: ' + x.toString());
                                    switch_units_callback(x);
                                    return this.convertibleUnits[units][x].convert;
        Severity: Major
        Found in src/web/gui/src/dashboard.js/units-conversion.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if (t.hasOwnProperty(x) && t[x].divider > common_units.divider) {
                                      common_units = t[x];
                                  }
          Severity: Major
          Found in src/web/gui/src/dashboard.js/units-conversion.js - About 45 mins to fix

            Avoid too many return statements within this function.
            Open

                                return function (value) {
                                    return value / tdivider;
                                };
            Severity: Major
            Found in src/web/gui/src/dashboard.js/units-conversion.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return function (value) {
                              return value;
                          };
              Severity: Major
              Found in src/web/gui/src/dashboard.js/units-conversion.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                    return function (value) {
                                        return value;
                                    };
                Severity: Major
                Found in src/web/gui/src/dashboard.js/units-conversion.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                      return function (value) {
                                          return value / tdivider;
                                      };
                  Severity: Major
                  Found in src/web/gui/src/dashboard.js/units-conversion.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return function (value) {
                                        return value;
                                    };
                    Severity: Major
                    Found in src/web/gui/src/dashboard.js/units-conversion.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                                  return this.convertibleUnits[units][x].convert;
                      Severity: Major
                      Found in src/web/gui/src/dashboard.js/units-conversion.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return function (value) {
                                            return value;
                                        };
                        Severity: Major
                        Found in src/web/gui/src/dashboard.js/units-conversion.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                          return this.convertibleUnits[units][desired_units].convert;
                          Severity: Major
                          Found in src/web/gui/src/dashboard.js/units-conversion.js - About 30 mins to fix

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

                                convertibleUnits: {
                                    'Celsius': {
                                        'Fahrenheit': {
                                            check: function (max) {
                                                void(max);
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/units-conversion.js and 1 other location - About 1 wk to fix
                            src/web/gui/v1/dashboard.js on lines 924..1075

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

                            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

                                get: function (uuid, min, max, units, desired_units, common_units_name, switch_units_callback) {
                                    // validate the parameters
                                    if (typeof units === 'undefined') {
                                        units = 'undefined';
                                    }
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/units-conversion.js and 1 other location - About 1 wk to fix
                            src/web/gui/v1/dashboard.js on lines 1116..1311

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

                            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

                                seconds2time: function (seconds) {
                                    seconds = Math.abs(seconds);
                            
                                    let days = Math.floor(seconds / 86400);
                                    seconds -= days * 86400;
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/units-conversion.js and 1 other location - About 1 day to fix
                            src/web/gui/v1/dashboard.js on lines 1077..1112

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

                            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

                                    'GB': {
                                        'B': 1 / (1024 * 1024 * 1024),
                                        'KB': 1 / (1024 * 1024),
                                        'MB': 1 / 1024,
                                        'GB': 1,
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/units-conversion.js and 3 other locations - About 2 hrs to fix
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 110..118
                            src/web/gui/v1/dashboard.js on lines 875..883
                            src/web/gui/v1/dashboard.js on lines 884..892

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

                            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

                                    'GiB': {
                                        'B': 1 / (1024 * 1024 * 1024),
                                        'KiB': 1 / (1024 * 1024),
                                        'MiB': 1 / 1024,
                                        'GiB': 1,
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/units-conversion.js and 3 other locations - About 2 hrs to fix
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 101..109
                            src/web/gui/v1/dashboard.js on lines 875..883
                            src/web/gui/v1/dashboard.js on lines 884..892

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

                            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

                                    'B': {
                                        'B': 1,
                                        'KiB': 1024,
                                        'MiB': 1024 * 1024,
                                        'GiB': 1024 * 1024 * 1024,
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/units-conversion.js and 1 other location - About 2 hrs to fix
                            src/web/gui/v1/dashboard.js on lines 837..844

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

                                    'MB': {
                                        'B': 1 / (1024 * 1024),
                                        'KB': 1 / 1024,
                                        'MB': 1,
                                        'GB': 1024,
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/units-conversion.js and 3 other locations - About 1 hr to fix
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 93..100
                            src/web/gui/v1/dashboard.js on lines 859..866
                            src/web/gui/v1/dashboard.js on lines 867..874

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

                            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

                                    'MiB': {
                                        'B': 1 / (1024 * 1024),
                                        'KiB': 1 / 1024,
                                        'MiB': 1,
                                        'GiB': 1024,
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/units-conversion.js and 3 other locations - About 1 hr to fix
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 85..92
                            src/web/gui/v1/dashboard.js on lines 859..866
                            src/web/gui/v1/dashboard.js on lines 867..874

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

                            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

                                    'B/s': {
                                        'B/s': 1,
                                        'KiB/s': 1024,
                                        'MiB/s': 1024 * 1024,
                                        'GiB/s': 1024 * 1024 * 1024,
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/units-conversion.js and 4 other locations - About 1 hr to fix
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 28..34
                            src/web/gui/v1/dashboard.js on lines 795..801
                            src/web/gui/v1/dashboard.js on lines 809..815
                            src/web/gui/v1/dashboard.js on lines 830..836

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

                            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

                                    'bytes/s': {
                                        'bytes/s': 1,
                                        'kilobytes/s': 1024,
                                        'megabytes/s': 1024 * 1024,
                                        'gigabytes/s': 1024 * 1024 * 1024,
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/units-conversion.js and 4 other locations - About 1 hr to fix
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 42..48
                            src/web/gui/v1/dashboard.js on lines 795..801
                            src/web/gui/v1/dashboard.js on lines 809..815
                            src/web/gui/v1/dashboard.js on lines 830..836

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

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

                                    'kilobytes/s': {
                                        'bytes/s': 1 / 1024,
                                        'kilobytes/s': 1,
                                        'megabytes/s': 1024,
                                        'gigabytes/s': 1024 * 1024,
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/units-conversion.js and 9 other locations - About 35 mins to fix
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 49..55
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 56..62
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 71..77
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 78..84
                            src/web/gui/v1/dashboard.js on lines 802..808
                            src/web/gui/v1/dashboard.js on lines 816..822
                            src/web/gui/v1/dashboard.js on lines 823..829
                            src/web/gui/v1/dashboard.js on lines 845..851
                            src/web/gui/v1/dashboard.js on lines 852..858

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

                                    'KiB': {
                                        'B': 1 / 1024,
                                        'KiB': 1,
                                        'MiB': 1024,
                                        'GiB': 1024 * 1024,
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/units-conversion.js and 9 other locations - About 35 mins to fix
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 35..41
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 49..55
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 56..62
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 71..77
                            src/web/gui/v1/dashboard.js on lines 802..808
                            src/web/gui/v1/dashboard.js on lines 816..822
                            src/web/gui/v1/dashboard.js on lines 823..829
                            src/web/gui/v1/dashboard.js on lines 845..851
                            src/web/gui/v1/dashboard.js on lines 852..858

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

                                    'KiB/s': {
                                        'B/s': 1 / 1024,
                                        'KiB/s': 1,
                                        'MiB/s': 1024,
                                        'GiB/s': 1024 * 1024,
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/units-conversion.js and 9 other locations - About 35 mins to fix
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 35..41
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 49..55
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 71..77
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 78..84
                            src/web/gui/v1/dashboard.js on lines 802..808
                            src/web/gui/v1/dashboard.js on lines 816..822
                            src/web/gui/v1/dashboard.js on lines 823..829
                            src/web/gui/v1/dashboard.js on lines 845..851
                            src/web/gui/v1/dashboard.js on lines 852..858

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

                                    'KB': {
                                        'B': 1 / 1024,
                                        'KB': 1,
                                        'MB': 1024,
                                        'GB': 1024 * 1024,
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/units-conversion.js and 9 other locations - About 35 mins to fix
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 35..41
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 49..55
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 56..62
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 78..84
                            src/web/gui/v1/dashboard.js on lines 802..808
                            src/web/gui/v1/dashboard.js on lines 816..822
                            src/web/gui/v1/dashboard.js on lines 823..829
                            src/web/gui/v1/dashboard.js on lines 845..851
                            src/web/gui/v1/dashboard.js on lines 852..858

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

                                    'KB/s': {
                                        'B/s': 1 / 1024,
                                        'KB/s': 1,
                                        'MB/s': 1024,
                                        'GB/s': 1024 * 1024,
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/units-conversion.js and 9 other locations - About 35 mins to fix
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 35..41
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 56..62
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 71..77
                            src/web/gui/src/dashboard.js/units-conversion.js on lines 78..84
                            src/web/gui/v1/dashboard.js on lines 802..808
                            src/web/gui/v1/dashboard.js on lines 816..822
                            src/web/gui/v1/dashboard.js on lines 823..829
                            src/web/gui/v1/dashboard.js on lines 845..851
                            src/web/gui/v1/dashboard.js on lines 852..858

                            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