SysMO-DB/seek

View on GitHub
app/assets/javascripts/spreadsheet_explorer.js

Summary

Maintainability
F
4 days
Test Coverage

File spreadsheet_explorer.js has 542 lines of code (exceeds 250 allowed). Consider refactoring.
Open

function annotation_source(id, type, name, url) {
    this.id = id;
    this.type = type;
    this.name = name;
    this.url = url;
Severity: Major
Found in app/assets/javascripts/spreadsheet_explorer.js - About 1 day to fix

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

    function changeRowsPerPage(){
        var current_href = window.location.href;
        if (current_href.endsWith('#'))
            current_href = current_href.substring(0,current_href.length-1);
    
    
    Severity: Minor
    Found in app/assets/javascripts/spreadsheet_explorer.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 select_cells has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function select_cells(startCol, startRow, endCol, endRow, sheetNumber) {
        var minRow = startRow;
        var minCol = startCol;
        var maxRow = endRow;
        var maxCol = endCol;
    Severity: Minor
    Found in app/assets/javascripts/spreadsheet_explorer.js - About 1 hr to fix

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

      function activateSheet(sheet, sheetTab) {
          if (sheetTab == null) {
              var i = sheet - 1;
              sheetTab = $j("a.sheet_tab:eq(" + i + ")");
          }
      Severity: Minor
      Found in app/assets/javascripts/spreadsheet_explorer.js - About 1 hr to fix

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

        function goToSheetPage(annotation){
            var paginateForSheet = $('paginate_sheet_' + (annotation.sheetNumber+1));
            if (paginateForSheet != null)
            {
                //calculate the page
        Severity: Minor
        Found in app/assets/javascripts/spreadsheet_explorer.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 changeRowsPerPage has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function changeRowsPerPage(){
            var current_href = window.location.href;
            if (current_href.endsWith('#'))
                current_href = current_href.substring(0,current_href.length-1);
        
        
        Severity: Minor
        Found in app/assets/javascripts/spreadsheet_explorer.js - About 1 hr to fix

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

          function relativeRows(minRow, maxRow, sheetNumber){
              var current_page = null;
              if (sheetNumber != null)
                  current_page = currentPage(sheetNumber);
          
          
          Severity: Minor
          Found in app/assets/javascripts/spreadsheet_explorer.js - About 1 hr to fix

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

            function relativeRows(minRow, maxRow, sheetNumber){
                var current_page = null;
                if (sheetNumber != null)
                    current_page = currentPage(sheetNumber);
            
            
            Severity: Minor
            Found in app/assets/javascripts/spreadsheet_explorer.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 annotation has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function annotation(id, type, sheet_number, cell_range, content, date_created) {
            Severity: Minor
            Found in app/assets/javascripts/spreadsheet_explorer.js - About 45 mins to fix

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

              function select_cells(startCol, startRow, endCol, endRow, sheetNumber) {
              Severity: Minor
              Found in app/assets/javascripts/spreadsheet_explorer.js - About 35 mins to fix

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

                function bindAnnotations(annotation_sources) {
                    var annotationIndexTable = $j("div#annotation_overview table");
                    for(var s = 0; s < annotation_sources.size(); s++)
                    {
                        var source = annotation_sources[s];
                Severity: Minor
                Found in app/assets/javascripts/spreadsheet_explorer.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

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

                                if(e.pageX >= (sheet.position().left + sheet.outerWidth()) - slowScrollBoundary)
                                    if(e.pageX >= (sheet.position().left + sheet.outerWidth()) - fastScrollBoundary)
                                        xInc =  "+=50px";
                                    else
                                        xInc =  "+=10px";
                Severity: Major
                Found in app/assets/javascripts/spreadsheet_explorer.js and 1 other location - About 6 hrs to fix
                app/assets/javascripts/spreadsheet_explorer.js on lines 109..120

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

                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(e.pageY >= (sheet.position().top + sheet.outerHeight()) - slowScrollBoundary)
                                    if(e.pageY >= (sheet.position().top + sheet.outerHeight()) - fastScrollBoundary)
                                        yInc =  "+=50px";
                                    else
                                        yInc =  "+=10px";
                Severity: Major
                Found in app/assets/javascripts/spreadsheet_explorer.js and 1 other location - About 6 hrs to fix
                app/assets/javascripts/spreadsheet_explorer.js on lines 122..133

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

                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

                    for(var i = 0; i < cells.size(); i += columns)
                    {
                        for(var j = 0; j < columns; j += 1)
                        {
                            text += (cells.eq(i + j).html() + "\t");
                Severity: Major
                Found in app/assets/javascripts/spreadsheet_explorer.js and 1 other location - About 2 hrs to fix
                app/assets/javascripts/spreadsheet_explorer_plot.js on lines 56..63

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

                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

                            var last_row = $(this).parent().parent().parent().find("div.row_heading").size();
                Severity: Minor
                Found in app/assets/javascripts/spreadsheet_explorer.js and 1 other location - About 35 mins to fix
                app/assets/javascripts/spreadsheet_explorer.js on lines 228..228

                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

                            var last_col = $(this).parent().parent().parent().find("div.col_heading").size();
                Severity: Minor
                Found in app/assets/javascripts/spreadsheet_explorer.js and 1 other location - About 35 mins to fix
                app/assets/javascripts/spreadsheet_explorer.js on lines 213..213

                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

                    $j('div.active_sheet').scrollLeft(cell.position().left + $j('div.active_sheet').scrollLeft() - 500);
                Severity: Minor
                Found in app/assets/javascripts/spreadsheet_explorer.js and 1 other location - About 30 mins to fix
                app/assets/javascripts/spreadsheet_explorer.js on lines 496..496

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 45.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    $j('div.active_sheet').scrollTop(row.position().top + $j('div.active_sheet').scrollTop() - 500);
                Severity: Minor
                Found in app/assets/javascripts/spreadsheet_explorer.js and 1 other location - About 30 mins to fix
                app/assets/javascripts/spreadsheet_explorer.js on lines 497..497

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 45.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                There are no issues that match your filters.

                Category
                Status