fluent/fluent-plugin-s3

View on GitHub

Showing 34 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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              class S3Input
                class LZMA2Extractor < Extractor
                  S3Input.register_extractor('lzma2', self)
            
                  config_param :command_parameter, :string, default: '-qdc'
            Severity: Major
            Found in lib/fluent/plugin/s3_extractor_lzma2.rb and 1 other location - About 1 hr to fix
            lib/fluent/plugin/s3_extractor_lzo.rb on lines 2..35

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 70.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              class S3Input
                class LZOExtractor < Extractor
                  S3Input.register_extractor('lzo', self)
            
                  config_param :command_parameter, :string, default: '-qdc'
            Severity: Major
            Found in lib/fluent/plugin/s3_extractor_lzo.rb and 1 other location - About 1 hr to fix
            lib/fluent/plugin/s3_extractor_lzma2.rb on lines 2..35

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 70.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              class S3Output
                class LZOCompressor < Compressor
                  S3Output.register_compressor('lzo', self)
            
                  config_param :command_parameter, :string, default: '-qf1'
            Severity: Major
            Found in lib/fluent/plugin/s3_compressor_lzo.rb and 1 other location - About 1 hr to fix
            lib/fluent/plugin/s3_compressor_lzma2.rb on lines 2..32

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 67.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              class S3Output
                class LZMA2Compressor < Compressor
                  S3Output.register_compressor('lzma2', self)
            
                  config_param :command_parameter, :string, default: '-qf0'
            Severity: Major
            Found in lib/fluent/plugin/s3_compressor_lzma2.rb and 1 other location - About 1 hr to fix
            lib/fluent/plugin/s3_compressor_lzo.rb on lines 2..32

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 67.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                    when @instance_profile_credentials
                      c = @instance_profile_credentials
                      credentials_options[:retries] = c.retries if c.retries
                      credentials_options[:ip_address] = c.ip_address if c.ip_address
                      credentials_options[:port] = c.port if c.port
              Severity: Major
              Found in lib/fluent/plugin/in_s3.rb and 1 other location - About 1 hr to fix
              lib/fluent/plugin/out_s3.rb on lines 545..555

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 63.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                    when @instance_profile_credentials
                      c = @instance_profile_credentials
                      credentials_options[:retries] = c.retries if c.retries
                      credentials_options[:ip_address] = c.ip_address if c.ip_address
                      credentials_options[:port] = c.port if c.port
              Severity: Major
              Found in lib/fluent/plugin/out_s3.rb and 1 other location - About 1 hr to fix
              lib/fluent/plugin/in_s3.rb on lines 277..287

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 63.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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

                Severity
                Category
                Status
                Source
                Language