ringcentral-ruby/glip-sdk-ruby

View on GitHub
lib/glip_sdk/rest/groups.rb

Summary

Maintainability
A
35 mins
Test Coverage

Assignment Branch Condition size for all_groups is too high. [22.91/15]
Open

      def all_groups(params = {})
        groups = []
        get_next = true
        while get_next
          res = get params
Severity: Minor
Found in lib/glip_sdk/rest/groups.rb by rubocop

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. [13/10]
Open

      def all_groups(params = {})
        groups = []
        get_next = true
        while get_next
          res = get params
Severity: Minor
Found in lib/glip_sdk/rest/groups.rb by rubocop

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 all_groups has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def all_groups(params = {})
        groups = []
        get_next = true
        while get_next
          res = get params
Severity: Minor
Found in lib/glip_sdk/rest/groups.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

Line is too long. [83/80]
Open

        @subscription.subscribe ['/restapi/v1.0/account/~/extension/~/glip/groups']
Severity: Minor
Found in lib/glip_sdk/rest/groups.rb by rubocop

Use !empty? instead of length > 0.
Open

          groups.concat(res.body['records']) if res.body['records'].length > 0
Severity: Minor
Found in lib/glip_sdk/rest/groups.rb by rubocop

This cop checks for numeric comparisons that can be replaced by a predicate method, such as receiver.length == 0, receiver.length > 0, receiver.length != 0, receiver.length < 1 and receiver.size == 0 that can be replaced by receiver.empty? and !receiver.empty.

Example:

# bad
[1, 2, 3].length == 0
0 == "foobar".length
array.length < 1
{a: 1, b: 2}.length != 0
string.length > 0
hash.size > 0

# good
[1, 2, 3].empty?
"foobar".empty?
array.empty?
!{a: 1, b: 2}.empty?
!string.empty?
!hash.empty?

Line is too long. [96/80]
Open

            @api.config.logger.info "PrevPageToken [#{res.body['navigation']['prevPageToken']}]"
Severity: Minor
Found in lib/glip_sdk/rest/groups.rb by rubocop

Line is too long. [88/80]
Open

          if res.body.key?('navigation') && res.body['navigation'].key?('prevPageToken')
Severity: Minor
Found in lib/glip_sdk/rest/groups.rb by rubocop

Missing top-level class documentation comment.
Open

    class Groups
Severity: Minor
Found in lib/glip_sdk/rest/groups.rb by rubocop

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

There are no issues that match your filters.

Category
Status