pboling/csv_pirate

View on GitHub

Showing 18 of 18 total issues

Method to_memory has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

    def to_memory(permanence = {:new => :new}, exclude_id = true, exclude_timestamps = true)
      return nil unless self.grub
      buccaneers = []
      self.scuttle do |row|
        data_hash = self.data_hash_from_row(row, exclude_id, exclude_timestamps)
Severity: Minor
Found in lib/csv_pirate/the_capn.rb - About 6 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

File the_capn.rb has 446 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module CsvPirate
  class TheCapn

    BOOKIE = [:counter, :timestamp, :none]
    MOP_HEADS = [:clean, :dirty]
Severity: Minor
Found in lib/csv_pirate/the_capn.rb - About 6 hrs to fix

    Class TheCapn has 42 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class TheCapn
    
        BOOKIE = [:counter, :timestamp, :none]
        MOP_HEADS = [:clean, :dirty]
        BRIGANTINE_OPTIONS = [:first, :last]
    Severity: Minor
    Found in lib/csv_pirate/the_capn.rb - About 5 hrs to fix

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

            def has_csv_pirate_ship(options = {})
              check_booty = prevent_from_failing_pre_migration
      
              options[:chart]         ||= ['log','csv']
              options[:aft]           ||= '.csv'
      Severity: Minor
      Found in lib/csv_pirate/pirate_ship.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 initialize has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(*args)
            raise ArgumentError, "must provide required options" if args.nil?
      
            @swag = args.first[:swag]
            @grub = args.first[:grub]
      Severity: Minor
      Found in lib/csv_pirate/the_capn.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 mutiny has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.mutiny(capn, first_mate)
            carrack = TheCapn.new(capn)
            cutthroat = TheCapn.new(first_mate)
      
            cutthroat.figurehead
      Severity: Minor
      Found in lib/csv_pirate/the_capn.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 to_memory has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def to_memory(permanence = {:new => :new}, exclude_id = true, exclude_timestamps = true)
            return nil unless self.grub
            buccaneers = []
            self.scuttle do |row|
              data_hash = self.data_hash_from_row(row, exclude_id, exclude_timestamps)
      Severity: Major
      Found in lib/csv_pirate/the_capn.rb - About 2 hrs to fix

        Method mutiny has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def self.mutiny(capn, first_mate)
              carrack = TheCapn.new(capn)
              cutthroat = TheCapn.new(first_mate)
        
              cutthroat.figurehead
        Severity: Minor
        Found in lib/csv_pirate/the_capn.rb - About 1 hr to fix

          Method initialize has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def initialize(*args)
                raise ArgumentError, "must provide required options" if args.nil?
          
                @swag = args.first[:swag]
                @grub = args.first[:grub]
          Severity: Minor
          Found in lib/csv_pirate/the_capn.rb - About 1 hr to fix

            Method jolly_roger has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def jolly_roger
                  if self.bury_treasure
                    if self.buried_treasure.is_a?(Array)
                      puts "Found #{self.buried_treasure.length} deniers buried here: '#{self.brigantine}'" if TheCapn.parlay && TheCapn.parlance(1)
                      puts "You must weigh_anchor to review your plunder!" if TheCapn.parlay && TheCapn.parlance(1)
            Severity: Minor
            Found in lib/csv_pirate/the_capn.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 has_csv_pirate_ship has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def has_csv_pirate_ship(options = {})
                    check_booty = prevent_from_failing_pre_migration
            
                    options[:chart]         ||= ['log','csv']
                    options[:aft]           ||= '.csv'
            Severity: Minor
            Found in lib/csv_pirate/pirate_ship.rb - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                        elsif permanence[:update_or_new]
                          obj = self.send_aye(data_hash, permanence[:update_or_new])
                          if obj.nil?
                            obj = self.grub.new(data_hash)
                          else
              Severity: Major
              Found in lib/csv_pirate/the_capn.rb - About 45 mins to fix

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

                    def self.marlinespike(spoils, navigation)
                      navigation.map do |east,west|
                        # BJM:
                        if east.is_a?(Array)
                          spoils = spoils.send(east[0].to_sym, *east[1..-1] )
                Severity: Minor
                Found in lib/csv_pirate/the_capn.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

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

                    def binnacle(join_value, humanize = true)
                      self.booty.map do |compass|
                        string = compass.is_a?(Hash) ?
                          self.run_through(compass, join_value) :
                          compass.is_a?(String) ?
                Severity: Minor
                Found in lib/csv_pirate/the_capn.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 deeply nested control flow statements.
                Open

                            if obj.nil?
                              self.grub.create(data_hash)
                            end
                Severity: Major
                Found in lib/csv_pirate/the_capn.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                obj.save(false) if obj.respond_to?(:save)
                  Severity: Major
                  Found in lib/csv_pirate/the_capn.rb - About 45 mins to fix

                    Method unfurl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def unfurl
                          wibbly = self.waggoner == '' ? '' : Regexp.escape(self.waggoner)
                          timey = self.sand_glass == '' ? '' : '\.\d+'
                          wimey = self.gibbet == '' ? '' : Regexp.escape(self.gibbet)
                          Regexp.new("#{wibbly}#{timey}#{wimey}")
                    Severity: Minor
                    Found in lib/csv_pirate/the_capn.rb - About 25 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

                    Method get_chronometer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def get_chronometer(chron)
                            chron == false ?
                                    false :
                                    (chron || (self.piratey_options[:chronometer] == false ?
                                            false :
                    Severity: Minor
                    Found in lib/csv_pirate/pirate_ship.rb - About 25 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