danryan/reveille

View on GitHub

Showing 10 of 14 total issues

Class StateMachine has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

  class StateMachine
    attr_reader :object, :initial_state, :previous_state, :current_state

    def initialize(object)
      @object = object
Severity: Minor
Found in lib/revily/state_machine.rb - About 2 hrs to fix

    Method create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        self.resource = build_resource(resource_params) #, {unsafe: true})
    
        if resource.save
          if resource.active_for_authentication?
    Severity: Minor
    Found in app/controllers/v1/users/registrations_controller.rb - About 1 hr 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 save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def save
        return false unless valid?
    
        delegate_attributes_for_user
        delegate_attributes_for_account
    Severity: Minor
    Found in app/models/account/sign_up.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 trigger has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def trigger
        @incident = incidents.integration(params[:message], params[:key]).first_or_initialize(incident_params)
        @incident.account = current_account unless @incident.account_id?
        http_status = @incident.new_record? ? :created : :not_modified
    
    
    Severity: Minor
    Found in app/controllers/integration/provider_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 resolve has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def resolve
        @incident = incidents.integration(params[:message], params[:key]).first
    
        respond_with @incident do |format|
          if @incident
    Severity: Minor
    Found in app/controllers/integration/provider_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 acknowledge has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def acknowledge
        @incident = incidents.integration(params[:message], params[:key]).first
    
        respond_with @incident do |format|
          if @incident
    Severity: Minor
    Found in app/controllers/integration/provider_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 association_attributes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def association_attributes(association_name)
        association_name = association_name.to_sym
        association = object.send(association_name)
        association_type = association.class.name.downcase
        association_attributes = {}
    Severity: Minor
    Found in app/serializers/application_serializer.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 events has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def events(*events)
              @events ||= []
              return @events unless events.present?
              matched_events ||= Event::EventList.new(events).events
              @events.concat(matched_events).uniq! unless matched_events.blank?
    Severity: Minor
    Found in lib/revily/event/handler.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 generate_token_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def generate_token_for(object_or_class, attribute, options={})
            klass = object_or_class.is_a?(Class) ? object_or_class : object_or_class.class
    
            loop do
              token = generate_token(options)
    Severity: Minor
    Found in lib/revily/helpers/unique_token.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 handler_supports_events? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def handler_supports_events?
        return unless handler
        events.each do |event|
          unless handler && handler_class && handler_class.supports?(event)
            errors.add(:events, "handler does not support event #{event}")
    Severity: Minor
    Found in app/models/hook.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