grokify/lita-ringcentral

View on GitHub
lib/lita/adapters/ringcentral/connector.rb

Summary

Maintainability
A
1 hr
Test Coverage

Method has too many lines. [13/10]
Open

        def initialize(robot, app_key, app_secret, server, username, extension, password, token, sms_number)
          @robot = robot
          @client = RingCentralSdk::REST::Client.new do |config|
            config.server_url = server
            config.app_key = app_key

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

        def client_connect
          Lita.logger.info("#{@logger_prefix}Authenticating with RingCentral.")
          if @token.nil?
            @client.authorize_password @username, @extension, @password
          else

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 initialize has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def initialize(robot, app_key, app_secret, server, username, extension, password, token, sms_number)
Severity: Major
Found in lib/lita/adapters/ringcentral/connector.rb - About 1 hr to fix

    Avoid parameter lists longer than 5 parameters. [9/5]
    Open

            def initialize(robot, app_key, app_secret, server, username, extension, password, token, sms_number)

    This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

    Final newline missing.
    Open

    end

    Missing top-level class documentation comment.
    Open

          class Connector

    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

    Indent the right bracket the same as the first position after the preceding left parenthesis.
    Open

              ])

    This cop checks the indentation of the first element in an array literal where the opening bracket and the first element are on separate lines. The other elements' indentations are handled by the AlignArray cop.

    By default, array literals that are arguments in a method call with parentheses, and where the opening square bracket of the array is on the same line as the opening parenthesis of the method call, shall have their first element indented one step (two spaces) more than the position inside the opening parenthesis.

    Other array literals shall have their first element indented one step more than the start of the line where the opening square bracket is.

    This default style is called 'specialinsideparentheses'. Alternative styles are 'consistent' and 'align_brackets'. Here are examples:

    Example: EnforcedStyle: specialinsideparentheses (default)

    # The `special_inside_parentheses` style enforces that the first
    # element in an array literal where the opening bracket and first
    # element are on seprate lines is indented one step (two spaces) more
    # than the position inside the opening parenthesis.
    
    #bad
    array = [
      :value
    ]
    and_in_a_method_call([
      :no_difference
                         ])
    
    #good
    array = [
      :value
    ]
    but_in_a_method_call([
                           :its_like_this
                         ])

    Example: EnforcedStyle: consistent

    # The `consistent` style enforces that the first element in an array
    # literal where the opening bracket and the first element are on
    # seprate lines is indented the same as an array literal which is not
    # defined inside a method call.
    
    #bad
    # consistent
    array = [
      :value
    ]
    but_in_a_method_call([
                           :its_like_this
    ])
    
    #good
    array = [
      :value
    ]
    and_in_a_method_call([
      :no_difference
    ])

    Example: EnforcedStyle: align_brackets

    # The `align_brackets` style enforces that the opening and closing
    # brackets are indented to the same position.
    
    #bad
    # align_brackets
    and_now_for_something = [
                              :completely_different
    ]
    
    #good
    # align_brackets
    and_now_for_something = [
                              :completely_different
                            ]

    Line is too long. [108/80]
    Open

            def initialize(robot, app_key, app_secret, server, username, extension, password, token, sms_number)

    Use 2 spaces for indentation in an array, relative to the first position after the preceding left parenthesis.
    Open

                '/restapi/v1.0/account/~/extension/~/message-store/instant?type=SMS'

    This cop checks the indentation of the first element in an array literal where the opening bracket and the first element are on separate lines. The other elements' indentations are handled by the AlignArray cop.

    By default, array literals that are arguments in a method call with parentheses, and where the opening square bracket of the array is on the same line as the opening parenthesis of the method call, shall have their first element indented one step (two spaces) more than the position inside the opening parenthesis.

    Other array literals shall have their first element indented one step more than the start of the line where the opening square bracket is.

    This default style is called 'specialinsideparentheses'. Alternative styles are 'consistent' and 'align_brackets'. Here are examples:

    Example: EnforcedStyle: specialinsideparentheses (default)

    # The `special_inside_parentheses` style enforces that the first
    # element in an array literal where the opening bracket and first
    # element are on seprate lines is indented one step (two spaces) more
    # than the position inside the opening parenthesis.
    
    #bad
    array = [
      :value
    ]
    and_in_a_method_call([
      :no_difference
                         ])
    
    #good
    array = [
      :value
    ]
    but_in_a_method_call([
                           :its_like_this
                         ])

    Example: EnforcedStyle: consistent

    # The `consistent` style enforces that the first element in an array
    # literal where the opening bracket and the first element are on
    # seprate lines is indented the same as an array literal which is not
    # defined inside a method call.
    
    #bad
    # consistent
    array = [
      :value
    ]
    but_in_a_method_call([
                           :its_like_this
    ])
    
    #good
    array = [
      :value
    ]
    and_in_a_method_call([
      :no_difference
    ])

    Example: EnforcedStyle: align_brackets

    # The `align_brackets` style enforces that the opening and closing
    # brackets are indented to the same position.
    
    #bad
    # align_brackets
    and_now_for_something = [
                              :completely_different
    ]
    
    #good
    # align_brackets
    and_now_for_something = [
                              :completely_different
                            ]

    There are no issues that match your filters.

    Category
    Status