SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

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

  def delete_model_type params
    id=params[:selected_model_type_id]
    model_type=ModelType.find(id)
    success=false
    if (model_type.models.empty?)
Severity: Minor
Found in app/controllers/models_controller.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 create_from_existing has a Cognitive Complexity of 8 (exceeds 5 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 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

Avoid deeply nested control flow statements.
Open

              unless  bio_samples.errors.blank?
                flash[:notice] << "<br/> However, Sample database population failed."
                flash[:error] = bio_samples.errors.html_safe
                #respond_to do |format|
                #  format.html{
Severity: Major
Found in app/controllers/data_files_controller.rb - About 45 mins to fix

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

      def update_members
        groups_to_remove = params[:group_memberships_to_remove] || []
        people_and_institutions_to_add = params[:people_and_institutions_to_add] || []
        groups_to_remove.each do |group|
          g = GroupMembership.find(group)
    Severity: Minor
    Found in app/controllers/projects_controller.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 core_xlink has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def core_xlink object,include_title=true
        if (object.class.name.include?("::Version"))
          xlink=xlink_attributes(uri_for_object(object.parent,{:params=>{:version=>object.version}}))
        else
          xlink=xlink_attributes(uri_for_object(object))  
    Severity: Minor
    Found in app/helpers/api_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 new_specimen has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def new_specimen
            specimen = Specimen.new
            # to delete id hash which is saved in the hidden id field (automatically generated in form with fields_for)
              #delete id hashes of genotypes/phenotypes
              params[:specimen][:genotypes_attributes].try(:delete, "id")
    Severity: Minor
    Found in app/controllers/specimens_controller.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 destroy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def destroy
        respond_to do |format|
          if @suggested_assay_type.can_destroy?
            title = @suggested_assay_type.label
            @suggested_assay_type.destroy
    Severity: Minor
    Found in app/controllers/suggested_assay_types_controller.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 send_rdf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def send_rdf(item,graphs=rdf_graph_uris(item), save_file = true)
              if configured?
                connect_to_repository
                with_statements(item) do |statement|
                  if statement.valid?
    Severity: Minor
    Found in lib/seek/rdf/rdf_repository.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 create_from_existing has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def create_from_existing
        experimental_condition_ids = []
        new_experimental_conditions = []
        #retrieve the selected FSes
        params.each do |key, value|
    Severity: Minor
    Found in app/controllers/experimental_conditions_controller.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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        @publication = Publication.new(params[:publication])
        @publication.pubmed_id=nil if @publication.pubmed_id.blank?
        @publication.doi=nil if @publication.doi.blank?
        pubmed_id,doi = preprocess_doi_or_pubmed @publication.pubmed_id,@publication.doi
    Severity: Minor
    Found in app/controllers/publications_controller.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 check_assays_are_not_already_associated_with_another_study has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def check_assays_are_not_already_associated_with_another_study
        assay_ids=params[:study][:assay_ids]
        study_id=params[:id]    
        if (assay_ids)
          valid = !assay_ids.detect do |a_id|
    Severity: Minor
    Found in app/controllers/studies_controller.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 find_ontology_class has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def find_ontology_class
        uri = params[:uri] || Seek::Ontologies::AssayTypeReader.instance.default_parent_class_uri.to_s
    
        @is_modelling = false
        cls = Seek::Ontologies::AssayTypeReader.instance.class_hierarchy.hash_by_uri[uri]
    Severity: Minor
    Found in app/controllers/assay_types_controller.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 related_items_from_sparql has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def related_items_from_sparql
            items = []
            if rdf_repository_configured?
              Seek::Rdf::RdfRepository.instance.uris_of_items_related_to(self).each do |uri|
                begin
    Severity: Minor
    Found in lib/seek/rdf/rdf_repository_storage.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 show has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def show
          annotation = Annotation.find(params[:id])
          other_annotations = annotation.value.annotations
    
    
    
    Severity: Minor
    Found in app/controllers/annotations_controller.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 update_lookup_table has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def update_lookup_table user=nil
            self.class.isolation_level( :repeatable_read ) do #ensure it allows it see another worker may have inserted a record already
              self.class.transaction do
                user_id = user.nil? ? 0 : user.id
    
    
    Severity: Minor
    Found in lib/seek/permissions/policy_based_authorization.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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        @event = Event.new params[:event]
    
        data_file_ids = params.delete(:data_file_ids) || []
        data_file_ids.collect! {|text| id, rel = text.split(','); id}
    Severity: Minor
    Found in app/controllers/events_controller.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 expire_activity_fragment_cache has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def expire_activity_fragment_cache(controller,action)
        if action!="show"
          @@auth_types ||=  Seek::Util.authorized_types.collect{|t| t.name.underscore.pluralize}
          if action=="download"
            expire_download_activity
    Severity: Minor
    Found in app/controllers/application_controller.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 dependent_items has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def dependent_items
            items = []
            #FIXME: this should go into a seperate mixin for active-record
            methods=[:data_files,:sops,:models,:publications,
                     :data_file_masters, :sop_masters, :model_masters,
    Severity: Minor
    Found in lib/seek/rdf/rdf_generation.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 lookup_table_consistent? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def lookup_table_consistent? user_id
              unless user_id.is_a?(Numeric)
                user_id = user_id.nil? ? 0 : user_id.id
              end
              #cannot rely purely on the count, since an item could have been deleted and a new one added
    Severity: Minor
    Found in lib/seek/permissions/policy_based_authorization.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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def update
        data_file_ids = params.delete(:data_file_ids) || []
        data_file_ids.collect! {|text| id, rel = text.split(','); id}
        @event.data_files = DataFile.find(data_file_ids)
    
    
    Severity: Minor
    Found in app/controllers/events_controller.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