centosadmin/tdlib-ruby

View on GitHub

Showing 12 of 65 total issues

File client_methods.rb has 1412 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module TD::ClientMethods
  # Accepts an incoming call.
  #
  # @param call_id [Integer] Call identifier.
  # @param protocol [TD::Types::CallProtocol] Description of the call protocols supported by the client.
Severity: Major
Found in lib/tdlib/client_methods.rb - About 3 days to fix

    File types.rb has 872 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'dry-struct'
    require 'dry-types'
    
    module TD::Types
      include Dry::Types.module
    Severity: Major
    Found in lib/tdlib/types.rb - About 2 days to fix

      Method wrap has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        def wrap(object)
          # Wrapping each entry in array
          if object.kind_of?(::Array)
            object.map { |o| wrap(o) }
          elsif object.kind_of?(::Hash)
      Severity: Minor
      Found in lib/tdlib/types.rb - About 1 hr 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 broadcast has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def broadcast(query)
          return dead_client_promise if dead?
      
          Promises.future do
            condition = ConditionVariable.new
      Severity: Minor
      Found in lib/tdlib/client.rb - About 1 hr 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 answer_inline_query has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def answer_inline_query(inline_query_id, is_personal, results, cache_time, next_offset, switch_pm_text,
                                switch_pm_parameter)
      Severity: Major
      Found in lib/tdlib/client_methods.rb - About 50 mins to fix

        Method get_chat_event_log has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def get_chat_event_log(chat_id, query, from_event_id, limit, filters, user_ids)
        Severity: Minor
        Found in lib/tdlib/client_methods.rb - About 45 mins to fix

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

            def ready
              return dead_client_promise if dead?
              return Promises.fulfilled_future(self) if ready?
          
              Promises.future do
          Severity: Minor
          Found in lib/tdlib/client.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 edit_proxy has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def edit_proxy(proxy_id, server, port, type, enable = false)
          Severity: Minor
          Found in lib/tdlib/client_methods.rb - About 35 mins to fix

            Method get_map_thumbnail_file has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def get_map_thumbnail_file(location, zoom = 13, width = 1024, height = 1024, scale = 1, chat_id: 0)
            Severity: Minor
            Found in lib/tdlib/client_methods.rb - About 35 mins to fix

              Method get_passport_authorization_form has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def get_passport_authorization_form(bot_user_id, scope, public_key, nonce, password)
              Severity: Minor
              Found in lib/tdlib/client_methods.rb - About 35 mins to fix

                Method answer_callback_query has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def answer_callback_query(callback_query_id, text, show_alert, url, cache_time)
                Severity: Minor
                Found in lib/tdlib/client_methods.rb - About 35 mins to fix

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

                    def on(update_type, &action)
                      if update_type.is_a?(String)
                        if (type_const = TD::Types::LOOKUP_TABLE[update_type])
                          update_type = TD::Types.const_get("TD::Types::#{type_const}")
                        else
                  Severity: Minor
                  Found in lib/tdlib/client.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