0.0
No commit activity in last 3 years
No release in over 3 years
A RuboCop extension for Active Record Oracle enhanced adapter.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.0
 Project Readme

RuboCop Oracle

Gem Version CircleCI

A RuboCop extension for Active Record Oracle enhanced adapter.

Installation

Just install the rubocop-oracle gem

gem install rubocop-oracle

or if you use bundler put this in your Gemfile

gem 'rubocop-oracle'

Cops

This gem contains Oracle/OnlineIndex cop to check if indexing is possible without stopping Rails application' service using Oracle. The cop supports safe migration for your production environment.

Oracle/OnlineIndex cop

This cop checks for uses options: online option on add_index. The ONLINE option is required if you want to run with OLTP when indexing migration in Oracle.

# bad
add_index :table_name, :column_name

# good
add_index :table_name, :column_name, options: :online

By specifying MigratedSchemaVersion option, migration files that have been migrated can be ignored.

# .rubocop.yml
Oracle/OnlineIndex:
  MigratedSchemaVersion: '202104130150' # Migration files lower than or equal to '202104130150' will be ignored.

This prevents detection of migration files that have already been applied to the production environment.

Usage

You need to tell RuboCop to load the Oracle extension. There are three ways to do this:

RuboCop configuration file

Put this into your .rubocop.yml.

require: rubocop-oracle

Alternatively, use the following array notation when specifying multiple extensions.

require:
  - rubocop-other-extension
  - rubocop-oracle

Now you can run rubocop and it will automatically load the RuboCop Oracle cops together with the standard cops.

Command line

rubocop --require rubocop-oracle

Rake task

RuboCop::RakeTask.new do |task|
  task.requires << 'rubocop-oracle'
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/koic/rubocop-oracle.

License

The gem is available as open source under the terms of the MIT License.