fluent/fluentd

View on GitHub
lib/fluent/plugin/in_syslog.rb

Summary

Maintainability
D
1 day
Test Coverage

Method message_handler has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    def message_handler(data, sock)
      pri = nil
      text = data
      unless @parser_parse_priority
        m = SYSLOG_REGEXP.match(data)
Severity: Minor
Found in lib/fluent/plugin/in_syslog.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

Method start_tcp_server has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def start_tcp_server(tls: false)
      octet_count_frame = @frame_type == :octet_count

      delimiter = octet_count_frame ? " " : @delimiter
      delimiter_size = delimiter.size
Severity: Minor
Found in lib/fluent/plugin/in_syslog.rb - About 3 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 message_handler has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def message_handler(data, sock)
      pri = nil
      text = data
      unless @parser_parse_priority
        m = SYSLOG_REGEXP.match(data)
Severity: Minor
Found in lib/fluent/plugin/in_syslog.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, :parser)
    
          super
    
    
    Severity: Minor
    Found in lib/fluent/plugin/in_syslog.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_tcp_server has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def start_tcp_server(tls: false)
          octet_count_frame = @frame_type == :octet_count
    
          delimiter = octet_count_frame ? " " : @delimiter
          delimiter_size = delimiter.size
    Severity: Minor
    Found in lib/fluent/plugin/in_syslog.rb - About 1 hr to fix

      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

        There are no issues that match your filters.

        Category
        Status