Showing 51 of 129 total issues
Class has too many lines. [228/150] Open
class Subscription
include Observable
RENEW_HANDICAP = 60
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Class has too many lines. [194/150] Open
class Client
ACCESS_TOKEN_TTL = 600 # 10 minutes
REFRESH_TOKEN_TTL = 36_000 # 10 hours
REFRESH_TOKEN_TTL_REMEMBER = 604_800 # 1 week
ACCOUNT_PREFIX = '/account/'.freeze
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for _subscribe_at_pubnub is too high. [47.19/30] Open
def _subscribe_at_pubnub
raise 'Subscription is not alive' unless alive?
s_key = @_subscription['deliveryMode']['subscriberKey']
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [28/15] Open
def set_token(token)
if token.is_a? Hash
token = OAuth2::AccessToken.from_hash(@oauth2client, token)
end
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [26/15] Open
def _subscribe_at_pubnub
raise 'Subscription is not alive' unless alive?
s_key = @_subscription['deliveryMode']['subscriberKey']
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [26/15] Open
def subscribe(events = nil)
set_events(events) if events.is_a? Array
raise 'Events are undefined' unless @event_filters.is_a?(Array) && !@event_filters.empty?
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Class Subscription
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Subscription
include Observable
RENEW_HANDICAP = 60
Cyclomatic complexity for load_environment is too high. [13/6] Open
def load_environment
Dotenv.load
@server_url = ENV['RINGCENTRAL_SERVER_URL'] if ENV.key? 'RINGCENTRAL_SERVER_URL'
@client_id = ENV['RINGCENTRAL_CLIENT_ID'] if ENV.key? 'RINGCENTRAL_CLIENT_ID'
@client_secret = ENV['RINGCENTRAL_CLIENT_SECRET'] if ENV.key? 'RINGCENTRAL_CLIENT_SECRET'
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Perceived complexity for load_environment is too high. [13/7] Open
def load_environment
Dotenv.load
@server_url = ENV['RINGCENTRAL_SERVER_URL'] if ENV.key? 'RINGCENTRAL_SERVER_URL'
@client_id = ENV['RINGCENTRAL_CLIENT_ID'] if ENV.key? 'RINGCENTRAL_CLIENT_ID'
@client_secret = ENV['RINGCENTRAL_CLIENT_SECRET'] if ENV.key? 'RINGCENTRAL_CLIENT_SECRET'
- Read upRead up
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Method has too many lines. [21/15] Open
def send_request(request_sdk = {})
if request_sdk.is_a? Hash
request_sdk = RingCentralSdk::REST::Request::Simple.new request_sdk
elsif !request_sdk.is_a? RingCentralSdk::REST::Request::Base
raise ArgumentError, 'Request is not a RingCentralSdk::REST::Request::Base'
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [21/15] 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
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Perceived complexity for create_url is too high. [12/7] Open
def create_url(url, add_server = false, add_method = nil, add_token = false)
built_url = ''
has_http = !url.index('http://').nil? && !url.index('https://').nil?
built_url += @config.server_url if add_server && !has_http
- Read upRead up
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Cyclomatic complexity for inflate_token is too high. [11/6] 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
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Method has too many lines. [20/15] Open
def renew(events = nil)
set_events(events) if events.is_a? Array
raise 'Subscription is not alive' unless alive?
raise 'Events are undefined' if @event_filters.empty?
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [20/15] Open
def create_url(url, add_server = false, add_method = nil, add_token = false)
built_url = ''
has_http = !url.index('http://').nil? && !url.index('https://').nil?
built_url += @config.server_url if add_server && !has_http
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [20/15] Open
def retrieve_for_event(event, params = {})
unless event.is_a? RingCentralSdk::REST::Event
raise ArgumentError, 'retrieve_for_event requires RingCentralSdk::REST::Event argument'
end
url = event.doc.getAttr :event
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Perceived complexity for inflate_token is too high. [11/7] 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
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Cyclomatic complexity for create_url is too high. [9/6] Open
def create_url(url, add_server = false, add_method = nil, add_token = false)
built_url = ''
has_http = !url.index('http://').nil? && !url.index('https://').nil?
built_url += @config.server_url if add_server && !has_http
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Method has too many lines. [18/15] Open
def create(opts)
req = RingCentralSdk::REST::Request::Fax.new
meta = {}
skip = {text: 1, files: 1}
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Cyclomatic complexity for send_request is too high. [8/6] Open
def send_request(request_sdk = {})
if request_sdk.is_a? Hash
request_sdk = RingCentralSdk::REST::Request::Simple.new request_sdk
elsif !request_sdk.is_a? RingCentralSdk::REST::Request::Base
raise ArgumentError, 'Request is not a RingCentralSdk::REST::Request::Base'
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.