Skip to content

Commit baf87c7

Browse files
committed
Address RuboCop offenses
```ruby $ bundle exec rubocop -a Inspecting 73 files ...................W.......C..............CC............................. Offenses: lib/active_record/connection_adapters/oracle_enhanced/quoting.rb:49:13: C: [Corrected] Layout/IndentationWidth: Use 2 (not 32) spaces for indentation. "\"#{name.upcase}\"" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/active_record/connection_adapters/oracle_enhanced/quoting.rb:50:43: C: [Corrected] Layout/ElseAlignment: Align else with QUOTED_COLUMN_NAMES[name]. else ^^^^ lib/active_record/connection_adapters/oracle_enhanced/quoting.rb:51:45: C: [Corrected] Layout/CommentIndentation: Incorrect indentation detected (column 44 instead of 14). # remove double quotes which cannot be used inside quoted identifier ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/active_record/connection_adapters/oracle_enhanced/quoting.rb:52:13: C: [Corrected] Layout/IndentationWidth: Use 2 (not 32) spaces for indentation. "\"#{name.delete('"')}\"" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/active_record/connection_adapters/oracle_enhanced/quoting.rb:53:43: W: [Corrected] Layout/EndAlignment: end at 53, 42 is not aligned with QUOTED_COLUMN_NAMES[name] ||= if at 48, 12. end ^^^ lib/active_record/connection_adapters/oracle_enhanced/quoting.rb:60:1: C: [Corrected] Layout/EmptyLinesAroundModuleBody: Extra empty line detected at module body end. lib/active_record/connection_adapters/oracle_enhanced/quoting.rb:110:1: C: [Corrected] Layout/EmptyLines: Extra blank line detected. lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:66:1: C: [Corrected] Layout/EmptyLinesAroundModuleBody: Extra empty line detected at module body beginning. lib/arel/visitors/oracle_common.rb:6:1: C: [Corrected] Layout/EmptyLinesAroundModuleBody: Extra empty line detected at module body beginning. spec/active_record/connection_adapters/emulation/oracle_adapter_spec.rb:13:86: C: [Corrected] Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. @conn = ActiveRecord::Base.establish_connection(CONNECTION_PARAMS.merge(adapter: 'oracle')) ^^^^^^^^ 73 files inspected, 10 offenses detected, 10 offenses corrected $ ```
1 parent 78d64bd commit baf87c7

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

lib/active_record/connection_adapters/oracle_enhanced/quoting.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,17 @@ def column_name_with_order_matcher
4646
def quote_column_name(name) # :nodoc:
4747
name = name.to_s
4848
QUOTED_COLUMN_NAMES[name] ||= if /\A[a-z][a-z_0-9$#]*\Z/.match?(name)
49-
"\"#{name.upcase}\""
50-
else
51-
# remove double quotes which cannot be used inside quoted identifier
52-
"\"#{name.delete('"')}\""
53-
end
49+
"\"#{name.upcase}\""
50+
else
51+
# remove double quotes which cannot be used inside quoted identifier
52+
"\"#{name.delete('"')}\""
53+
end
5454
end
5555

5656
def quote_table_name(name) # :nodoc:
5757
name, _link = name.to_s.split("@")
5858
QUOTED_TABLE_NAMES[name] ||= [name.split(".").map { |n| quote_column_name(n) }].join(".")
5959
end
60-
6160
end
6261

6362
# This method is used in add_index to identify either column name (which is quoted)
@@ -107,7 +106,6 @@ def self.mixed_case?(name)
107106
!!(object_name =~ /[A-Z]/ && object_name =~ /[a-z]/)
108107
end
109108

110-
111109
def quote_string(s) # :nodoc:
112110
s.gsub(/'/, "''")
113111
end

lib/active_record/connection_adapters/oracle_enhanced_adapter.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
require "active_record/type/oracle_enhanced/character_string"
6464

6565
module ActiveRecord
66-
6766
module ConnectionAdapters # :nodoc:
6867
# Oracle enhanced adapter will work with both
6968
# CRuby ruby-oci8 gem (which provides interface to Oracle OCI client)

lib/arel/visitors/oracle_common.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
module Arel # :nodoc: all
44
module Visitors
55
module OracleCommon
6-
76
BIND_BLOCK = proc { |i| ":a#{i}" }
87
private_constant :BIND_BLOCK
98

spec/active_record/connection_adapters/emulation/oracle_adapter_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
end
1111

1212
it "should be an OracleAdapter" do
13-
@conn = ActiveRecord::Base.establish_connection(CONNECTION_PARAMS.merge(adapter: 'oracle'))
13+
@conn = ActiveRecord::Base.establish_connection(CONNECTION_PARAMS.merge(adapter: "oracle"))
1414
expect(ActiveRecord::Base.connection).not_to be_nil
1515
expect(ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::OracleAdapter)).to be_truthy
1616
end

0 commit comments

Comments
 (0)