SysMO-DB/seek

View on GitHub

Showing 1,025 of 1,025 total issues

Method contributor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def contributor(contributor, avatar=false, size=100, you_text=false)
    return jerm_harvester_name unless contributor
    
    if contributor.class.name == "User"
      # this string will output " (you) " for current user next to the display name, when invoked with 'you_text == true'
Severity: Minor
Found in app/helpers/application_helper.rb - 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

Method truncate_without_splitting_words has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def truncate_without_splitting_words(text, length=50)
    truncated_result = ""
    remaining_length = length
    stop = false
    truncated = false
Severity: Minor
Found in app/helpers/application_helper.rb - 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

Method uniq_fs_or_ec has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def uniq_fs_or_ec fs_or_ec_array=[]
    result = []
    uniq_fs_or_ec_field_array = []
    link_table_name = (!fs_or_ec_array.empty? && fs_or_ec_array.first.class.name == 'StudiedFactor') ? 'studied_factor_links' : 'experimental_condition_links'
    fs_or_ec_array.each do |fs_or_ec|
Severity: Minor
Found in app/helpers/studied_factors_helper.rb - 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

Method text_for_resource has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def text_for_resource resource_or_text
    if resource_or_text.is_a?(String)
      text = resource_or_text.underscore.humanize
    else
      resource_type = resource_or_text.class.name
Severity: Minor
Found in app/helpers/assets_helper.rb - 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

Method send_feedback has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def send_feedback
    @subject=params[:subject]
    @anon=params[:anon]
    @details=params[:details]

Severity: Minor
Found in app/controllers/homes_controller.rb - 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

Method update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def update    
    @user = User.find(params[:id])
    person=Person.find(params[:user][:person_id]) unless (params[:user][:person_id]).nil?
    @user.person=person if !person.nil?

Severity: Minor
Found in app/controllers/users_controller.rb - 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

Method fetch has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def fetch    
    @project=Project.find(params[:project])
    @project.decrypt_credentials
    if @project.site_root_uri.blank?
      flash.now[:error]="No remote site location defined"
Severity: Minor
Found in app/controllers/jerm_controller.rb - 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

Method create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    @topic = Topic.find_by_id_and_forum_id(params[:topic_id],params[:forum_id])
    if @topic.locked?
      respond_to do |format|
        format.html do
Severity: Minor
Found in app/controllers/posts_controller.rb - 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

Method new_object_based_on_existing_one has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def new_object_based_on_existing_one
    @existing_sample =  Sample.find(params[:id])
    @sample = @existing_sample.clone_with_associations

    unless @sample.specimen.can_view?
Severity: Minor
Found in app/controllers/samples_controller.rb - 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

Method index has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def index

    if Seek::Config.solr_enabled
      perform_search
    else
Severity: Minor
Found in app/controllers/search_controller.rb - 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

Method xlink_title has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def xlink_title(item, item_type_name=nil)
    case item
      when String
      return item
    else
Severity: Minor
Found in app/helpers/api_helper.rb - 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

Method extract_species_and_reaction_names has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def extract_species_and_reaction_names doc
        species = []
        reactions = []
        species_names_node = doc.find_first("//speciesNames")
        species_names_node.children.each do |child|
Severity: Minor
Found in lib/seek/jws/api_handling.rb - 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

Method authorized_associations_for_action? has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def authorized_associations_for_action?
          result = true
          if self.class.respond_to?(:associations_and_actions_to_be_enforced)
            self.class.associations_and_actions_to_be_enforced.keys.each do |association|
              if self.respond_to?(association)
Severity: Minor
Found in lib/seek/permissions/authorization_enforcement.rb - 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 tab_on_click has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function tab_on_click(scale_title, resource_type, resource_ids, actions_partial_disable){
    var click_tab = document.getElementsByClassName(scale_title + '_' + resource_type)[0];
    click_tab.onclick = function(){
        deactivate_previous_tab(this);
        click_tab.parentElement.className = 'tabberactive';
Severity: Minor
Found in app/assets/javascripts/tab_lazy_load.js - About 1 hr to fix

    Method summarize_permissions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def summarize_permissions creators=[User.current_user.try(:person)], asset_managers = [], contributor=User.current_user.try(:person)
            #build the hash containing contributor_type as key and the people in these groups as value,exception:'Public' holds the access_type as the value
            people_in_group = {'Person' => [], 'FavouriteGroup' => [], 'WorkGroup' => [], 'Project' => [], 'Institution' => [], 'WhiteList' => [], 'BlackList' => [],'Network' => [], 'Public' => 0}
            #the result return: a hash contain the access_type as key, and array of people as value
            grouped_people_by_access_type = {}
    Severity: Minor
    Found in app/models/policy.rb - About 1 hr to fix

      Method list_item_visibility has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def list_item_visibility item,css_class="visibility_icon"
          title = ""
          html  = ""
          policy = item.policy
      
      
      Severity: Minor
      Found in app/helpers/resource_list_item_helper.rb - About 1 hr to fix

        Method model_scales_list has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def model_scales_list model, list_item
            scales = model.scales
            if scales.empty?
              text_or_not_specified("")
            else
        Severity: Minor
        Found in app/helpers/scales_helper.rb - About 1 hr to fix

          Method matching_data_files has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def matching_data_files params_only=false
              
              results = {}
          
              if Seek::Config.solr_enabled && is_jws_supported?
          Severity: Minor
          Found in app/models/model.rb - About 1 hr to fix

            Method create_from_existing has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def create_from_existing
                studied_factor_ids = []
                new_studied_factors = []
                #retrieve the selected FSes
            
            
            Severity: Minor
            Found in app/controllers/studied_factors_controller.rb - About 1 hr to fix

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

                def create
                  content = params[:annotation_content].strip
                  if !content.blank?
                    worksheet = @content_blob.worksheets.select {|w| w.sheet_number == params[:annotation_sheet_id].to_i}.first
              
              
              Severity: Minor
              Found in app/controllers/spreadsheet_annotations_controller.rb - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language