SysMO-DB/seek

View on GitHub

Showing 1,025 of 1,025 total issues

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

  def submit_to_sycamore
    @model = Model.find_by_id(params[:id])
    @display_model = @model.find_version(params[:version])
    error_message = nil
    if !Seek::Config.sycamore_enabled
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 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 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 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 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 set_smtp_settings has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def set_smtp_settings (field, value)
      if [:password, :user_name, :authentication].include? field.to_sym
        if value.blank?
          value = nil
        end
Severity: Minor
Found in lib/seek/config.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 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

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

Avoid deeply nested control flow statements.
Open

                    if self.respond_to?(action_method) && !self.send(action_method)
                      result = false
                      errors.add(:base,"You are not permitted to change #{reflection.name} on #{self.class.name.underscore.humanize}-#{id} without #{action} rights")
                      break
                    end
Severity: Major
Found in lib/seek/permissions/authorization_enforcement.rb - About 45 mins to fix

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

            def bio_samples_population institution_id=nil, to_populate=true
              begin
                if content_blob.is_extractable_spreadsheet?
    
                  bio_samples = nil
    Severity: Minor
    Found in lib/seek/data/bio_samples_extraction.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 cache_remote_content_blob has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def cache_remote_content_blob
            blobs = []
            blobs << self.content_blob if self.respond_to?(:content_blob)
            blobs = blobs | self.content_blobs if self.respond_to?(:content_blobs)
            blobs.compact!
    Severity: Minor
    Found in lib/acts_as_asset.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