SysMO-DB/seek

View on GitHub

Showing 1,025 of 1,025 total issues

Method create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create
    unless params[:avatar].blank? || params[:avatar][:image_file].blank?
      file_specified = true
      
      # the creation of the new Avatar instance needs to have only one parameter - therefore, the rest should be set separately
Severity: Minor
Found in app/controllers/avatars_controller.rb - About 1 hr to fix

    Method sharing_params_to_policy has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def sharing_params_to_policy params=params
          policy =Policy.new()
          policy.sharing_scope = params["sharing_scope"].to_i unless params[:sharing_scope].blank?
          policy.access_type = params[:access_type].blank? ? 0 : params["access_type"].to_i
          policy.use_whitelist = params["use_whitelist"] == 'true' ? true : false
    Severity: Minor
    Found in app/controllers/policies_controller.rb - About 1 hr to fix

      Method create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

         def create
             unless params[:model_image].blank? || params[:model_image][:image_file].blank?
               file_specified = true
               @model_image = ModelImage.new params[:model_image]
               @model_image.model_id = params[:model_id]
      Severity: Minor
      Found in app/controllers/model_images_controller.rb - About 1 hr to fix

        Method detect_for_filter has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def detect_for_filter(filter, resource, value)
            case
              #first the special cases
              when filter == 'investigation' && resource.respond_to?(:assays)
                resource.assays.collect { |a| a.study.investigation_id }.include? value.id
        Severity: Minor
        Found in app/controllers/application_controller.rb - About 1 hr to fix

          Method format_csv has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def format_csv(output, index = [])
            row_limit = 500
            html = ''
          
            begin
          Severity: Minor
          Found in lib/taverna_player_renderers.rb - About 1 hr to fix

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

            function dragObject(element, attachElement, lowerBound, upperBound, startCallback, moveCallback, endCallback, attachLater)
            Severity: Major
            Found in app/assets/javascripts/jws/Resizeable_Textbox/javascript.js - About 1 hr to fix

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

              function dragObject(element, attachElement, lowerBound, upperBound, startCallback, moveCallback, endCallback, attachLater)
              Severity: Major
              Found in app/assets/javascripts/jws/Resizeable_Container/javascript.js - About 1 hr to fix

                Method indented_tree_child_options has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def indented_tree_child_options parent, depth=0, show_edit=true, show_delete=true, selected_id=nil, related_resource_type="Person",selected_display_items=nil, foldable=true
                Severity: Major
                Found in app/helpers/projects_helper.rb - About 1 hr to fix

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

                    function store_annotations(prefix,key,triplets) {
                        if (annotations[prefix] == undefined) {
                            annotations[prefix] = new Array();
                        }
                        annotations[prefix][key] = triplets;
                  Severity: Major
                  Found in app/assets/javascripts/jws/jws_annotator.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/jws/jws_annotator.js on lines 134..139

                  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 store_cached_annotations(prefix,key,triplets) {
                        if (cached_annotations[prefix] == undefined) {
                            cached_annotations[prefix] = new Array();
                        }
                        cached_annotations[prefix][key] = triplets;
                  Severity: Major
                  Found in app/assets/javascripts/jws/jws_annotator.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/jws/jws_annotator.js on lines 127..132

                  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

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

                      def classify_for_tabs result_collection
                        results={}
                  
                        result_collection.each do |res|
                          tab = res.respond_to?(:tab) ? res.tab : res.class.name
                  Severity: Minor
                  Found in lib/seek/faceted_browsing.rb and 1 other location - About 1 hr to fix
                  app/helpers/application_helper.rb on lines 152..161

                  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

                        collapse_link = link_to_function collapse_minus_image,:style => "float:left;"+ "display:" + (display_style=='display:none' ? 'none;' : 'block;'), :id =>"projects_hierarchies_collapse_#{root.id}" do |page|
                          page.visual_effect :toggle_blind, "#{root.id}", :duration => 0.5
                          page["projects_hierarchies_expand_#{root.id}"].toggle
                          page["projects_hierarchies_collapse_#{root.id}"].toggle
                  Severity: Minor
                  Found in app/helpers/projects_helper.rb and 1 other location - About 1 hr to fix
                  app/helpers/projects_helper.rb on lines 109..112

                  Duplicated Code

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

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

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

                  Tuning

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

                        expand_link = link_to_function expand_plus_image, :style => "float:left;" + "display:" + (display_style=='display:none' ? 'block;' : 'none;'), :id =>"projects_hierarchies_expand_#{root.id}" do |page|
                          page.visual_effect :toggle_blind, "#{root.id}", :duration => 0.5
                          page["projects_hierarchies_expand_#{root.id}"].toggle
                          page["projects_hierarchies_collapse_#{root.id}"].toggle
                  Severity: Minor
                  Found in app/helpers/projects_helper.rb and 1 other location - About 1 hr to fix
                  app/helpers/projects_helper.rb on lines 115..118

                  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

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

                    def classify_for_tabs result_collection
                      results={}
                  
                      result_collection.each do |res|
                        tab = res.respond_to?(:tab) ? res.tab : res.class.name
                  Severity: Minor
                  Found in app/helpers/application_helper.rb and 1 other location - About 1 hr to fix
                  lib/seek/faceted_browsing.rb on lines 82..91

                  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

                        def deliver_gatekeeper_reject_feedback items
                          if (Seek::Config.email_enabled)
                            requesters_items_comments = requesters_items_and_comments(items)
                            requesters_items_comments.keys.each do |requester_id|
                              requester = Person.find_by_id(requester_id)
                  Severity: Minor
                  Found in lib/seek/publishing/gatekeeper_publish.rb and 1 other location - About 55 mins to fix
                  lib/seek/publishing/gatekeeper_publish.rb on lines 47..56

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

                  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

                        def deliver_gatekeeper_approval_feedback items
                          if (Seek::Config.email_enabled)
                            requesters_items_comments = requesters_items_and_comments(items)
                            requesters_items_comments.keys.each do |requester_id|
                              requester = Person.find_by_id(requester_id)
                  Severity: Minor
                  Found in lib/seek/publishing/gatekeeper_publish.rb and 1 other location - About 55 mins to fix
                  lib/seek/publishing/gatekeeper_publish.rb on lines 61..70

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

                  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

                  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 additionalFieldForItem has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function additionalFieldForItem(form_id, fs_or_ec_id){
                      var elements =  $(form_id).getElements();
                      var item;
                      var substance_autocomplete;
                      for (var i=0;i<elements.length;i++)
                  Severity: Minor
                  Found in app/assets/javascripts/studied_factor.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

                  Method get_all_as_json has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.get_all_as_json
                      all_people = Person.order("ID asc")
                      names_emails = all_people.collect{ |p| {"id" => p.id,
                          "name" => (p.first_name.blank? ? (logger.error("\n----\nUNEXPECTED DATA: person id = #{p.id} doesn't have a first name\n----\n"); "(NO FIRST NAME)") : h(p.first_name)) + " " +
                                    (p.last_name.blank? ? (logger.error("\n----\nUNEXPECTED DATA: person id = #{p.id} doesn't have a last name\n----\n"); "(NO LAST NAME)") : h(p.last_name)),
                  Severity: Minor
                  Found in app/models/person.rb - 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

                  Method check_url_content_type has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def check_url_content_type
                      unless url.nil?
                        begin
                          response = RestClient.head url
                          type = response.headers[:content_type] || ""
                  Severity: Minor
                  Found in app/models/content_blob.rb - 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

                  Severity
                  Category
                  Status
                  Source
                  Language