lardawge/rfm

View on GitHub

Showing 9 of 18 total issues

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

    def find_by_code(code) #:nodoc:
      case code
      when 0..99 then SystemError
      when 100..199
        if code == 101; RecordMissingError
Severity: Minor
Found in lib/rfm/error.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 expand_options has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

      def expand_options(options)
        result = {}
        options.each do |key,value|
          case key
          when :max_records
Severity: Minor
Found in lib/rfm/server.rb - About 4 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 expand_options has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def expand_options(options)
        result = {}
        options.each do |key,value|
          case key
          when :max_records
Severity: Major
Found in lib/rfm/server.rb - About 2 hrs to fix

    Method find_by_code has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def find_by_code(code) #:nodoc:
          case code
          when 0..99 then SystemError
          when 100..199
            if code == 101; RecordMissingError
    Severity: Minor
    Found in lib/rfm/error.rb - About 1 hr to fix

      Method initialize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(record, result, field_meta, layout, portal=nil)
            @record_id = record['record-id']
            @mod_id    = record['mod-id']
            @mods      = {}
            @layout    = layout
      Severity: Minor
      Found in lib/rfm/record.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 initialize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def initialize(record, result, field_meta, layout, portal=nil)
            @record_id = record['record-id']
            @mod_id    = record['mod-id']
            @mods      = {}
            @layout    = layout
      Severity: Minor
      Found in lib/rfm/record.rb - About 1 hr to fix

        Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def initialize(record, result, field_meta, layout, portal=nil)
        Severity: Minor
        Found in lib/rfm/record.rb - About 35 mins to fix

          Method build_records has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def self.build_records(records, result, field_meta, layout, portal=nil)
          Severity: Minor
          Found in lib/rfm/record.rb - About 35 mins to fix

            Method http_fetch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def http_fetch(path, post_data, limit=10)
                    raise Rfm::CommunicationError.new("While trying to reach the Web Publishing Engine, RFM was redirected too many times.") if limit == 0
                
                    uri.path = path
                    uri.query_values = post_data
            Severity: Minor
            Found in lib/rfm/server.rb - About 35 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

            Severity
            Category
            Status
            Source
            Language