piotrmurach/github

View on GitHub

Showing 23 of 152 total issues

Class API has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

  class API
    include Constants
    include Authorization
    include MimeType
    include RateLimit
Severity: Minor
Found in lib/github_api/api.rb - About 3 hrs to fix

    Method call has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def call(current_options, params)
          unless HTTP_METHODS.include?(action)
            raise ArgumentError, "unknown http method: #{action}"
          end
    
    
    Severity: Minor
    Found in lib/github_api/request.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 build_nested_query has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_nested_query(value, prefix = nil, encoder = nil)
          case value
          when Array
            value.map { |v| build_nested_query(v, "#{prefix}%5B%5D", encoder) }.join("&")
          when Hash
    Severity: Minor
    Found in lib/github_api/ext/faraday.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 filter! has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def filter!(keys, params, options={:recursive => true})  # :nodoc:
          case params
          when Hash, ParamsHash
            params.keys.each do |k, v|
              unless (keys.include?(k) or Github::Validations::VALID_API_KEYS.include?(k))
    Severity: Minor
    Found in lib/github_api/parameter_filter.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 default has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.default(options = {})
          api = options[:api]
          proc do |builder|
            builder.use Github::Request::Jsonize
            builder.use Faraday::Request::Multipart
    Severity: Minor
    Found in lib/github_api/middleware.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 deep_merge! has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def deep_merge!(other, &block)
        other.each_pair do |key, val|
          tval = self[key]
          if tval.is_a?(Hash) && val.is_a?(Hash)
            self[key] = tval.deep_merge(val)
    Severity: Minor
    Found in lib/github_api/core_ext/hash.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 list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    Severity: Minor
    Found in lib/github_api/client/repos.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 format_response has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

          def format_response
            return '' if data.nil? || data.empty?
    
            case data
            when Hash
    Severity: Minor
    Found in lib/github_api/error/service_error.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 symbolize_keys! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def symbolize_keys!
        hash = symbolize_keys
        hash.each do |key, val|
          hash[key] = case val
            when Hash
    Severity: Minor
    Found in lib/github_api/core_ext/hash.rb - About 55 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_query has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def parse_query(query_string)
            return '' if query_string.nil? || query_string.empty?
            params = {}
    
            query_string.split(DEFAULT_QUERY_SEP).each do |part|
    Severity: Minor
    Found in lib/github_api/utils/url.rb - About 55 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 perform_with_redirection has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def perform_with_redirection(env, follows)
          request_body = env[:body]
          response = @app.call(env)
    
          response.on_complete do |response_env|
    Severity: Minor
    Found in lib/github_api/response/follow_redirects.rb - About 55 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 assert_valid_values has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def assert_valid_values(permitted, params)
            params.each do |k, v|
              next unless permitted.keys.include?(k)
              if permitted[k].is_a?(Array) && !permitted[k].include?(params[k])
                raise Github::Error::UnknownValue.new(k,v, permitted[k].join(', '))
    Severity: Minor
    Found in lib/github_api/validations/format.rb - About 55 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 method_added has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.method_added(method_name)
          method_name = method_name.to_s.gsub(/_with(out)?_callback_.*$/, '')
          # Only subclasses matter
          return if self.root?
          return if extra_methods.include?(method_name)
    Severity: Minor
    Found in lib/github_api/api.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 call has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def call(env)
          if request_with_body?(env)
            env[:request_headers][CONTENT_TYPE] ||= MIME_TYPE
            env[:body] = encode_body env[:body] unless env[:body].respond_to?(:to_str)
          elsif safe_to_modify?(env)
    Severity: Minor
    Found in lib/github_api/request/jsonize.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 delete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def delete(*args)
          raise_authentication_error unless authenticated?
          params = arguments(args, required: [:client_id]).params
    
          if arguments.client_id
    Severity: Minor
    Found in lib/github_api/client/authorizations/app.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 list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    Severity: Minor
    Found in lib/github_api/client/issues.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 method.
    Open

          return if public_method_defined?(with_method)
    Severity: Major
    Found in lib/github_api/api.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return -1
      Severity: Major
      Found in lib/github_api/page_iterator.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return if public_method_defined?(with_method)
        Severity: Major
        Found in lib/github_api/api.rb - About 30 mins to fix

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

              def check(*args)
                raise_authentication_error unless authenticated?
                params = arguments(args, required: [:client_id, :access_token]).params
          
                if arguments.client_id
          Severity: Minor
          Found in lib/github_api/client/authorizations/app.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