TalentBox/sequel-rails

View on GitHub

Showing 12 of 12 total issues

Class Abstract has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Abstract
      attr_reader :config

      def initialize(config)
        @config = config
Severity: Minor
Found in lib/sequel_rails/storage/abstract.rb - About 2 hrs to fix

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

      def URI.encode_www_form(enum)
        enum.map do |k, v|
          if v.nil?
            encode_www_form_component(k)
          elsif v.respond_to?(:to_ary)
    Severity: Minor
    Found in lib/sequel_rails/db_config.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 log_connection_yield has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def log_connection_yield(sql, conn, args=nil)
          sql_for_log = "#{connection_info(conn) if conn && log_connection_info}#{sql}#{"; #{args.inspect}" if args}"
          start = Time.now
          begin
            ::ActiveSupport::Notifications.instrument(
    Severity: Minor
    Found in lib/sequel_rails/sequel/database/active_support_notification.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 normalize_repository_config has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def normalize_repository_config(hash)
          config = DbConfig.new hash, :root => root
    
          config['max_connections'] = max_connections if max_connections
          config['search_path'] = search_path if search_path
    Severity: Minor
    Found in lib/sequel_rails/configuration.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 build_url has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_url(cfg)
          if (adapter = cfg['adapter']) =~ /sqlite/ &&
             (database = cfg['database']) =~ /^:/
            # magic sqlite databases
            return URI::Generic.build(:scheme => adapter, :opaque => database)
    Severity: Minor
    Found in lib/sequel_rails/db_config.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 with_local_repositories has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.with_local_repositories
          ::SequelRails.configuration.environments.each_value do |config|
            uri = parse_url(config['url'])
    
            database = extract_database(config, uri)
    Severity: Minor
    Found in lib/sequel_rails/storage.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 sql has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def sql(event)
            self.class.runtime += event.duration
            self.class.count += 1
            return unless logger.debug?
    
    
    Severity: Minor
    Found in lib/sequel_rails/railties/log_subscriber.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

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

          def _drop
            if _is_sqlite?
              return if in_memory?
              FileUtils.rm db_name if File.exist? db_name
            elsif _is_mysql?
    Severity: Minor
    Found in lib/sequel_rails/storage/jdbc.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

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

        def normalize_db(root)
          return unless include? :adapter
          return unless root
          return unless adapter.include?('sqlite') && database != ':memory:'
          # sqlite expects path as the database name
    Severity: Minor
    Found in lib/sequel_rails/db_config.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

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

          def add_connection_settings(commands)
            add_option commands, '--username', username unless username.blank?
            add_option commands, '--host', host unless host.blank?
            add_option commands, '--port', port.to_s unless port.to_s.blank? || port.to_s == '0'
          end
    Severity: Minor
    Found in lib/sequel_rails/storage/postgres.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

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

        def connect(environment)
          normalized_config = environment_for environment
    
          unless (normalized_config.keys & %w[adapter url]).any?
            raise "Database not configured.\n" \
    Severity: Minor
    Found in lib/sequel_rails/configuration.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

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

          def set_local_assigns!
            if file_name =~ /^(add|drop|remove)_.*_(?:to|from)_(.*)/
              column_action = Regexp.last_match[1]
              set_alter!(
                Regexp.last_match[2].pluralize,
    Severity: Minor
    Found in lib/generators/sequel/migration/migration_generator.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