SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

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

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

        def hunt_for_field_values_mapped sheet, field_name, mapping, probing_num_rows = false
          field_values = hunt_for_field_values sheet, mapping[field_name][:column], probing_num_rows
          if field_values && !field_values.empty?
    
            if probing_num_rows
    Severity: Minor
    Found in lib/seek/data/bio_samples.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 basic_auth has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def basic_auth url, username,password, include_data=true
          
          #This block is to ensure that only urls are encoded if they need it.
          #This is to prevent already encoded urls being re-encoded, which can lead to % being replaced with %25.
          begin
    Severity: Minor
    Found in lib/seek/remote_downloader.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 treatments has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def treatments
            Seek::Data::Treatments #this is just to load the class, incase it is already in the cache. Otherwise an underfined class/module error may occur
            Rails.cache.fetch("treatments_#{content_blob.cache_key}") do
              begin
                if content_blob.is_extractable_spreadsheet?
    Severity: Minor
    Found in lib/seek/data/treatment_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 request_publish_approval has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def request_publish_approval
            User.with_current_user current_user do
              c = self.controller_name.downcase
              a = self.action_name.downcase
    
    
    Severity: Minor
    Found in lib/seek/publishing/publishing_common.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 uploaded_data_with_extension= has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def uploaded_data_with_extension=(file_data)
        unless self.class == ForumAttachment || self.class == HelpAttachment || self.class == HelpImage #FIXME: This check is an indication that this extension is applied too broadly, I think.
          upload_results = self.uploaded_data_without_extension=file_data
          self.original_filename = file_data.original_filename
    
    
    Severity: Minor
    Found in lib/attachment_fu_extension.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 recursively_set_mime_type has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def recursively_set_mime_type(list, depth, type)
      depth -= 1
      list.map do |el|
        if depth == 0
          el == "application/x-error" ? el : type
    Severity: Minor
    Found in lib/taverna_player_callbacks.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 ontology_select_tag_old has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def ontology_select_tag_old form, type, root_id, element_id, selected_id=nil, html_options={}
    Severity: Minor
    Found in lib/acts_as_ontology_view_helper.rb - About 45 mins to fix

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

          def extract_from_document doc
            doc.root.namespaces.default_prefix = "ss"
      
      
            template_sheet = nil
      Severity: Minor
      Found in lib/seek/data/bio_samples.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 copy_file_between_zips has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def copy_file_between_zips(src, dest, name, ext)
        if name.ends_with?('.error')
          new_name = name
        else
          new_name = ext.nil? ? name : "#{name}#{ext}"
      Severity: Minor
      Found in lib/taverna_player_callbacks.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

      Consider simplifying this complex logical expression.
      Open

                unless res.nil?
                  permissions.can_view = res["can_view"].to_s==@@expected_true_value && state_allows_manage?(user)
                  permissions.can_download = res["can_download"].to_s==@@expected_true_value && state_allows_manage?(user)
                  permissions.can_edit = res["can_edit"].to_s==@@expected_true_value && state_allows_manage?(user)
                  permissions.can_manage = res["can_manage"].to_s==@@expected_true_value && state_allows_manage?(user)
      Severity: Major
      Found in lib/seek/permissions/policy_based_authorization.rb - About 40 mins to fix

        Function showDataTooltip has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function showDataTooltip(prefix,pagex,pagey,valuex,valuey) {
        Severity: Minor
        Found in app/assets/javascripts/spreadsheet_explorer_plot.js - About 35 mins to fix

          Function performSearch has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            function performSearch(data, regexps, queries, highlighters, state) {
          Severity: Minor
          Found in doc/seek/js/searcher.js - About 35 mins to fix

            Function select_cells has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function select_cells(startCol, startRow, endCol, endRow, sheetNumber) {
            Severity: Minor
            Found in app/assets/javascripts/spreadsheet_explorer.js - About 35 mins to fix

              Method create_job has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def self.create_job subscribable_type, subscribable_id, project_ids, t=5.seconds.from_now, priority=1
              Severity: Minor
              Found in app/jobs/set_subscriptions_for_item_job.rb - About 35 mins to fix

                Method feedback has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def feedback user,topic,details,send_anonymously,base_host
                Severity: Minor
                Found in app/models/mailer.rb - About 35 mins to fix

                  Method create_job has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def self.create_job subscribable_type, subscribable_id, old_project_ids, t=5.seconds.from_now, priority=1
                  Severity: Minor
                  Found in app/jobs/remove_subscriptions_for_item_job.rb - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language