fluent/fluentd

View on GitHub

Showing 653 of 653 total issues

File output.rb has 1288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'fluent/env'
require 'fluent/error'
require 'fluent/plugin/base'
require 'fluent/plugin/buffer'
require 'fluent/plugin_helper/record_accessor'
Severity: Major
Found in lib/fluent/plugin/output.rb - About 3 days to fix

    Method generate has a Cognitive Complexity of 138 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.generate(proxy, conf, logger, plugin_class, stack = [], strict_config_value = false)
            return nil if conf.nil?
    
            section_stack = ""
            unless stack.empty?
    Severity: Minor
    Found in lib/fluent/config/section.rb - About 2 days 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_tail.rb has 1056 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'cool.io'
    
    require 'fluent/plugin/input'
    require 'fluent/config/error'
    require 'fluent/event'
    Severity: Major
    Found in lib/fluent/plugin/in_tail.rb - About 2 days to fix

      Method write_step_by_step has a Cognitive Complexity of 111 (exceeds 5 allowed). Consider refactoring.
      Open

            def write_step_by_step(metadata, data, format, splits_count, &block)
              splits = []
              if splits_count > data.size
                splits_count = data.size
              end
      Severity: Minor
      Found in lib/fluent/plugin/buffer.rb - About 2 days 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 111 (exceeds 5 allowed). Consider refactoring.
      Open

            def configure(conf)
              unless implement?(:synchronous) || implement?(:buffered) || implement?(:delayed_commit)
                raise "BUG: output plugin must implement some methods. see developer documents."
              end
      
      
      Severity: Minor
      Found in lib/fluent/plugin/output.rb - About 2 days 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 supervisor.rb has 869 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'fileutils'
      require 'open3'
      require 'pathname'
      
      require 'fluent/config'
      Severity: Major
      Found in lib/fluent/supervisor.rb - About 2 days to fix

        Method start has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
        Open

            def start
              super
        
              log.info "listening tcp socket", bind: @bind, port: @port
              del_size = @delimiter.length
        Severity: Minor
        Found in lib/fluent/plugin/in_tcp.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 buffer.rb has 719 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'fluent/plugin/base'
        require 'fluent/plugin/owned_by_mixin'
        require 'fluent/plugin_id'
        require 'fluent/plugin_helper'
        require 'fluent/unique_id'
        Severity: Major
        Found in lib/fluent/plugin/buffer.rb - About 1 day to fix

          File out_forward.rb has 649 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'fluent/output'
          require 'fluent/config/error'
          require 'fluent/clock'
          require 'fluent/tls'
          require 'base64'
          Severity: Major
          Found in lib/fluent/plugin/out_forward.rb - About 1 day to fix

            Method parse_element has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
            Open

                  def parse_element(root_element, elem_name, attrs = {}, elems = [])
                    while true
                      spacing
                      if eof?
                        if root_element
            Severity: Minor
            Found in lib/fluent/config/v1_parser.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

            Class Output has 73 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class Output < Base
                  include PluginId
                  include PluginLoggerMixin
                  include PluginHelper::Mixin
                  include UniqueId::Mixin
            Severity: Major
            Found in lib/fluent/plugin/output.rb - About 1 day to fix

              File server.rb has 618 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'fluent/plugin_helper/event_loop'
              
              require 'serverengine'
              require 'cool.io'
              require 'socket'
              Severity: Major
              Found in lib/fluent/plugin_helper/server.rb - About 1 day to fix

                File log.rb has 587 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require 'forwardable'
                require 'logger'
                
                module Fluent
                  class Log
                Severity: Major
                Found in lib/fluent/log.rb - About 1 day to fix

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

                      def configure(conf)
                        used_worker_ids = []
                        available_worker_ids = (0..Fluent::Engine.system_config.workers - 1).to_a
                        # initialize <worker> elements
                        conf.elements(name: 'worker').each do |e|
                  Severity: Minor
                  Found in lib/fluent/root_agent.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

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

                      def configure(conf)
                        compat_parameters_convert(conf, :buffer, default_chunk_key: 'tag')
                  
                        super
                  
                  
                  Severity: Minor
                  Found in lib/fluent/plugin/out_forward.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 output.rb has 559 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'fluent/plugin'
                  require 'fluent/plugin/buffer'
                  require 'fluent/plugin/output'
                  require 'fluent/plugin/bare_output'
                  require 'fluent/compat/call_super_mixin'
                  Severity: Major
                  Found in lib/fluent/compat/output.rb - About 1 day to fix

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

                    module Fluent
                      module PluginHelper
                        module Parser
                          def parser_create(usage: '', type: nil, conf: nil, default_type: nil)
                            parser = @_parsers[usage]
                    Severity: Major
                    Found in lib/fluent/plugin_helper/parser.rb and 1 other location - About 1 day to fix
                    lib/fluent/plugin_helper/formatter.rb on lines 22..144

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

                    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 child_process_execute_once has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def child_process_execute_once(
                              title, command, arguments, subprocess_name, mode, stderr, env, unsetenv, chdir,
                              internal_encoding, external_encoding, scrub, replace_string, wait_timeout, on_exit_callback, &block
                          )
                            spawn_args = if arguments || subprocess_name
                    Severity: Minor
                    Found in lib/fluent/plugin_helper/child_process.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

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

                    module Fluent
                      module PluginHelper
                        module Formatter
                          def formatter_create(usage: '', type: nil, conf: nil, default_type: nil)
                            formatter = @_formatters[usage]
                    Severity: Major
                    Found in lib/fluent/plugin_helper/formatter.rb and 1 other location - About 1 day to fix
                    lib/fluent/plugin_helper/parser.rb on lines 22..144

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

                    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 expand_paths has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def expand_paths
                          date = Fluent::EventTime.now
                          paths = []
                          @paths.each { |path|
                            path = if @path_timezone
                    Severity: Minor
                    Found in lib/fluent/plugin/in_tail.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

                    Severity
                    Category
                    Status
                    Source
                    Language