fluent/fluent-plugin-s3

View on GitHub

Showing 20 of 34 total issues

Method setup_credentials has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
Open

    def setup_credentials
      options = {}
      credentials_options = {}
      case
      when @assume_role_credentials
Severity: Minor
Found in lib/fluent/plugin/out_s3.rb - About 1 day 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

File out_s3.rb has 585 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'fluent/plugin/output'
require 'fluent/log-ext'
require 'fluent/timezone'
require 'aws-sdk-s3'
require 'zlib'
Severity: Major
Found in lib/fluent/plugin/out_s3.rb - About 1 day to fix

    Method write has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        def write(chunk)
          i = 0
          metadata = chunk.metadata
          previous_path = nil
          time_slice = if metadata.timekey.nil?
    Severity: Minor
    Found in lib/fluent/plugin/out_s3.rb - About 5 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

    File in_s3.rb has 391 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'fluent/plugin/input'
    require 'fluent/log-ext'
    
    require 'aws-sdk-s3'
    require 'aws-sdk-sqs'
    Severity: Minor
    Found in lib/fluent/plugin/in_s3.rb - About 5 hrs to fix

      Method setup_credentials has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          def setup_credentials
            options = {}
            credentials_options = {}
            case
            when @aws_key_id && @aws_sec_key
      Severity: Minor
      Found in lib/fluent/plugin/in_s3.rb - About 4 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 write has 101 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def write(chunk)
            i = 0
            metadata = chunk.metadata
            previous_path = nil
            time_slice = if metadata.timekey.nil?
      Severity: Major
      Found in lib/fluent/plugin/out_s3.rb - About 4 hrs to fix

        Method setup_credentials has 84 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def setup_credentials
              options = {}
              credentials_options = {}
              case
              when @assume_role_credentials
        Severity: Major
        Found in lib/fluent/plugin/out_s3.rb - About 3 hrs to fix

          Method run has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def run
                options = {}
                options[:wait_time_seconds] = @sqs.wait_time_seconds
                options[:skip_delete] = @sqs.skip_delete
                @poller.before_request do |stats|
          Severity: Minor
          Found in lib/fluent/plugin/in_s3.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 setup_credentials has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def setup_credentials
                options = {}
                credentials_options = {}
                case
                when @aws_key_id && @aws_sec_key
          Severity: Minor
          Found in lib/fluent/plugin/in_s3.rb - About 1 hr to fix

            Method configure has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def configure(conf)
                  compat_parameters_convert(conf, :buffer, :formatter, :inject)
            
                  super
            
            
            Severity: Minor
            Found in lib/fluent/plugin/out_s3.rb - About 1 hr to fix

              Method configure has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def configure(conf)
                    compat_parameters_convert(conf, :buffer, :formatter, :inject)
              
                    super
              
              
              Severity: Minor
              Found in lib/fluent/plugin/out_s3.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 start has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def start
                    options = setup_credentials
                    options[:region] = @s3_region if @s3_region
                    options[:endpoint] = @s3_endpoint if @s3_endpoint
                    options[:use_accelerate_endpoint] = @enable_transfer_acceleration
              Severity: Minor
              Found in lib/fluent/plugin/out_s3.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 run has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def run
                    options = {}
                    options[:wait_time_seconds] = @sqs.wait_time_seconds
                    options[:skip_delete] = @sqs.skip_delete
                    @poller.before_request do |stats|
              Severity: Minor
              Found in lib/fluent/plugin/in_s3.rb - About 1 hr to fix

                Method compress has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                      def compress(chunk, tmp)
                        chunk_is_file = @buffer_type == 'file'
                        path = if chunk_is_file
                                 chunk.path
                               else
                Severity: Minor
                Found in lib/fluent/plugin/s3_compressor_gzip_command.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 compress has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def compress(chunk, tmp)
                        chunk_is_file = @buffer_type == 'file'
                        path = if chunk_is_file
                                 chunk.path
                               else
                Severity: Minor
                Found in lib/fluent/plugin/s3_compressor_gzip_command.rb - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                            credentials_options[:client] = if iam_user_credentials
                                                             Aws::STS::Client.new(region: region, endpoint: c.sts_endpoint_url, credentials: iam_user_credentials)
                                                           else
                                                             Aws::STS::Client.new(region: region, endpoint: c.sts_endpoint_url)
                                                           end
                  Severity: Major
                  Found in lib/fluent/plugin/out_s3.rb - About 45 mins to fix

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

                          def compress(chunk, tmp)
                            chunk_is_file = @buffer_type == "file"
                            path = if chunk_is_file
                                     chunk.path
                                   else
                    Severity: Minor
                    Found in lib/fluent/plugin/s3_compressor_parquet.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

                    Avoid deeply nested control flow statements.
                    Open

                              credentials_options[:client] = if iam_user_credentials
                                                               Aws::STS::Client.new(region: region, credentials: iam_user_credentials)
                                                             else
                                                               Aws::STS::Client.new(region: region)
                                                             end
                    Severity: Major
                    Found in lib/fluent/plugin/out_s3.rb - About 45 mins to fix

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

                          def configure(conf)
                            super
                      
                            if reject_s3_endpoint?
                              raise Fluent::ConfigError, "s3_endpoint parameter is not supported for S3, use s3_region instead. This parameter is for S3 compatible services"
                      Severity: Minor
                      Found in lib/fluent/plugin/in_s3.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 extract has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def extract(io)
                              parts = []
                              loop do
                                unused = nil
                                Zlib::GzipReader.wrap(io) do |gz|
                      Severity: Minor
                      Found in lib/fluent/plugin/in_s3.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