MidnightRiders/MemberPortal

View on GitHub

Showing 92 of 4,113 total issues

Method cancel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def cancel(provide_refund = false)
      unless subscription?
        errors.add(:base, 'No subscription to cancel')
        return false
      end
Severity: Minor
Found in app/models/concerns/commerce/subscribable.rb - About 35 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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    @params = params.permit(:privilege, :search, :show_all, :year)
    @privilege = @params[:privilege].blank? ? nil : @params[:privilege]
    @year = @params.fetch(:year, Date.current.year).to_i
    @show_all = @params[:show_all].in? [true, 'true']
Severity: Minor
Found in app/controllers/users_controller.rb - About 35 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 process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def process
    return @status unless filter_event && customer_token && user
    return 200 if ignored?
    public_send(@event[:type].gsub(/[^a-z0-9]+/i, '_'))
    @status
Severity: Minor
Found in app/services/stripe_webhook_service.rb - About 35 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 too many return statements within this function.
Open

      return el.hide();
Severity: Major
Found in app/javascript/vendor/foundation/foundation.reveal.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return false;
    Severity: Major
    Found in app/javascript/vendor/foundation/foundation.tooltip.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                return $.get(path, function (response) {
                  el.html(response);
                  el.data(self.data_attr + '-last-path', path);
                  trigger();
                });
      Severity: Major
      Found in app/javascript/vendor/foundation/foundation.interchange.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return false;
        Severity: Major
        Found in app/javascript/vendor/foundation/foundation.topbar.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return el.show();
          Severity: Major
          Found in app/javascript/vendor/foundation/foundation.reveal.js - About 30 mins to fix

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

              def accept_invitation
                if @relative.pending_approval
                  if (@relative_user = User.find_by(email: @relative.invited_email)).present? && @relative.update(user_id: @relative_user.id, info: @relative.info.with_indifferent_access.except(:pending_approval, :invited_email))
                    MembershipNotifier.new(user: @relative_user, membership: @relative).notify_relative
                    redirect_to user_home_path, flash: { success: "You are now a member of #{@relative.family.user.first_name}’s #{@relative.family.year} Family Membership." }
            Severity: Minor
            Found in app/controllers/relatives_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 events has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.events
                if !@updated_at || @updated_at < Time.now - 15.minutes
                  @events = get_events
                  if @events['error']
                    @auth_token = refresh_auth_token
            Severity: Minor
            Found in lib/facebook_api.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def create
                @relative_user = User.find_or_initialize_by(relative_params[:user_attributes])
            
                if @relative_user.current_member?
                  redirect_to new_user_membership_relative_path(@family.user, @family), flash: { alert: 'There is already a user with a current membership for that email.' }
            Severity: Minor
            Found in app/controllers/relatives_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 pick_em_buttons has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def pick_em_buttons(*args)
                h.content_tag :div, class: "pick-em-buttons secondary-border border-all #{model.home_team.abbrv.downcase} #{'closed' unless model.kickoff.future?}", title: model.kickoff.future? ? 'Pick ’Em' : 'Voting Closed' do
                  h.concat h.content_tag :div, pick_em_button(:home, *args), class: 'home'
                  h.concat h.content_tag :div, pick_em_button(:draw, *args), class: 'draw'
                  h.concat h.content_tag :div, pick_em_button(:away, *args), class: 'away'
            Severity: Minor
            Found in app/decorators/match_decorator.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