takus/fluent-plugin-dynamodb-streams

View on GitHub

Showing 8 of 8 total issues

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

    def run
      while @running
        sleep @fetch_interval

        get_shards.each do |s|
Severity: Minor
Found in lib/fluent/plugin/in_dynamodb_streams.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 format_attribute_value has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def format_attribute_value(v)
      if v.m
        return dynamodb_to_hash(v.m)
      elsif v.l
        return v.l.map {|i| format_attribute_value(i) }
Severity: Minor
Found in lib/fluent/plugin/in_dynamodb_streams.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 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def run
      while @running
        sleep @fetch_interval

        get_shards.each do |s|
Severity: Minor
Found in lib/fluent/plugin/in_dynamodb_streams.rb - About 1 hr to fix

    Method load_sequence has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def load_sequence(shard_id)
          if @pos_file
            return nil unless File.exist?("#{@pos_file}.#{shard_id}")
            File.read("#{@pos_file}.#{shard_id}").chomp
          else
    Severity: Minor
    Found in lib/fluent/plugin/in_dynamodb_streams.rb - About 45 mins 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

    Avoid too many return statements within this method.
    Open

            return v.bool
    Severity: Major
    Found in lib/fluent/plugin/in_dynamodb_streams.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return v.s
      Severity: Major
      Found in lib/fluent/plugin/in_dynamodb_streams.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return null
        Severity: Major
        Found in lib/fluent/plugin/in_dynamodb_streams.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return BigDecimal.new(v.n).to_i
          Severity: Major
          Found in lib/fluent/plugin/in_dynamodb_streams.rb - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language