arsduo/koala

View on GitHub

Showing 26 of 26 total issues

Method initialize has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(http_status, response_body, error_info = nil)
        if response_body
          self.response_body = response_body.strip
        else
          self.response_body = ''
Severity: Minor
Found in lib/koala/errors.rb - About 3 hrs 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 graph_call has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

      def graph_call(path, args = {}, verb = "get", options = {}, &post_processing)
        # enable appsecret_proof by default
        options = {:appsecret_proof => true}.merge(options) if @app_secret
        response = api(path, args, verb, options)

Severity: Minor
Found in lib/koala/api.rb - About 2 hrs 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 to_batch_params has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

        def to_batch_params(main_access_token, app_secret)
          # set up the arguments
          if @access_token != main_access_token
            @args[:access_token] = @access_token
            if app_secret
Severity: Minor
Found in lib/koala/api/batch_operation.rb - About 2 hrs 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

Class OAuth has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

    class OAuth
      attr_reader :app_id, :app_secret, :oauth_callback_url

      # Creates a new OAuth client.
      #
Severity: Minor
Found in lib/koala/oauth.rb - About 2 hrs to fix

    Method initialize has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def initialize(http_status, response_body, error_info = nil)
            if response_body
              self.response_body = response_body.strip
            else
              self.response_body = ''
    Severity: Minor
    Found in lib/koala/errors.rb - About 1 hr to fix

      Method parse_media_args has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

            def parse_media_args(media_args, method)
              # photo and video uploads can accept different types of arguments (see above)
              # so here, we parse the arguments into a form directly usable in put_connections
              raise KoalaError.new("Wrong number of arguments for put_#{method == "photos" ? "picture" : "video"}") unless media_args.size.between?(1, 5)
      
      
      Severity: Minor
      Found in lib/koala/api/graph_api_methods.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 use_simple_detection has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def use_simple_detection(filename)
              # very rudimentary extension analysis for images
              # first, get the downcased extension, or an empty string if it doesn't exist
              extension = ((filename.match(/\.([a-zA-Z0-9]+)$/) || [])[1] || "").downcase
              case extension
      Severity: Minor
      Found in lib/koala/http_service/uploadable_io.rb - About 1 hr to fix

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

              def parse_signed_cookie(fb_cookie)
                components = parse_signed_request(fb_cookie)
                if code = components["code"]
                  begin
                    token_info = get_access_token_info(code, :redirect_uri => '')
        Severity: Minor
        Found in lib/koala/oauth.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 api has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

              def api(path, args = {}, verb = "get", options = {})
                # we make a copy of args so the modifications (added access_token & appsecret_proof)
                # do not affect the received argument
                args = args.dup
        
        
        Severity: Minor
        Found in lib/koala/api.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 make_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.make_request(request)
              # set up our Faraday connection
              conn = Faraday.new(request.server, faraday_options(request.options), &(faraday_middleware || DEFAULT_MIDDLEWARE))
        
              filtered_args = request.raw_args.dup.transform_keys(&:to_s)
        Severity: Minor
        Found in lib/koala/http_service.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 parse_unsigned_cookie has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def parse_unsigned_cookie(fb_cookie)
                # remove the opening/closing quote
                fb_cookie = fb_cookie.gsub(/\"/, "")
        
                # since we no longer get individual cookies, we have to separate out the components ourselves
        Severity: Minor
        Found in lib/koala/oauth.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def initialize(options = {})
                @app_id = options[:app_id] || Koala.config.app_id
                @app_access_token = options[:app_access_token] || Koala.config.app_access_token
                @secret = options[:secret] || Koala.config.app_secret
        
        
        Severity: Minor
        Found in lib/koala/test_users.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 put_object has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def put_object(parent_object, connection_name, args = {}, options = {}, &block)
        Severity: Minor
        Found in lib/koala/api/graph_api_methods.rb - About 35 mins to fix

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

                def set_app_restrictions(app_id, restrictions_hash, args = {}, options = {}, &block)
          Severity: Minor
          Found in lib/koala/api/graph_api_methods.rb - About 35 mins to fix

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

                  def put_connections(id, connection_name, args = {}, options = {}, &block)
            Severity: Minor
            Found in lib/koala/api/graph_api_methods.rb - About 35 mins to fix

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

                    def get_connection(id, connection_name, args = {}, options = {}, &block)
              Severity: Minor
              Found in lib/koala/api/graph_api_methods.rb - About 35 mins to fix

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

                      def subscribe(object, fields, callback_url, verify_token, options = {})
                Severity: Minor
                Found in lib/koala/realtime_updates.rb - About 35 mins to fix

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

                        def graph_call(path, args = {}, verb = "get", options = {}, &post_processing)
                  Severity: Minor
                  Found in lib/koala/api/graph_batch_api.rb - About 35 mins to fix

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

                          def delete_connections(id, connection_name, args = {}, options = {}, &block)
                    Severity: Minor
                    Found in lib/koala/api/graph_api_methods.rb - About 35 mins to fix

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

                            def put_wall_post(message, attachment = {}, target_id = "me", options = {}, &block)
                      Severity: Minor
                      Found in lib/koala/api/graph_api_methods.rb - About 35 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language