gboudreau/Greyhole

View on GitHub
web-app/scripts.js

Summary

Maintainability
F
2 wks
Test Coverage

File scripts.js has 1209 lines of code (exceeds 250 allowed). Consider refactoring.
Open


window.chartColors = {
    red: 'rgba(222, 66, 91, 1)',
    orange: 'rgba(255, 159, 64, 1)',
    yellow: 'rgba(255, 236, 152, 1)',
Severity: Major
Found in web-app/scripts.js - About 3 days to fix

    Function loadStatusBalanceReport has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    function loadStatusBalanceReport() {
        let $container = $('#balance_groups');
        $.ajax({
            type: 'POST',
            url: './?ajax=get_status_balance_report',
    Severity: Minor
    Found in web-app/scripts.js - About 4 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function drawPieChartStorage has 101 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function drawPieChartStorage(ctx, stats) {
        let dataset_used = [];
        let dataset_trash = [];
        let dataset_free = [];
        let drives = [];
    Severity: Major
    Found in web-app/scripts.js - About 4 hrs to fix

      Function loadStatusQueue has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      function loadStatusQueue() {
          var $table = $('#queue');
          var $loading_row = $table.find('.loading');
          $loading_row.show();
          $.ajax({
      Severity: Minor
      Found in web-app/scripts.js - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function drawTreeMapDiskUsage has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function drawTreeMapDiskUsage(ctx, du_stats) {
          let dataset = [];
          let paths = [];
          let max = 0, min = null;
      
      
      Severity: Major
      Found in web-app/scripts.js - About 2 hrs to fix

        Function ajax_value_changed has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        function ajax_value_changed($el, name, value, success) {
            // console.log(name + " = " + value);
            $.ajax({
                type: 'POST',
                url: './?ajax=config',
        Severity: Minor
        Found in web-app/scripts.js - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function loadStatusBalanceReport has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function loadStatusBalanceReport() {
            let $container = $('#balance_groups');
            $.ajax({
                type: 'POST',
                url: './?ajax=get_status_balance_report',
        Severity: Major
        Found in web-app/scripts.js - About 2 hrs to fix

          Function success has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  success: function(data, textStatus, jqXHR) {
                      if (data.result === 'success') {
                          if (data.show_stop_button) {
                              $('#cancel_balance_container').show();
                          } else {
          Severity: Major
          Found in web-app/scripts.js - About 2 hrs to fix

            Function drawPieChartDiskUsage has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function drawPieChartDiskUsage(ctx, du_stats) {
                let dataset = [];
                let labels = [];
                let colors = [];
                let paths = [];
            Severity: Major
            Found in web-app/scripts.js - About 2 hrs to fix

              Function loadStatusLogs has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

              function loadStatusLogs() {
                  if (!('page' in urlParams) || urlParams.page === 'id_l1_status_tab') {
                      loadStatus();
                  }
                  if (!('page_status' in urlParams) || urlParams.page_status === 'id_l2_status_balance_tab') {
              Severity: Minor
              Found in web-app/scripts.js - About 2 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function loadStoragePool has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function loadStoragePool() {
                  $.ajax({
                      type: 'POST',
                      url: './?ajax=get_storage_pool',
                      success: function(data, textStatus, jqXHR) {
              Severity: Minor
              Found in web-app/scripts.js - About 1 hr to fix

                Function loadStoragePool has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                function loadStoragePool() {
                    $.ajax({
                        type: 'POST',
                        url: './?ajax=get_storage_pool',
                        success: function(data, textStatus, jqXHR) {
                Severity: Minor
                Found in web-app/scripts.js - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function loadStatus has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                function loadStatus() {
                    $.ajax({
                        type: 'POST',
                        url: './?ajax=get_status',
                        success: function(data, textStatus, jqXHR) {
                Severity: Minor
                Found in web-app/scripts.js - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function success has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        success: function(data, textStatus, jqXHR) {
                            if (data.result === 'success') {
                                let $table = $('#table-sp tbody').text('');
                                for (let sp_drive in data.sp_stats) {
                                    if (sp_drive === 'Total') {
                Severity: Minor
                Found in web-app/scripts.js - About 1 hr to fix

                  Function confirmRemoveDrive has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function confirmRemoveDrive() {
                      let drive = $('#inputremove_drive').val();
                      if (drive === '0') {
                          alert('meh!');
                          return;
                  Severity: Minor
                  Found in web-app/scripts.js - About 1 hr to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function loadStatusQueue has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function loadStatusQueue() {
                      var $table = $('#queue');
                      var $loading_row = $table.find('.loading');
                      $loading_row.show();
                      $.ajax({
                  Severity: Minor
                  Found in web-app/scripts.js - About 1 hr to fix

                    Function loadStatusLogs has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function loadStatusLogs() {
                        if (!('page' in urlParams) || urlParams.page === 'id_l1_status_tab') {
                            loadStatus();
                        }
                        if (!('page_status' in urlParams) || urlParams.page_status === 'id_l2_status_balance_tab') {
                    Severity: Minor
                    Found in web-app/scripts.js - About 1 hr to fix

                      Function getTreemapColor has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function getTreemapColor(value, min, max) {
                          value = parseInt(value);
                          min = parseInt(min);
                          max = parseInt(max);
                      
                      
                      Severity: Minor
                      Found in web-app/scripts.js - About 1 hr to fix

                        Function ajax_value_changed has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function ajax_value_changed($el, name, value, success) {
                            // console.log(name + " = " + value);
                            $.ajax({
                                type: 'POST',
                                url: './?ajax=config',
                        Severity: Minor
                        Found in web-app/scripts.js - About 1 hr to fix

                          Function loadStatusFsckReport has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function loadStatusFsckReport() {
                              $('#fsck-report-code').text('Loading...');
                              $.ajax({
                                  type: 'POST',
                                  url: './?ajax=get_status_fsck_report',
                          Severity: Minor
                          Found in web-app/scripts.js - About 1 hr to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function toggleSambaShareGreyholeEnabled has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function toggleSambaShareGreyholeEnabled(el) {
                              let $el = $(el);
                              let name = $el.attr('name');
                              let value = $el.val();
                              let share_name = $el.data('sharename')
                          Severity: Minor
                          Found in web-app/scripts.js - About 1 hr to fix

                            Function confirmRemoveDrive has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function confirmRemoveDrive() {
                                let drive = $('#inputremove_drive').val();
                                if (drive === '0') {
                                    alert('meh!');
                                    return;
                            Severity: Minor
                            Found in web-app/scripts.js - About 1 hr to fix

                              Function changedTab has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function changedTab(el, first, replace) {
                                  if (skip_changed_tab_event) {
                                      skip_changed_tab_event = false;
                                      return;
                                  }
                              Severity: Minor
                              Found in web-app/scripts.js - About 1 hr to fix

                                Function loadActionsTrashContent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function loadActionsTrashContent() {
                                    var $table = $('#trash-content');
                                    var $loading_row = $table.find('.loading');
                                    $loading_row.show();
                                    $.ajax({
                                Severity: Minor
                                Found in web-app/scripts.js - About 1 hr to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Function drawPieChartStorage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function drawPieChartStorage(ctx, stats) {
                                    let dataset_used = [];
                                    let dataset_trash = [];
                                    let dataset_free = [];
                                    let drives = [];
                                Severity: Minor
                                Found in web-app/scripts.js - About 1 hr to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Function ajaxCallFromButton has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function ajaxCallFromButton(button, ajax_action, data, onbusy_btn_text, onsuccess_btn_text, final_btn_text, onsuccess, onsuccess_delay) {
                                    let $button = $(button);
                                    let original_btn_text = $button.text();
                                    $button.text(onbusy_btn_text).prop('disabled', true);
                                    $.ajax({
                                Severity: Minor
                                Found in web-app/scripts.js - About 1 hr to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

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

                                function ajaxCallFromButton(button, ajax_action, data, onbusy_btn_text, onsuccess_btn_text, final_btn_text, onsuccess, onsuccess_delay) {
                                    let $button = $(button);
                                    let original_btn_text = $button.text();
                                    $button.text(onbusy_btn_text).prop('disabled', true);
                                    $.ajax({
                                Severity: Minor
                                Found in web-app/scripts.js - About 1 hr to fix

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

                                          success: function(data, textStatus, jqXHR) {
                                              if (data.result === 'success') {
                                                  $table.find('tr:not(.loading):not(.header)').detach();
                                                  for (let row of data.rows) {
                                                      let $tr = $('<tr/>');
                                  Severity: Minor
                                  Found in web-app/scripts.js - About 1 hr to fix

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

                                    function loadActionsTrashContent() {
                                        var $table = $('#trash-content');
                                        var $loading_row = $table.find('.loading');
                                        $loading_row.show();
                                        $.ajax({
                                    Severity: Minor
                                    Found in web-app/scripts.js - About 1 hr to fix

                                      Function ajaxCallFromButton has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                      function ajaxCallFromButton(button, ajax_action, data, onbusy_btn_text, onsuccess_btn_text, final_btn_text, onsuccess, onsuccess_delay) {
                                      Severity: Major
                                      Found in web-app/scripts.js - About 1 hr to fix

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

                                        function get_forced_groups_config() {
                                            if ($('[name="drive_selection_algorithm_forced"]:checked').val() === 'no') {
                                                $('.forced_toggleable').closest('.form-group').hide();
                                                return $('[name="drive_selection_algorithm"]:checked').val();
                                            }
                                        Severity: Minor
                                        Found in web-app/scripts.js - About 55 mins to fix

                                        Cognitive Complexity

                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                        A method's cognitive complexity is based on a few simple rules:

                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                        • Code is considered more complex for each "break in the linear flow of the code"
                                        • Code is considered more complex when "flow breaking structures are nested"

                                        Further reading

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

                                        function drawTreeMapDiskUsage(ctx, du_stats) {
                                            let dataset = [];
                                            let paths = [];
                                            let max = 0, min = null;
                                        
                                        
                                        Severity: Minor
                                        Found in web-app/scripts.js - About 55 mins to fix

                                        Cognitive Complexity

                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                        A method's cognitive complexity is based on a few simple rules:

                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                        • Code is considered more complex for each "break in the linear flow of the code"
                                        • Code is considered more complex when "flow breaking structures are nested"

                                        Further reading

                                        Function bytes_to_human has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        function bytes_to_human(bytes) {
                                            let units = 'B';
                                            if (Math.abs(bytes) > 1024) {
                                                bytes /= 1024;
                                                units = 'KiB';
                                        Severity: Minor
                                        Found in web-app/scripts.js - About 35 mins to fix

                                        Cognitive Complexity

                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                        A method's cognitive complexity is based on a few simple rules:

                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                        • Code is considered more complex for each "break in the linear flow of the code"
                                        • Code is considered more complex when "flow breaking structures are nested"

                                        Further reading

                                        Function confirmFsckCommand has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        function confirmFsckCommand() {
                                            let params = getFsckParams();
                                            let command = "greyhole --fsck ";
                                            for (let k in params) {
                                                let v = params[k];
                                        Severity: Minor
                                        Found in web-app/scripts.js - About 35 mins to fix

                                        Cognitive Complexity

                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                        A method's cognitive complexity is based on a few simple rules:

                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                        • Code is considered more complex for each "break in the linear flow of the code"
                                        • Code is considered more complex when "flow breaking structures are nested"

                                        Further reading

                                        Function changedTab has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        function changedTab(el, first, replace) {
                                            if (skip_changed_tab_event) {
                                                skip_changed_tab_event = false;
                                                return;
                                            }
                                        Severity: Minor
                                        Found in web-app/scripts.js - About 25 mins to fix

                                        Cognitive Complexity

                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                        A method's cognitive complexity is based on a few simple rules:

                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                        • Code is considered more complex for each "break in the linear flow of the code"
                                        • Code is considered more complex when "flow breaking structures are nested"

                                        Further reading

                                        Function getTreemapColor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        function getTreemapColor(value, min, max) {
                                            value = parseInt(value);
                                            min = parseInt(min);
                                            max = parseInt(max);
                                        
                                        
                                        Severity: Minor
                                        Found in web-app/scripts.js - About 25 mins to fix

                                        Cognitive Complexity

                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                        A method's cognitive complexity is based on a few simple rules:

                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                        • Code is considered more complex for each "break in the linear flow of the code"
                                        • Code is considered more complex when "flow breaking structures are nested"

                                        Further reading

                                        Function getFsckParams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        function getFsckParams() {
                                            let params = {};
                                            let s = $('#id_l2_actions_fsck').find('input, select').serialize();
                                            let parsedParams = parseParams(s);
                                            for (let name in parsedParams) {
                                        Severity: Minor
                                        Found in web-app/scripts.js - About 25 mins to fix

                                        Cognitive Complexity

                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                        A method's cognitive complexity is based on a few simple rules:

                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                        • Code is considered more complex for each "break in the linear flow of the code"
                                        • Code is considered more complex when "flow breaking structures are nested"

                                        Further reading

                                        Function toggleSambaShareGreyholeEnabled has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        function toggleSambaShareGreyholeEnabled(el) {
                                            let $el = $(el);
                                            let name = $el.attr('name');
                                            let value = $el.val();
                                            let share_name = $el.data('sharename')
                                        Severity: Minor
                                        Found in web-app/scripts.js - About 25 mins to fix

                                        Cognitive Complexity

                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                        A method's cognitive complexity is based on a few simple rules:

                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                        • Code is considered more complex for each "break in the linear flow of the code"
                                        • Code is considered more complex when "flow breaking structures are nested"

                                        Further reading

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

                                        function trashmanDelete(btn) {
                                            let $row = $(btn).closest('tr');
                                            let folder = $('#trashman-current-dir').val() + '/' + $row.data('path');
                                            folder = folder.substring(2);
                                        
                                        
                                        Severity: Major
                                        Found in web-app/scripts.js and 1 other location - About 7 hrs to fix
                                        web-app/scripts.js on lines 177..188

                                        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

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

                                        function trashmanRestore(btn) {
                                            let $row = $(btn).closest('tr');
                                            let folder = $('#trashman-current-dir').val() + '/' + $row.data('path');
                                            folder = folder.substring(2);
                                        
                                        
                                        Severity: Major
                                        Found in web-app/scripts.js and 1 other location - About 7 hrs to fix
                                        web-app/scripts.js on lines 155..166

                                        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

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

                                        function trashmanConfirmDelete(btn) {
                                            let folder = $(btn).data('folder');
                                            ajaxCallFromButton(btn, 'delete_from_trash', 'folder=' + encodeURIComponent(folder), 'Deleting...', 'Deleted', 'Delete forever', function (data, $button) {
                                                $(btn).closest('.modal').modal('hide');
                                                let dir = $('#trashman-current-dir').val();
                                        Severity: Major
                                        Found in web-app/scripts.js and 1 other location - About 3 hrs to fix
                                        web-app/scripts.js on lines 190..197

                                        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

                                        function trashmanConfirmRestore(btn) {
                                            let folder = $(btn).data('folder');
                                            ajaxCallFromButton(btn, 'restore_from_trash', 'folder=' + encodeURIComponent(folder), 'Restoring...', 'Restored', 'Restore', function (data, $button) {
                                                $(btn).closest('.modal').modal('hide');
                                                let dir = $('#trashman-current-dir').val();
                                        Severity: Major
                                        Found in web-app/scripts.js and 1 other location - About 3 hrs to fix
                                        web-app/scripts.js on lines 168..175

                                        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

                                            } else {
                                                $('[name=' + $.escapeSelector('smb.conf:[global]unix_extensions') + ']').parent('label').removeClass('btn-outline-danger').addClass('btn-outline-primary');
                                                $('[name=' + $.escapeSelector('smb.conf:[global]allow_insecure_wide_links') + ']').parent('label').removeClass('btn-outline-danger').addClass('btn-outline-primary');
                                            }
                                        Severity: Major
                                        Found in web-app/scripts.js and 1 other location - About 3 hrs to fix
                                        web-app/scripts.js on lines 859..862

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

                                        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 (unix_extensions_config === 'yes' && allow_insecure_wide_links_config === 'no') {
                                                $('[name=' + $.escapeSelector('smb.conf:[global]unix_extensions') + ']').parent('label').removeClass('btn-outline-primary').addClass('btn-outline-danger');
                                                $('[name=' + $.escapeSelector('smb.conf:[global]allow_insecure_wide_links') + ']').parent('label').removeClass('btn-outline-primary').addClass('btn-outline-danger');
                                            } else {
                                        Severity: Major
                                        Found in web-app/scripts.js and 1 other location - About 3 hrs to fix
                                        web-app/scripts.js on lines 862..865

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

                                        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

                                                            $td.append(
                                                                $('<div/>').addClass('sp-bar used')
                                                                    .data('width', drive_infos.used_width)
                                                                    .data('toggle', 'tooltip').data('placement', 'bottom').prop('title', drive_infos.used_tooltip).tooltip()
                                                            );
                                        Severity: Major
                                        Found in web-app/scripts.js and 3 other locations - About 1 hr to fix
                                        web-app/scripts.js on lines 1212..1219
                                        web-app/scripts.js on lines 1275..1279
                                        web-app/scripts.js on lines 1280..1284

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

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

                                            for (let i in dataset_free) {
                                                let v = dataset_free[i];
                                                labels_all_drives.push(drives[i] + " Free: " + bytes_to_human(v * 1024));
                                                colors_all_drives.push(window.chartColorsSemi.green);
                                            }
                                        Severity: Major
                                        Found in web-app/scripts.js and 2 other locations - About 1 hr to fix
                                        web-app/scripts.js on lines 444..448
                                        web-app/scripts.js on lines 449..453

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

                                        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

                                                            $td.append(
                                                                $('<div/>').addClass('sp-bar free')
                                                                    .data('width', drive_infos.free_width)
                                                                    .data('toggle', 'tooltip').data('placement', 'bottom').prop('title', drive_infos.free_tooltip).tooltip()
                                                            );
                                        Severity: Major
                                        Found in web-app/scripts.js and 3 other locations - About 1 hr to fix
                                        web-app/scripts.js on lines 1212..1219
                                        web-app/scripts.js on lines 1270..1274
                                        web-app/scripts.js on lines 1275..1279

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

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

                                            for (let i in dataset_used) {
                                                let v = dataset_used[i];
                                                labels_all_drives.push(drives[i] + " Used: " + bytes_to_human(v * 1024));
                                                colors_all_drives.push(window.chartColorsSemi.red);
                                            }
                                        Severity: Major
                                        Found in web-app/scripts.js and 2 other locations - About 1 hr to fix
                                        web-app/scripts.js on lines 449..453
                                        web-app/scripts.js on lines 454..458

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

                                        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

                                                            $td.append(
                                                                $('<div/>').addClass('sp-bar trash')
                                                                    .data('width', drive_infos.trash_width)
                                                                    .data('toggle', 'tooltip').data('placement', 'bottom').prop('title', drive_infos.trash_tooltip).tooltip()
                                                            );
                                        Severity: Major
                                        Found in web-app/scripts.js and 3 other locations - About 1 hr to fix
                                        web-app/scripts.js on lines 1212..1219
                                        web-app/scripts.js on lines 1270..1274
                                        web-app/scripts.js on lines 1280..1284

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

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

                                            for (let i in dataset_trash) {
                                                let v = dataset_trash[i];
                                                labels_all_drives.push(drives[i] + " Trash: " + bytes_to_human(v * 1024));
                                                colors_all_drives.push(window.chartColorsSemi.yellow);
                                            }
                                        Severity: Major
                                        Found in web-app/scripts.js and 2 other locations - About 1 hr to fix
                                        web-app/scripts.js on lines 444..448
                                        web-app/scripts.js on lines 454..458

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

                                        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

                                                                $td.append(
                                                                    $('<div/>').addClass('sp-bar target has_tooltip')
                                                                        .data('width', drive_infos.target_width)
                                                                        .data('toggle', 'tooltip')
                                                                        .data('placement', 'bottom')
                                        Severity: Major
                                        Found in web-app/scripts.js and 3 other locations - About 1 hr to fix
                                        web-app/scripts.js on lines 1270..1274
                                        web-app/scripts.js on lines 1275..1279
                                        web-app/scripts.js on lines 1280..1284

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

                                        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 (data.drive_is_available) {
                                                            $('[name=drive_is_available][value=yes]').prop('checked', true).parent().addClass('active');
                                                            $('[name=drive_is_available][value=no]').prop('checked', false).parent().removeClass('active');
                                                        } else {
                                        Severity: Major
                                        Found in web-app/scripts.js and 1 other location - About 1 hr to fix
                                        web-app/scripts.js on lines 922..925

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

                                                        } else {
                                                            $('[name=drive_is_available][value=no]').prop('checked', true).parent().addClass('active');
                                                            $('[name=drive_is_available][value=yes]').prop('checked', false).parent().removeClass('active');
                                                        }
                                        Severity: Major
                                        Found in web-app/scripts.js and 1 other location - About 1 hr to fix
                                        web-app/scripts.js on lines 919..922

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

                                        function restartSamba(button) {
                                            ajaxCallFromButton(button, 'samba', 'action=restart', 'Restarting...', 'Restarted', 'Restart', function (data, $button) {
                                                last_known_config_hash_samba = data.config_hash_samba;
                                                $('#needs-samba-restart').hide();
                                            }, 3);
                                        Severity: Major
                                        Found in web-app/scripts.js and 1 other location - About 1 hr to fix
                                        web-app/scripts.js on lines 364..369

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

                                        function restartDaemon(button) {
                                            ajaxCallFromButton(button, 'daemon', 'action=restart', 'Restarting...', 'Restarted', 'Restart', function (data, $button) {
                                                last_known_config_hash = data.config_hash;
                                                $('#needs-daemon-restart').hide();
                                            }, 3);
                                        Severity: Major
                                        Found in web-app/scripts.js and 1 other location - About 1 hr to fix
                                        web-app/scripts.js on lines 371..376

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

                                        function startBalance(button) {
                                            ajaxCallFromButton(button, 'balance', 'action=start', 'Starting...', 'Balance started', 'Reloading...', function (data, $button) {
                                                $button.prop('disabled', true);
                                                location.href = './';
                                            }, 3);
                                        Severity: Major
                                        Found in web-app/scripts.js and 2 other locations - About 55 mins to fix
                                        web-app/scripts.js on lines 974..979
                                        web-app/scripts.js on lines 988..993

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

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

                                        function cancelFsck(button) {
                                            ajaxCallFromButton(button, 'fsck', 'action=cancel', 'Cancelling...', 'fsck Cancelled', 'Reloading...', function (data, $button) {
                                                $button.prop('disabled', true);
                                                location.href = './';
                                            }, 3);
                                        Severity: Major
                                        Found in web-app/scripts.js and 2 other locations - About 55 mins to fix
                                        web-app/scripts.js on lines 981..986
                                        web-app/scripts.js on lines 988..993

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

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

                                        function cancelBalance(button) {
                                            ajaxCallFromButton(button, 'balance', 'action=cancel', 'Cancelling...', 'Balance cancelled', 'Reloading...', function (data, $button) {
                                                $button.prop('disabled', true);
                                                location.href = './';
                                            }, 3);
                                        Severity: Major
                                        Found in web-app/scripts.js and 2 other locations - About 55 mins to fix
                                        web-app/scripts.js on lines 974..979
                                        web-app/scripts.js on lines 981..986

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

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

                                        function resumeDaemon(button) {
                                            ajaxCallFromButton(button, 'pause', 'action=resume', 'Resuming...', 'Daemon resumed', 'Reloading...', function (data, $button) {
                                                $button.prop('disabled', true);
                                                location.reload();
                                            }, 3);
                                        Severity: Major
                                        Found in web-app/scripts.js and 2 other locations - About 50 mins to fix
                                        web-app/scripts.js on lines 995..1000
                                        web-app/scripts.js on lines 1020..1025

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

                                        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

                                                            $el.attr('data-toggle', 'tooltip').attr('data-placement', 'bottom').attr('title', 'New value saved').tooltip({trigger: 'manual'}).tooltip('show');
                                        Severity: Minor
                                        Found in web-app/scripts.js and 1 other location - About 50 mins to fix
                                        web-app/scripts.js on lines 843..843

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

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

                                        function emptyTrash(button) {
                                            ajaxCallFromButton(button, 'trash', 'action=empty', 'Emptying...', 'Trash emptied', 'Reloading...', function (data, $button) {
                                                $button.prop('disabled', true);
                                                location.reload();
                                            }, 3);
                                        Severity: Major
                                        Found in web-app/scripts.js and 2 other locations - About 50 mins to fix
                                        web-app/scripts.js on lines 1020..1025
                                        web-app/scripts.js on lines 1027..1032

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

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

                                        function pauseDaemon(button) {
                                            ajaxCallFromButton(button, 'pause', 'action=pause', 'Pausing...', 'Daemon paused', 'Reloading...', function (data, $button) {
                                                $button.prop('disabled', true);
                                                location.reload();
                                            }, 3);
                                        Severity: Major
                                        Found in web-app/scripts.js and 2 other locations - About 50 mins to fix
                                        web-app/scripts.js on lines 995..1000
                                        web-app/scripts.js on lines 1027..1032

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

                                        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

                                                    $el.attr('data-toggle', 'tooltip').attr('data-placement', 'bottom').attr('title', 'Thank you!').tooltip({trigger: 'manual'}).tooltip('show');
                                        Severity: Minor
                                        Found in web-app/scripts.js and 1 other location - About 50 mins to fix
                                        web-app/scripts.js on lines 306..306

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

                                        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

                                            } else {
                                                $('[name=' + $.escapeSelector('smb.conf:[global]wide_links') + ']').parent('label').removeClass('btn-outline-danger').addClass('btn-outline-primary');
                                            }
                                        Severity: Minor
                                        Found in web-app/scripts.js and 1 other location - About 45 mins to fix
                                        web-app/scripts.js on lines 851..853

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

                                        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 (wide_link_config === 'no') {
                                                $('[name=' + $.escapeSelector('smb.conf:[global]wide_links') + ']').parent('label').removeClass('btn-outline-primary').addClass('btn-outline-danger');
                                            } else {
                                        Severity: Minor
                                        Found in web-app/scripts.js and 1 other location - About 45 mins to fix
                                        web-app/scripts.js on lines 853..855

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

                                        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 (data.config_hash_samba === last_known_config_hash_samba) {
                                                            $('#needs-samba-restart').hide();
                                                        } else {
                                                            $('#needs-samba-restart').show();
                                                        }
                                        Severity: Minor
                                        Found in web-app/scripts.js and 1 other location - About 35 mins to fix
                                        web-app/scripts.js on lines 310..314

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

                                                        if (data.config_hash === last_known_config_hash) {
                                                            $('#needs-daemon-restart').hide();
                                                        } else {
                                                            $('#needs-daemon-restart').show();
                                                        }
                                        Severity: Minor
                                        Found in web-app/scripts.js and 1 other location - About 35 mins to fix
                                        web-app/scripts.js on lines 315..319

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

                                        window.chartColors = {
                                            red: 'rgba(222, 66, 91, 1)',
                                            orange: 'rgba(255, 159, 64, 1)',
                                            yellow: 'rgba(255, 236, 152, 1)',
                                            green: 'rgba(72, 143, 49, 1)',
                                        Severity: Minor
                                        Found in web-app/scripts.js and 1 other location - About 35 mins to fix
                                        web-app/scripts.js on lines 11..19

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

                                        window.chartColorsSemi = {
                                            red: 'rgba(222, 66, 91, 0.6)',
                                            orange: 'rgba(255, 159, 64, 0.6)',
                                            yellow: 'rgba(255, 236, 152, 0.6)',
                                            green: 'rgba(72, 143, 49, 0.6)',
                                        Severity: Minor
                                        Found in web-app/scripts.js and 1 other location - About 35 mins to fix
                                        web-app/scripts.js on lines 2..10

                                        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