SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

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

      def authorization_permissions user=User.current_user
        @@expected_true_value ||= ActiveRecord::Base.connection.quoted_true.gsub("'","")
        permissions = AuthPermissions.new
        user_id = user.nil? ? 0 : user.id
        if Seek::Config.auth_lookup_enabled && self.class.lookup_table_consistent?(user_id)
Severity: Minor
Found in lib/seek/permissions/policy_based_authorization.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 find_treatment_row_and_columns_in_sheet has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def find_treatment_row_and_columns_in_sheet sheet
        sheet_name = sheet.attributes["name"]
        treatment_cell_element = sheet.find("//ss:sheet[@name='#{sheet_name}']/ss:rows/ss:row/ss:cell").find do |cell|
          cell.content.match(/treatment.*/i)
        end
Severity: Minor
Found in lib/seek/data/treatments.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 merge_conditions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def merge_conditions(*conditions)
      segments = []

      conditions.each do |condition|
        unless condition.blank?
Severity: Minor
Found in lib/grouped_pagination.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 acts_as_asset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def acts_as_asset
        attr_accessor :parent_name
        include Seek::Taggable

        acts_as_scalable
Severity: Minor
Found in lib/acts_as_asset.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 update_subscription_job_if_study_or_assay has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def update_subscription_job_if_study_or_assay
    if self.kind_of?(Study) && self.investigation_id_changed?
      #update subscriptions for study
      old_investigation_id = self.investigation_id_was
      old_investigation = Investigation.find_by_id old_investigation_id
Severity: Minor
Found in lib/subscribable.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 roles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def roles(project=nil)
      project_id = (project.is_a?(Project)) ? project.id : project.to_i
      role_names.select do |role_name|
        if self.class.is_project_dependent_role?(role_name)
          if project_id.nil?
Severity: Minor
Found in lib/seek/admin_defined_roles.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 fix_run_output_ports_mime_types has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def fix_run_output_ports_mime_types(run)
  run.outputs.each do |output|
    output.metadata = {:size => nil, :type => ''} if output.metadata.nil?
    port = run.executed_workflow.output_ports.detect { |o| o.name == output.name }
    if port && !port.mime_type.blank?
Severity: Minor
Found in lib/taverna_player_callbacks.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

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

function addOrganism(title,id,strain_info,strain_id,culture_growth,t_id,t_title) {
Severity: Major
Found in app/assets/javascripts/assays.js - About 50 mins to fix

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

            x, y, nodeX, nodeY, width, height, padding) {
    Severity: Major
    Found in app/assets/javascripts/modified_cytoscape.js - About 50 mins to fix

      Method image_tag_for_key has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def image_tag_for_key(key, url=nil, alt=nil, html_options={}, label=key.humanize, remote=false, size=nil)
      Severity: Major
      Found in app/helpers/images_helper.rb - About 50 mins to fix

        Method tree_editor_display has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def tree_editor_display type, show_edit=true, show_delete=true, selected_id=nil, related_resource_type="Person",selective_display=false, foldable=false
        Severity: Major
        Found in app/helpers/projects_helper.rb - About 50 mins to fix

          Method generate_triples has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def generate_triples subject, method, property,uri_or_literal,transformation,collection_transform,rdf_graph
          Severity: Major
          Found in lib/seek/rdf/rdf_generation.rb - About 50 mins to fix

            Function checkItem has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function checkItem(id, source, resource_type) {
                if (source == "target") {
                    if (allLinks[resource_type][id] == true){
                        checkedTargetMap[resource_type][id] = false;
                        allLinks[resource_type][id] = false;
            Severity: Minor
            Found in app/assets/javascripts/link_adder.js - About 45 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 updateDataFiles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function updateDataFiles() {
                data_file_text='<ul class="related_asset_list">'
                
                for (var i=0;i<data_files_assets.length;i++) {        
                    data_file=data_files_assets[i];
            Severity: Minor
            Found in app/assets/javascripts/assays.js - About 45 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 updatePublications has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function updatePublications() {
                publication_text='<ul class="related_asset_list">'
                
                for (var i=0;i<publication_array.length;i++) {        
                    publication=publication_array[i];
            Severity: Minor
            Found in app/assets/javascripts/publication.js - About 45 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 deactivate_previous_tab has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function deactivate_previous_tab(tab_element){
                    var previous_active_tab = tab_element.up("ul.tabbernav").getElementsByClassName('tabberactive')[0];
                    previous_active_tab.className = '';
                    //Then hide the content of the tab
                    var scale_and_type = previous_active_tab.childNodes[0].className;
            Severity: Minor
            Found in app/assets/javascripts/tab_lazy_load.js - About 45 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 to_presentation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def to_presentation
                presentation_attrs = attributes.delete_if { |k, v| !(::Presentation.new.attributes.include?(k))}
            
                Presentation.new(presentation_attrs).tap do |presentation|
                  DataFile.reflect_on_all_associations.select { |a| [:has_many, :has_and_belongs_to_many, :has_one].include?(a.macro) && !a.through_reflection }.each do |a|
            Severity: Minor
            Found in app/models/data_file.rb - About 45 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

              Method resource_tab_item_name has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def resource_tab_item_name resource_type,pluralize=true
                  resource_type = resource_type.singularize
                  if resource_type == "Speciman"
                    result = t('biosamples.sample_parent_term')
                  elsif resource_type == "Assay"
              Severity: Minor
              Found in app/helpers/application_helper.rb - About 45 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_people_in_network has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def get_people_in_network access_type
                  people_in_network = [] #id, name, access_type
                  projects = Project.all
                  projects.each do |project|
                    project.people.each do |person|
              Severity: Minor
              Found in app/models/policy.rb - About 45 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