Skip to content

Commit

Permalink
Suppress RuboCop's offense
Browse files Browse the repository at this point in the history
This PR commit suppresses and auto-corrects the following RuboCop's offense.

```console
% bundle exec rubocop -a
Inspecting 70 files
...................W..................................................

Offenses:

lib/active_record/connection_adapters/oracle_enhanced/quoting.rb:13:52:
C: [Corrected] Style/RedundantBegin: Redundant begin block detected.
          self.class.quoted_column_names[name] ||= begin
                                                   ^^^^^
lib/active_record/connection_adapters/oracle_enhanced/quoting.rb:14:11:
C: [Corrected] Layout/IndentationWidth: Use 2 (not 4) spaces for indentation.
              "\"#{name.upcase}\""
          ^^^^
lib/active_record/connection_adapters/oracle_enhanced/quoting.rb:15:13:
C: [Corrected] Layout/ElseAlignment: Align else with self.class.quoted_column_names[name].
            else
            ^^^^
lib/active_record/connection_adapters/oracle_enhanced/quoting.rb:16:15:
C: [Corrected] Layout/CommentIndentation: Incorrect indentation
detected (column 14 instead of 12).
              # remove double quotes which cannot be used inside quoted identifier
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/active_record/connection_adapters/oracle_enhanced/quoting.rb:17:11:
C: [Corrected] Layout/IndentationWidth: Use 2 (not 4) spaces for indentation.
              "\"#{name.gsub('"', '')}\""
          ^^^^
lib/active_record/connection_adapters/oracle_enhanced/quoting.rb:18:13:
W: [Corrected] Layout/EndAlignment: end at 18, 12 is not aligned with
self.class.quoted_column_names[name] ||= if at 13, 10.
            end
            ^^^
lib/active_record/connection_adapters/oracle_enhanced/quoting.rb:19:1:
C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line
detected at method body end.
lib/active_record/connection_adapters/oracle_enhanced/quoting.rb:19:1:
C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.

70 files inspected, 8 offenses detected, 8 offenses corrected
```
  • Loading branch information
koic committed Mar 30, 2021
1 parent 61dae2c commit d105887
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/active_record/connection_adapters/oracle_enhanced/quoting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ module Quoting

def quote_column_name(name) #:nodoc:
name = name.to_s
self.class.quoted_column_names[name] ||= begin
# if only valid lowercase column characters in name
if /\A[a-z][a-z_0-9$#]*\Z/.match?(name)
"\"#{name.upcase}\""
else
# remove double quotes which cannot be used inside quoted identifier
"\"#{name.gsub('"', '')}\""
end
self.class.quoted_column_names[name] ||= if /\A[a-z][a-z_0-9$#]*\Z/.match?(name)
"\"#{name.upcase}\""
else
# remove double quotes which cannot be used inside quoted identifier
"\"#{name.gsub('"', '')}\""
end
end

Expand Down

0 comments on commit d105887

Please sign in to comment.