rsim/oracle-enhanced

View on GitHub

Showing 83 of 83 total issues

File schema_statements.rb has 537 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "digest/sha1"

module ActiveRecord
  module ConnectionAdapters
    module OracleEnhanced

    Method new_connection has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

            def new_connection(config)
              username = nil
    
              if config[:jndi]
                jndi = config[:jndi].to_s

    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 oracle_enhanced_adapter.rb has 453 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "active_record/connection_adapters"
    require "active_record/connection_adapters/abstract_adapter"
    require "active_record/connection_adapters/statement_pool"
    require "active_record/connection_adapters/oracle_enhanced/connection"
    require "active_record/connection_adapters/oracle_enhanced/database_statements"
    Severity: Minor
    Found in lib/active_record/connection_adapters/oracle_enhanced_adapter.rb - About 6 hrs to fix

      Class OracleEnhancedAdapter has 49 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class OracleEnhancedAdapter < AbstractAdapter
            include OracleEnhanced::DatabaseStatements
            include OracleEnhanced::SchemaStatements
            include OracleEnhanced::ContextIndex
            include OracleEnhanced::Quoting
      Severity: Minor
      Found in lib/active_record/connection_adapters/oracle_enhanced_adapter.rb - About 6 hrs to fix

        File jdbc_connection.rb has 428 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        begin
          require "java"
          require "jruby"
        
          # ojdbc7.jar or ojdbc6.jar file should be in application ./lib directory or in load path or in ENV['PATH']

          File oci_connection.rb has 341 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "delegate"
          
          begin
            require "oci8"
          rescue LoadError => e

            Method new_connection has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

                    def self.new_connection(config)
                      # to_s needed if username, password or database is specified as number in database.yml file
                      username = config[:username] && config[:username].to_s
                      password = config[:password] && config[:password].to_s
                      database = config[:database] && config[:database].to_s

            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 structure_dump.rb has 324 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module ActiveRecord #:nodoc:
              module ConnectionAdapters #:nodoc:
                module OracleEnhanced #:nodoc:
                  module StructureDump #:nodoc:
                    # Statements separator used in structure dump to allow loading of structure dump also with SQL*Plus

              Method new_connection has 80 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def new_connection(config)
                        username = nil
              
                        if config[:jndi]
                          jndi = config[:jndi].to_s

                Method table has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                          def table(table, stream)
                            columns = @connection.columns(table)
                            begin
                              self.table_name = table
                
                

                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 indexes has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                        def indexes(table_name) #:nodoc:
                          (_owner, table_name) = @connection.describe(table_name)
                          default_tablespace_name = default_tablespace
                
                          result = select_all(<<~SQL.squish, "SCHEMA", [bind_string("table_name", table_name)])

                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 create_table has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                        def create_table(table_name, id: :primary_key, primary_key: nil, force: nil, **options)
                          create_sequence = id != false
                          td = create_table_definition(
                            table_name, options.extract!(:temporary, :options, :as, :comment, :tablespace, :organization)
                          )

                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_ruby_value_from_result_set has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                        def get_ruby_value_from_result_set(rset, i, type_name, get_lob_value = true)
                          case type_name
                          when :NUMBER
                            d = rset.getNUMBER(i)
                            if d.nil?

                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 indexes has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def indexes(table_name) #:nodoc:
                          (_owner, table_name) = @connection.describe(table_name)
                          default_tablespace_name = default_tablespace
                
                          result = select_all(<<~SQL.squish, "SCHEMA", [bind_string("table_name", table_name)])

                  Consider simplifying this complex logical expression.
                  Open

                            if config[:jndi]
                              jndi = config[:jndi].to_s
                              ctx = javax.naming.InitialContext.new
                              ds = nil
                  
                  
                  Severity: Critical
                  Found in lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb - About 2 hrs to fix

                    Class OCIConnection has 22 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                          class OCIConnection < OracleEnhanced::Connection #:nodoc:
                            def initialize(config)
                              @raw_connection = OCI8EnhancedAutoRecover.new(config, OracleEnhancedOCIFactory)
                              # default schema owner
                              @owner = config[:schema]

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

                              def exec_query(sql, name = "SQL", binds = [], prepare: false)
                                type_casted_binds = type_casted_binds(binds)
                      
                                log(sql, name, binds, type_casted_binds) do
                                  cursor = nil

                      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

                      Class JDBCConnection has 21 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                            class JDBCConnection < OracleEnhanced::Connection #:nodoc:
                              attr_accessor :active
                              alias :active? :active
                      
                              attr_accessor :auto_retry

                        Method exec_insert has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def exec_insert(sql, name = nil, binds = [], pk = nil, sequence_name = nil)
                                  sql, binds = sql_for_insert(sql, pk, binds)
                                  type_casted_binds = type_casted_binds(binds)
                        
                                  log(sql, name, binds, type_casted_binds) do

                        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 _type_cast has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def _type_cast(value)
                                  case value
                                  when ActiveModel::Type::Binary::Data
                                    lob_value = value == "" ? " " : value
                                    bind_type = OCI8::BLOB
                        Severity: Minor
                        Found in lib/active_record/connection_adapters/oracle_enhanced/oci_quoting.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

                        Severity
                        Category
                        Status
                        Source
                        Language