fluent/fluentd

View on GitHub
lib/fluent/plugin/out_http.rb

Summary

Maintainability
D
1 day
Test Coverage

File out_http.rb has 314 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'net/http'
require 'uri'
require 'openssl'
require 'fluent/tls'
require 'fluent/plugin/output'
Severity: Minor
Found in lib/fluent/plugin/out_http.rb - About 3 hrs to fix

    Method setup_http_option has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def setup_http_option
          use_ssl = @endpoint.start_with?('https')
          opt = {
            open_timeout: @open_timeout,
            read_timeout: @read_timeout,
    Severity: Minor
    Found in lib/fluent/plugin/out_http.rb - About 3 hrs 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 configure has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def configure(conf)
          super
    
          @connection_cache = Array.new(actual_flush_thread_count, ConnectionCache.new("", nil)) if @reuse_connections
    
    
    Severity: Minor
    Found in lib/fluent/plugin/out_http.rb - About 2 hrs 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 configure has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def configure(conf)
          super
    
          @connection_cache = Array.new(actual_flush_thread_count, ConnectionCache.new("", nil)) if @reuse_connections
    
    
    Severity: Minor
    Found in lib/fluent/plugin/out_http.rb - About 1 hr to fix

      Method setup_http_option has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def setup_http_option
            use_ssl = @endpoint.start_with?('https')
            opt = {
              open_timeout: @open_timeout,
              read_timeout: @read_timeout,
      Severity: Minor
      Found in lib/fluent/plugin/out_http.rb - About 1 hr to fix

        Method send_request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def send_request(uri, req)
              res = if @reuse_connections
                      make_request_cached(uri, req)
                    else
                      make_request(uri, req) { |http| http.request(req) }
        Severity: Minor
        Found in lib/fluent/plugin/out_http.rb - About 55 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 make_request_cached has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def make_request_cached(uri, req)
              id = self.connection_cache_id_for_thread
              if id.nil?
                @connection_cache_id_mutex.synchronize {
                  id = @connection_cache_next_id
        Severity: Minor
        Found in lib/fluent/plugin/out_http.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

        There are no issues that match your filters.

        Category
        Status