fluent/fluentd

View on GitHub

Showing 664 of 664 total issues

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

    def configure(conf)
      compat_parameters_convert(conf, :parser)

      super

Severity: Minor
Found in lib/fluent/plugin/in_syslog.rb - About 1 hr to fix

    Method fetch_compacted_entries has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def fetch_compacted_entries
            entries = {}
    
            @file.pos = 0
            file_pos = 0
    Severity: Minor
    Found in lib/fluent/plugin/in_tail/position_file.rb - About 1 hr to fix

      Method parse has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self.parse(str, fname, basepath = Dir.pwd, v1_config = nil, syntax: :v1)
            parser = if fname =~ /\.rb$/ || syntax == :ruby
                       :ruby
                     elsif v1_config.nil?
                       case syntax
      Severity: Minor
      Found in lib/fluent/config.rb - About 1 hr to fix

        Method calc_next_time has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def calc_next_time
                  if @forever || !@secondary # primary
                    naive = naive_next_time(@steps)
                    if @forever
                      naive
        Severity: Minor
        Found in lib/fluent/plugin_helper/retry_state.rb - About 1 hr to fix

          Method format= has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def format=(fmt)
                return if @format == fmt
          
                @time_format = '%Y-%m-%d %H:%M:%S %z'
                @time_formatter = Strftime.new(@time_format) rescue nil
          Severity: Minor
          Found in lib/fluent/log.rb - About 1 hr to fix

            Method shutdown has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def shutdown
                    @_child_process_mutex.synchronize{ @_child_process_processes.keys }.each do |pid|
                      process_info = @_child_process_processes[pid]
                      next if !process_info
                      process_info.writeio && process_info.writeio.close rescue nil
            Severity: Minor
            Found in lib/fluent/plugin_helper/child_process.rb - About 1 hr to fix

              Method reload_config has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def reload_config(conf, supervisor: false)
                    @root_agent_mutex.synchronize do
                      # configure first to reduce down time while restarting
                      new_agent = RootAgent.new(log: log, system_config: @system_config)
                      ret = Fluent::StaticConfigAnalysis.call(conf, workers: system_config.workers)
              Severity: Minor
              Found in lib/fluent/engine.rb - About 1 hr to fix

                Method scan_double_quoted_string has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def scan_double_quoted_string
                        string = []
                        while true
                          if skip(/\"/)
                            if string.include?(nil)
                Severity: Minor
                Found in lib/fluent/config/literal_parser.rb - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                            if (!!timekey ^ !!timekey2) || (!!tag ^ !!tag2) || (!!variables ^ !!variables2)
                              # One has value in a field, but another doesn't have value in same field
                              # This case occurs very rarely
                              if timekey == timekey2 # including the case of nil == nil
                                if tag == tag2
                  Severity: Major
                  Found in lib/fluent/plugin/buffer.rb - About 1 hr to fix

                    Method expand has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            def expand(__str_to_eval__, tag, time, record, tag_parts, tag_prefix, tag_suffix, hostname)
                    Severity: Major
                    Found in lib/fluent/plugin/filter_record_transformer.rb - About 1 hr to fix

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

                          config_section :and, param_name: :and_conditions, multi: true do
                            config_section :regexp, param_name: :regexps, multi: true do
                              desc "The field name to which the regular expression is applied."
                              config_param :key, :string
                              desc "The regular expression."
                      Severity: Minor
                      Found in lib/fluent/plugin/filter_grep.rb and 1 other location - About 1 hr to fix
                      lib/fluent/plugin/filter_grep.rb on lines 73..85

                      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 47.

                      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 6 locations. Consider refactoring.
                      Open

                          def fatal(*args, &block)
                            return if @level > LEVEL_FATAL
                            type = log_type(args)
                            return if skipped_type?(type)
                            args << block.call if block
                      Severity: Major
                      Found in lib/fluent/log.rb and 5 other locations - About 1 hr to fix
                      lib/fluent/log.rb on lines 312..320
                      lib/fluent/log.rb on lines 334..342
                      lib/fluent/log.rb on lines 355..363
                      lib/fluent/log.rb on lines 376..384
                      lib/fluent/log.rb on lines 397..405

                      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 47.

                      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

                          config_section :or, param_name: :or_conditions, multi: true do
                            config_section :regexp, param_name: :regexps, multi: true do
                              desc "The field name to which the regular expression is applied."
                              config_param :key, :string
                              desc "The regular expression."
                      Severity: Minor
                      Found in lib/fluent/plugin/filter_grep.rb and 1 other location - About 1 hr to fix
                      lib/fluent/plugin/filter_grep.rb on lines 58..70

                      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 47.

                      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 3 locations. Consider refactoring.
                      Open

                              if conf.has_key?('localtime') || conf.has_key?('utc')
                                if conf.has_key?('localtime') && conf.has_key?('utc')
                                  raise Fluent::ConfigError, "both of utc and localtime are specified, use only one of them"
                                elsif conf.has_key?('localtime')
                                  inject_params['localtime'] = Fluent::Config.bool_value(conf['localtime'])
                      Severity: Major
                      Found in lib/fluent/compat/formatter_utils.rb and 2 other locations - About 1 hr to fix
                      lib/fluent/plugin_helper/compat_parameters.rb on lines 244..256
                      lib/fluent/plugin_helper/compat_parameters.rb on lines 290..302

                      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 47.

                      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 6 locations. Consider refactoring.
                      Open

                          def error(*args, &block)
                            return if @level > LEVEL_ERROR
                            type = log_type(args)
                            return if skipped_type?(type)
                            args << block.call if block
                      Severity: Major
                      Found in lib/fluent/log.rb and 5 other locations - About 1 hr to fix
                      lib/fluent/log.rb on lines 312..320
                      lib/fluent/log.rb on lines 334..342
                      lib/fluent/log.rb on lines 355..363
                      lib/fluent/log.rb on lines 376..384
                      lib/fluent/log.rb on lines 418..426

                      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 47.

                      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 3 locations. Consider refactoring.
                      Open

                              if conf.has_key?('localtime') || conf.has_key?('utc')
                                if conf.has_key?('localtime') && conf.has_key?('utc')
                                  raise Fluent::ConfigError, "both of utc and localtime are specified, use only one of them"
                                elsif conf.has_key?('localtime')
                                  hash['localtime'] = Fluent::Config.bool_value(conf['localtime'])
                      Severity: Major
                      Found in lib/fluent/plugin_helper/compat_parameters.rb and 2 other locations - About 1 hr to fix
                      lib/fluent/compat/formatter_utils.rb on lines 50..62
                      lib/fluent/plugin_helper/compat_parameters.rb on lines 290..302

                      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 47.

                      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 6 locations. Consider refactoring.
                      Open

                          def debug(*args, &block)
                            return if @level > LEVEL_DEBUG
                            type = log_type(args)
                            return if skipped_type?(type)
                            args << block.call if block
                      Severity: Major
                      Found in lib/fluent/log.rb and 5 other locations - About 1 hr to fix
                      lib/fluent/log.rb on lines 312..320
                      lib/fluent/log.rb on lines 355..363
                      lib/fluent/log.rb on lines 376..384
                      lib/fluent/log.rb on lines 397..405
                      lib/fluent/log.rb on lines 418..426

                      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 47.

                      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 6 locations. Consider refactoring.
                      Open

                          def info(*args, &block)
                            return if @level > LEVEL_INFO
                            type = log_type(args)
                            return if skipped_type?(type)
                            args << block.call if block
                      Severity: Major
                      Found in lib/fluent/log.rb and 5 other locations - About 1 hr to fix
                      lib/fluent/log.rb on lines 312..320
                      lib/fluent/log.rb on lines 334..342
                      lib/fluent/log.rb on lines 376..384
                      lib/fluent/log.rb on lines 397..405
                      lib/fluent/log.rb on lines 418..426

                      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 47.

                      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 6 locations. Consider refactoring.
                      Open

                          def trace(*args, &block)
                            return if @level > LEVEL_TRACE
                            type = log_type(args)
                            return if skipped_type?(type)
                            args << block.call if block
                      Severity: Major
                      Found in lib/fluent/log.rb and 5 other locations - About 1 hr to fix
                      lib/fluent/log.rb on lines 334..342
                      lib/fluent/log.rb on lines 355..363
                      lib/fluent/log.rb on lines 376..384
                      lib/fluent/log.rb on lines 397..405
                      lib/fluent/log.rb on lines 418..426

                      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 47.

                      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 6 locations. Consider refactoring.
                      Open

                          def warn(*args, &block)
                            return if @level > LEVEL_WARN
                            type = log_type(args)
                            return if skipped_type?(type)
                            args << block.call if block
                      Severity: Major
                      Found in lib/fluent/log.rb and 5 other locations - About 1 hr to fix
                      lib/fluent/log.rb on lines 312..320
                      lib/fluent/log.rb on lines 334..342
                      lib/fluent/log.rb on lines 355..363
                      lib/fluent/log.rb on lines 397..405
                      lib/fluent/log.rb on lines 418..426

                      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 47.

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language