grokify/ringcentral-sdk-ruby

View on GitHub

Showing 51 of 129 total issues

Method _subscribe_at_pubnub has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def _subscribe_at_pubnub
        raise 'Subscription is not alive' unless alive?

        s_key = @_subscription['deliveryMode']['subscriberKey']

Severity: Minor
Found in lib/ringcentral_sdk/rest/subscription.rb - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

            if
              (s.key?('deliveryMode') && s['deliveryMode']) \
              && (s['deliveryMode'].key?('subscriberKey') && s['deliveryMode']['subscriberKey']) \
              && (
                s['deliveryMode'].key?('address') \
    Severity: Major
    Found in lib/ringcentral_sdk/rest/subscription.rb - About 1 hr to fix

      Method send has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def send(request)
              return @client.request(request) if request.is_a? RingCentralSdk::Helpers::Request
              raise(ArgumentError, 'Request is not a ...Helpers::Request or Hash') unless request.is_a? Hash
      
              verb = request.key?(:verb) ? request[:verb].to_s.downcase : 'get'
      Severity: Minor
      Found in lib/ringcentral_sdk/rest/simple_client.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

      Block has too many lines. [31/25]
      Open

      Gem::Specification.new do |s|
        s.name        = lib
        s.version     = version
        s.date        = '2023-02-20'
        s.summary     = 'RingCentral SDK - Ruby SDK for the RingCentral Connect Platform API'
      Severity: Minor
      Found in ringcentral_sdk.gemspec by rubocop

      This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

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

            def create(opts)
              req  = RingCentralSdk::REST::Request::Fax.new
              meta = {}
      
              skip = {text: 1, files: 1}
      Severity: Minor
      Found in lib/ringcentral_sdk/rest/messages.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 retrieve has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def retrieve(params = {}, retrieve_all = true)
                @last_retrieved = Time.now.to_i
                uri = URI.parse "account/#{@account_id}/extension"
                uri.query = URI.encode_www_form(params) unless params.empty?
                res = @client.http.get do |req|
      Severity: Minor
      Found in lib/ringcentral_sdk/rest/cache/extensions.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 inflate_token has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def inflate_token
              @token = nil unless defined? @token
      
              if (@token.nil? || @token.empty?) && !token_file.nil? && !@token_file.empty?
                @token = IO.read @token_file if File.exist? @token_file
      Severity: Minor
      Found in lib/ringcentral_sdk/rest/configuration.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 set_token has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def set_token(token)
              if token.is_a? Hash
                token = OAuth2::AccessToken.from_hash(@oauth2client, token)
              end
      
      
      Severity: Minor
      Found in lib/ringcentral_sdk/rest/client.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 delete(request) if verb == 'delete'
      Severity: Major
      Found in lib/ringcentral_sdk/rest/simple_client.rb - About 30 mins to fix

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

              def inflate_retry_options
                if @retry == false
                  @retry_options = {}
                  return
                end
        Severity: Minor
        Found in lib/ringcentral_sdk/rest/configuration.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def initialize(opts = {})
                  @method = opts[:method]
                  @url = opts[:url]
                  @params = opts[:params]
                  @headers = opts[:headers]
        Severity: Minor
        Found in lib/ringcentral_sdk/rest/request/simple.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