Skip to content

Run RuboCop in GitHub Actions #2439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,11 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Ruby 3.3
- name: Set up Ruby 3.4
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
- name: Download Oracle instant client
run: |
wget -q https://download.oracle.com/otn_software/linux/instantclient/2360000/instantclient-basic-linux.x64-23.6.0.24.10.zip
wget -q https://download.oracle.com/otn_software/linux/instantclient/2360000/instantclient-sdk-linux.x64-23.6.0.24.10.zip
wget -q https://download.oracle.com/otn_software/linux/instantclient/2360000/instantclient-sqlplus-linux.x64-23.6.0.24.10.zip
- name: Install Oracle instant client
run: |
sudo unzip instantclient-basic-linux.x64-23.6.0.24.10.zip -d /opt/oracle/
sudo unzip -o instantclient-sdk-linux.x64-23.6.0.24.10.zip -d /opt/oracle/
sudo unzip -o instantclient-sqlplus-linux.x64-23.6.0.24.10.zip -d /opt/oracle/
echo "/opt/oracle/instantclient_23_6" >> $GITHUB_PATH
ruby-version: 3.4
- name: Build and run RuboCop
run: |
bundle install --jobs 4 --retry 3
bundle exec rubocop
BUNDLE_ONLY=rubocop bundle install --jobs 4 --retry 3
BUNDLE_ONLY=rubocop bundle exec rubocop
12 changes: 7 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ group :development do
gem "rspec"
gem "rdoc"
gem "rake"
gem "rubocop", require: false
gem "rubocop-performance", require: false
gem "rubocop-rails", require: false
gem "rubocop-rspec", require: false

gem "activerecord", github: "rails/rails", branch: "7-2-stable"
gem "ruby-plsql", github: "rsim/ruby-plsql", branch: "master"

Expand All @@ -26,3 +21,10 @@ group :development do
gem "pry-nav"
end
end

group :rubocop do
gem "rubocop", require: false
gem "rubocop-performance", require: false
gem "rubocop-rails", require: false
gem "rubocop-rspec", require: false
end
12 changes: 5 additions & 7 deletions lib/active_record/connection_adapters/oracle_enhanced/quoting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,17 @@ def column_name_with_order_matcher
def quote_column_name(name) # :nodoc:
name = name.to_s
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.delete('"')}\""
end
"\"#{name.upcase}\""
else
# remove double quotes which cannot be used inside quoted identifier
"\"#{name.delete('"')}\""
end
end

def quote_table_name(name) # :nodoc:
name, _link = name.to_s.split("@")
QUOTED_TABLE_NAMES[name] ||= [name.split(".").map { |n| quote_column_name(n) }].join(".")
end

end

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


def quote_string(s) # :nodoc:
s.gsub(/'/, "''")
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
require "active_record/type/oracle_enhanced/character_string"

module ActiveRecord

module ConnectionAdapters # :nodoc:
# Oracle enhanced adapter will work with both
# CRuby ruby-oci8 gem (which provides interface to Oracle OCI client)
Expand Down
1 change: 0 additions & 1 deletion lib/arel/visitors/oracle_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module Arel # :nodoc: all
module Visitors
module OracleCommon

BIND_BLOCK = proc { |i| ":a#{i}" }
private_constant :BIND_BLOCK

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
end

it "should be an OracleAdapter" do
@conn = ActiveRecord::Base.establish_connection(CONNECTION_PARAMS.merge(adapter: 'oracle'))
@conn = ActiveRecord::Base.establish_connection(CONNECTION_PARAMS.merge(adapter: "oracle"))
expect(ActiveRecord::Base.connection).not_to be_nil
expect(ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::OracleAdapter)).to be_truthy
end
Expand Down