robertgauld/OSMExtender

View on GitHub

Showing 133 of 203 total issues

Avoid too many return statements within this function.
Open

    return "Very strong"
Severity: Major
Found in app/assets/javascripts/application/passwords.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        if (strength < 10000) {return "#55ff55" }
    Severity: Major
    Found in app/assets/javascripts/application/passwords.js - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

          return ordinalized_date(time, '%H:%M on %-d %B %Y')
      Severity: Major
      Found in app/helpers/application_helper.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return {success: false, errors: ['Could not retrieve Staged badges from OSM.']}
        Severity: Major
        Found in app/models/automation_task_chief_scout_award.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                return ordinalized_date(time, '%H:%M on %A %-d %B')
          Severity: Major
          Found in app/helpers/application_helper.rb - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return "#22ff22"
            Severity: Major
            Found in app/assets/javascripts/application/passwords.js - About 30 mins to fix

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

                def scheduled_jobs
                  return @scheduled_jobs unless @scheduled_jobs.nil?
              
                  job_status = lambda do |job|
                    return :running if job.locked_at
              Severity: Minor
              Found in app/models/status.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 get_calendar_items_for_section has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.get_calendar_items_for_section(api, section, options)
                  [:start, :finish, :include_meetings, :include_events].each do |attr|
                    fail ArgumentError, "options doesn't contain a value for :#{attr}" unless options.has_key?(attr)
                  end
              
              
              Severity: Minor
              Found in app/models/report.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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def update
                  @token = params[:token]
                  @user = User.load_from_reset_password_token(@token)
              
                  if @user && @user.change_password!(params[:password], params[:password_confirmation])
              Severity: Minor
              Found in app/controllers/password_resets_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

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

                def sortable_link(column, title=nil)
                  css_class = 'sortable'
                  title ||= column.titleize
                  css_class += (column == sort_column) ? " sortable_current sortable_#{sort_direction}" : ''
                  direction = ((column == sort_column) && sort_direction == "asc") ? "desc" : "asc"
              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 get_automation_tasks_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.get_automation_tasks_data(date)
                  Rails.application.eager_load! unless Rails.application.config.cache_classes  # cache_clases is off in dev and on in prod
                  types = Module.constants.map{ |i| i=eval(i.to_s) }
                  types.select!{ |i| !i.nil? && i.is_a?(Class) && i.superclass.eql?(AutomationTask) }
              
              
              Severity: Minor
              Found in app/models/statistics.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 delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def delete
                  # Check the confirmation code from the confirm_delete page
                  unless session[:delete_my_account_confrmation_code].eql?(params[:confirmation_code])
                    redirect_to confirm_delete_my_account_path
                    return
              Severity: Minor
              Found in app/controllers/my_account_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

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

                def hide
                  request.format = :js if params[:format].nil?
                  @announcement = current_user.current_announcements.are_hideable.find(params[:id])
              
                  unless @announcement.nil?
              Severity: Minor
              Found in app/controllers/announcements_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