sleepepi/sleepportal

View on GitHub

Showing 332 of 436 total issues

Avoid too many return statements within this function.
Open

                        return;
Severity: Major
Found in app/assets/javascripts/external/select2.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return -1;
    Severity: Major
    Found in app/assets/javascripts/external/select2.js - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

          return false
      Severity: Major
      Found in app/models/mapping.rb - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                            return null;
        Severity: Major
        Found in app/assets/javascripts/external/select2.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                              return this.opts.width;
          Severity: Major
          Found in app/assets/javascripts/external/select2.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return '';
            Severity: Major
            Found in app/assets/javascripts/external/jquery.sparkline.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                                          return;
              Severity: Major
              Found in app/assets/javascripts/external/select2.js - About 30 mins to fix

                Method generate_sql_through_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def generate_sql_through_link(source_identifer_mapping, criterium_source_identifer_mapping)
                      result_hash = criterium.mapping.source.sql_codes(current_user)
                      sql_open = result_hash[:open]
                      sql_close = result_hash[:close]
                
                
                Severity: Minor
                Found in app/models/resolver.rb - About 25 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 user_can_view? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def user_can_view?(current_user, actions_required)
                    sensitive_variable = (self.variable.sensitivity != '0')
                    return true if actions_required.include?('download files') and self.source.user_has_action?(current_user, 'download files')
                    return true if actions_required.include?('download dataset') and self.source.user_has_action?(current_user, 'download dataset')
                    return true if actions_required.include?('view data distribution') and self.source.user_has_action?(current_user, 'view data distribution')
                Severity: Minor
                Found in app/models/mapping.rb - About 25 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 simple_date has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def simple_date(past_date)
                    return '' if past_date.blank?
                    if past_date == Date.today
                      'Today'
                    elsif past_date == Date.today - 1.day
                Severity: Minor
                Found in app/helpers/application_helper.rb - About 25 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 apply_omniauth has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def apply_omniauth(omniauth)
                    unless omniauth['info'].blank?
                      self.first_name = omniauth['info']['first_name'] if first_name.blank?
                      self.last_name = omniauth['info']['last_name'] if last_name.blank?
                    end
                Severity: Minor
                Found in app/models/user.rb - About 25 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_matches has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def create_matches(include_extra)
                      @matches = []
                      cases_matrix = []
                      controls_matrix = []
                
                
                Severity: Minor
                Found in app/controllers/matching_controller.rb - About 25 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