fluent/fluentd

View on GitHub
lib/fluent/command/plugin_config_formatter.rb

Summary

Maintainability
C
1 day
Test Coverage

File plugin_config_formatter.rb has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "erb"
require "optparse"
require "pathname"
require "fluent/plugin"
require "fluent/env"
Severity: Minor
Found in lib/fluent/command/plugin_config_formatter.rb - About 2 hrs to fix

    Method dump_section_markdown has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def dump_section_markdown(base_section, level = 0)
        dumped = ""
        if base_section[:section]
          sections = []
          params = base_section
    Severity: Minor
    Found in lib/fluent/command/plugin_config_formatter.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 dump_section_txt has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def dump_section_txt(base_section, level = 0)
        dumped = ""
        indent = " " * level
        if base_section[:section]
          sections = []
    Severity: Minor
    Found in lib/fluent/command/plugin_config_formatter.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 dump_section_markdown has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def dump_section_markdown(base_section, level = 0)
        dumped = ""
        if base_section[:section]
          sections = []
          params = base_section
    Severity: Minor
    Found in lib/fluent/command/plugin_config_formatter.rb - About 1 hr to fix

      Method call has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        def call
          parse_options!
          init_libraries
          @plugin = Fluent::Plugin.__send__("new_#{@plugin_type}", @plugin_name)
          dumped_config = {}
      Severity: Minor
      Found in lib/fluent/command/plugin_config_formatter.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 prepare_option_parser has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def prepare_option_parser
          @parser = OptionParser.new
          @parser.version = Fluent::VERSION
          @parser.banner = <<BANNER
      Usage: #{$0} [options] <type> <name>
      Severity: Minor
      Found in lib/fluent/command/plugin_config_formatter.rb - About 1 hr to fix

        Method dump_section_txt has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def dump_section_txt(base_section, level = 0)
            dumped = ""
            indent = " " * level
            if base_section[:section]
              sections = []
        Severity: Minor
        Found in lib/fluent/command/plugin_config_formatter.rb - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status