centosadmin/tdlib-ruby

View on GitHub

Showing 26 of 93 total issues

File client_methods.rb has 1683 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 4 days to fix

    File types.rb has 1097 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 optimize_storage has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def optimize_storage(size, ttl, count, immunity_delay, file_types, chat_ids, exclude_chat_ids, chat_limit)
      Severity: Major
      Found in lib/tdlib/client_methods.rb - About 1 hr to fix

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

            def forward_messages(chat_id, from_chat_id, message_ids, options, as_album, send_copy, remove_caption)
          Severity: Major
          Found in lib/tdlib/client_methods.rb - About 50 mins to fix

            Method search_chat_messages has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def search_chat_messages(chat_id, query, sender_user_id, from_message_id, offset, limit, filter)
            Severity: Major
            Found in lib/tdlib/client_methods.rb - About 50 mins to fix

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

                def search_messages(chat_list, query, offset_date, offset_chat_id, offset_message_id, limit)
              Severity: Minor
              Found in lib/tdlib/client_methods.rb - About 45 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 get_map_thumbnail_file has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def get_map_thumbnail_file(location, zoom, width, height, scale, chat_id)
                  Severity: Minor
                  Found in lib/tdlib/client_methods.rb - About 45 mins to fix

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

                      def set_game_score(chat_id, message_id, edit_message, user_id, score, force)
                    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 send_inline_query_result_message has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        def send_inline_query_result_message(chat_id, reply_to_message_id, options, query_id, result_id, hide_via_bot)
                      Severity: Minor
                      Found in lib/tdlib/client_methods.rb - About 45 mins to fix

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

                          def add_local_message(chat_id, sender_user_id, reply_to_message_id, disable_notification, input_message_content)
                        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 edit_proxy has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

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

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

                                def get_chat_history(chat_id, from_message_id, offset, limit, only_local)
                              Severity: Minor
                              Found in lib/tdlib/client_methods.rb - About 35 mins to fix

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

                                  def get_inline_query_results(bot_user_id, chat_id, user_location, query, offset)
                                Severity: Minor
                                Found in lib/tdlib/client_methods.rb - About 35 mins to fix

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

                                    def download_file(file_id, priority, offset, limit, synchronous)
                                  Severity: Minor
                                  Found in lib/tdlib/client_methods.rb - About 35 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language