Showing 90 of 90 total issues
Method new_connection
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
def new_connection(config)
username = nil
if config[:jndi]
jndi = config[:jndi].to_s
- Read upRead up
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 schema_statements.rb
has 544 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "openssl"
module ActiveRecord
module ConnectionAdapters
module OracleEnhanced
Class OracleEnhancedAdapter
has 56 methods (exceeds 20 allowed). Consider refactoring. Open
class OracleEnhancedAdapter < AbstractAdapter
include OracleEnhanced::DatabaseStatements
include OracleEnhanced::SchemaStatements
include OracleEnhanced::ContextIndex
include OracleEnhanced::Quoting
File oracle_enhanced_adapter.rb
has 498 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "arel/visitors/oracle"
require "arel/visitors/oracle12"
require "active_record/connection_adapters"
require "active_record/connection_adapters/abstract_adapter"
require "active_record/connection_adapters/statement_pool"
File jdbc_connection.rb
has 440 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 353 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
- Read upRead up
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 328 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 table
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def table(table, stream)
columns = @connection.columns(table)
begin
self.table_name = table
- Read upRead up
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 new_connection
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
def new_connection(config)
username = nil
if config[:jndi]
jndi = config[:jndi].to_s
Method indexes
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def indexes(table_name) # :nodoc:
(_owner, table_name) = @raw_connection.describe(table_name)
default_tablespace_name = default_tablespace
result = select_all(<<~SQL.squish, "SCHEMA", [bind_string("table_name", table_name)])
- Read upRead up
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
def visit_Arel_Nodes_HomogeneousIn(o, collector)
in_clause_length = @connection.in_clause_length
values = o.casted_values.map { |v| @connection.quote(v) }
column_name = quote_table_name(o.table_name) + "." + quote_column_name(o.column_name)
operator =
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 109.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
def visit_Arel_Nodes_HomogeneousIn(o, collector)
in_clause_length = @connection.in_clause_length
values = o.casted_values.map { |v| @connection.quote(v) }
column_name = quote_table_name(o.table_name) + "." + quote_column_name(o.column_name)
operator =
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 109.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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?
- Read upRead up
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)
)
- Read upRead up
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 20 (exceeds 5 allowed). Consider refactoring. Open
def _indexes(table, stream)
if (indexes = @connection.indexes(table)).any?
add_index_statements = indexes.filter_map do |index|
case index.type
when nil
- Read upRead up
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 OCIConnection
has 24 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 19 (exceeds 5 allowed). Consider refactoring. Open
def exec_query(sql, name = "SQL", binds = [], prepare: false, async: false)
sql = transform_query(sql)
type_casted_binds = type_casted_binds(binds)
- Read upRead up
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 exec_insert
has a Cognitive Complexity of 19 (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
- Read upRead up
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) = @raw_connection.describe(table_name)
default_tablespace_name = default_tablespace
result = select_all(<<~SQL.squish, "SCHEMA", [bind_string("table_name", table_name)])