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']
Consider simplifying this complex logical expression. Open
if
(s.key?('deliveryMode') && s['deliveryMode']) \
&& (s['deliveryMode'].key?('subscriberKey') && s['deliveryMode']['subscriberKey']) \
&& (
s['deliveryMode'].key?('address') \
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'
- Read upRead up
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'
- Read upRead up
- Exclude checks
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}
- Read upRead up
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|
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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'
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
- Read upRead up
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]
- Read upRead up
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"