rubocop-oracle 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +0 -9
- data/.rubocop.yml +7 -3
- data/CHANGELOG.md +12 -0
- data/README.md +28 -0
- data/config/default.yml +2 -0
- data/lib/rubocop/cop/oracle/online_index.rb +1 -2
- data/lib/rubocop/oracle/plugin.rb +31 -0
- data/lib/rubocop/oracle/version.rb +1 -1
- data/lib/rubocop-oracle.rb +1 -4
- data/rubocop-oracle.gemspec +5 -2
- metadata +23 -7
- data/lib/rubocop/oracle/inject.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec64193df38a8ba40bdedd1bc182d40434cd882f19c2b68cf6f8c9bdb367264f
|
4
|
+
data.tar.gz: 1d21407ef02b559429f4d423b9f977020f02a8b2e418402d6b0fe4515ad125d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9754bf5aa90cf084920449004f8c326c2067f64019775646e03394cb74d7c71f94abccad07ee1b79460bcd534941c9e18d44246a00219bcfa20df655492d5bc0
|
7
|
+
data.tar.gz: c3177af36bb04b48fce38165ccbe6d8be25ab53b8f85c1e32ab304ec17dd5006bc5ff5b006c5e3c17f7cda5f1e4d70556ceff4bbf042fecd39e7acf0ffc26192
|
data/.circleci/config.yml
CHANGED
@@ -23,12 +23,6 @@ jobs:
|
|
23
23
|
workflows:
|
24
24
|
build:
|
25
25
|
jobs:
|
26
|
-
- rake_default:
|
27
|
-
name: Ruby 2.5
|
28
|
-
image: circleci/ruby:2.5
|
29
|
-
- rake_default:
|
30
|
-
name: Ruby 2.6
|
31
|
-
image: circleci/ruby:2.6
|
32
26
|
- rake_default:
|
33
27
|
name: Ruby 2.7
|
34
28
|
image: circleci/ruby:2.7
|
@@ -38,6 +32,3 @@ workflows:
|
|
38
32
|
- rake_default:
|
39
33
|
name: Ruby HEAD
|
40
34
|
image: rubocophq/circleci-ruby-snapshot:latest # Nightly snapshot build
|
41
|
-
- rake_default:
|
42
|
-
name: JRuby 9.2
|
43
|
-
image: circleci/jruby:9.2
|
data/.rubocop.yml
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
# This is the configuration used to check the rubocop source code.
|
2
2
|
|
3
|
-
|
4
|
-
- rubocop
|
3
|
+
plugins:
|
4
|
+
- rubocop-internal_affairs
|
5
|
+
- rubocop-oracle
|
5
6
|
- rubocop-performance
|
6
7
|
|
7
8
|
AllCops:
|
8
9
|
NewCops: enable
|
9
|
-
TargetRubyVersion: 2.
|
10
|
+
TargetRubyVersion: 2.7
|
10
11
|
SuggestExtensions: false
|
11
12
|
|
13
|
+
InternalAffairs/OnSendWithoutOnCSend:
|
14
|
+
Enabled: false
|
15
|
+
|
12
16
|
Naming/PredicateName:
|
13
17
|
# Method define macros for dynamically generated method.
|
14
18
|
MethodDefinitionMacros:
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
### New features
|
6
|
+
|
7
|
+
## 1.0.0 (2025-04-05)
|
8
|
+
|
9
|
+
* Pluginfy RuboCop Oracle. ([@koic][])
|
10
|
+
|
11
|
+
## 0.2.0 (2021-04-14)
|
12
|
+
|
13
|
+
### Changes
|
14
|
+
|
15
|
+
* Mark `Oracle/OnlineIndex` as unsafe auto-correction. ([@koic][])
|
16
|
+
|
5
17
|
## 0.1.0 (2021-04-13)
|
6
18
|
|
7
19
|
### New features
|
data/README.md
CHANGED
@@ -19,6 +19,34 @@ or if you use bundler put this in your `Gemfile`
|
|
19
19
|
gem 'rubocop-oracle'
|
20
20
|
```
|
21
21
|
|
22
|
+
## Cops
|
23
|
+
|
24
|
+
This gem contains `Oracle/OnlineIndex` cop to check if indexing is possible without stopping Rails application' service using Oracle.
|
25
|
+
The cop supports safe migration for your production environment.
|
26
|
+
|
27
|
+
### `Oracle/OnlineIndex` cop
|
28
|
+
|
29
|
+
This cop checks for uses `options: online` option on `add_index`.
|
30
|
+
The `ONLINE` option is required if you want to run with OLTP when indexing migration in Oracle.
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
# bad
|
34
|
+
add_index :table_name, :column_name
|
35
|
+
|
36
|
+
# good
|
37
|
+
add_index :table_name, :column_name, options: :online
|
38
|
+
```
|
39
|
+
|
40
|
+
By specifying `MigratedSchemaVersion` option, migration files that have been migrated can be ignored.
|
41
|
+
|
42
|
+
```yaml
|
43
|
+
# .rubocop.yml
|
44
|
+
Oracle/OnlineIndex:
|
45
|
+
MigratedSchemaVersion: '202104130150' # Migration files lower than or equal to '202104130150' will be ignored.
|
46
|
+
```
|
47
|
+
|
48
|
+
This prevents detection of migration files that have already been applied to the production environment.
|
49
|
+
|
22
50
|
## Usage
|
23
51
|
|
24
52
|
You need to tell RuboCop to load the Oracle extension. There are three
|
data/config/default.yml
CHANGED
@@ -20,7 +20,9 @@ AllCops:
|
|
20
20
|
Oracle/OnlineIndex:
|
21
21
|
Description: 'Checks for uses `options: online` option on `add_index`.'
|
22
22
|
Enabled: true
|
23
|
+
SafeAutoCorrect: false
|
23
24
|
VersionAdded: '0.1'
|
25
|
+
VersionChanged: '0.2'
|
24
26
|
MigratedSchemaVersion: ~
|
25
27
|
Include:
|
26
28
|
- 'db/migrate/**/*.rb'
|
@@ -3,8 +3,7 @@
|
|
3
3
|
module RuboCop
|
4
4
|
module Cop
|
5
5
|
module Oracle
|
6
|
-
#
|
7
|
-
# This cop checks for uses `options: online` option on `add_index`.
|
6
|
+
# Checks for uses `options: online` option on `add_index`.
|
8
7
|
# The `ONLINE` option is required if you want to run with OLTP when indexing migration in Oracle.
|
9
8
|
# By specifying `MigratedSchemaVersion` option, migration files that have been migrated can be ignored.
|
10
9
|
#
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'lint_roller'
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Oracle
|
7
|
+
# A plugin that integrates RuboCop Oracle with RuboCop's plugin system.
|
8
|
+
class Plugin < LintRoller::Plugin
|
9
|
+
def about
|
10
|
+
LintRoller::About.new(
|
11
|
+
name: 'rubocop-oracle',
|
12
|
+
version: VERSION,
|
13
|
+
homepage: 'https://github.com/koic/rubocop-oracle',
|
14
|
+
description: 'A RuboCop extension for Active Record Oracle enhanced adapter.'
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
def supported?(context)
|
19
|
+
context.engine == :rubocop
|
20
|
+
end
|
21
|
+
|
22
|
+
def rules(_context)
|
23
|
+
LintRoller::Rules.new(
|
24
|
+
type: :path,
|
25
|
+
config_format: :rubocop,
|
26
|
+
value: Pathname.new(__dir__).join('../../../config/default.yml')
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/rubocop-oracle.rb
CHANGED
@@ -4,8 +4,5 @@ require 'rubocop'
|
|
4
4
|
|
5
5
|
require_relative 'rubocop/oracle'
|
6
6
|
require_relative 'rubocop/oracle/version'
|
7
|
-
require_relative 'rubocop/oracle/
|
8
|
-
|
9
|
-
RuboCop::Oracle::Inject.defaults!
|
10
|
-
|
7
|
+
require_relative 'rubocop/oracle/plugin'
|
11
8
|
require_relative 'rubocop/cop/oracle_cops'
|
data/rubocop-oracle.gemspec
CHANGED
@@ -12,9 +12,11 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = 'A RuboCop extension for Active Record Oracle enhanced adapter.'
|
13
13
|
spec.homepage = 'https://github.com/koic/rubocop-oracle'
|
14
14
|
spec.license = 'MIT'
|
15
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
|
16
16
|
|
17
17
|
spec.metadata['homepage_uri'] = spec.homepage
|
18
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
19
|
+
spec.metadata['default_lint_roller_plugin'] = 'RuboCop::Oracle::Plugin'
|
18
20
|
|
19
21
|
# Specify which files should be added to the gem when it is released.
|
20
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -25,5 +27,6 @@ Gem::Specification.new do |spec|
|
|
25
27
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
26
28
|
spec.require_paths = ['lib']
|
27
29
|
|
28
|
-
spec.
|
30
|
+
spec.add_dependency 'lint_roller', '~> 1.1'
|
31
|
+
spec.add_dependency 'rubocop', '~> 1.72'
|
29
32
|
end
|
metadata
CHANGED
@@ -1,29 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-oracle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koichi ITO
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: lint_roller
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.1'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rubocop
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - "~>"
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
33
|
+
version: '1.72'
|
20
34
|
type: :runtime
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
38
|
- - "~>"
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
40
|
+
version: '1.72'
|
27
41
|
description: A RuboCop extension for Active Record Oracle enhanced adapter.
|
28
42
|
email:
|
29
43
|
- koic.ito@gmail.com
|
@@ -48,7 +62,7 @@ files:
|
|
48
62
|
- lib/rubocop/cop/oracle/online_index.rb
|
49
63
|
- lib/rubocop/cop/oracle_cops.rb
|
50
64
|
- lib/rubocop/oracle.rb
|
51
|
-
- lib/rubocop/oracle/
|
65
|
+
- lib/rubocop/oracle/plugin.rb
|
52
66
|
- lib/rubocop/oracle/version.rb
|
53
67
|
- rubocop-oracle.gemspec
|
54
68
|
homepage: https://github.com/koic/rubocop-oracle
|
@@ -56,6 +70,8 @@ licenses:
|
|
56
70
|
- MIT
|
57
71
|
metadata:
|
58
72
|
homepage_uri: https://github.com/koic/rubocop-oracle
|
73
|
+
rubygems_mfa_required: 'true'
|
74
|
+
default_lint_roller_plugin: RuboCop::Oracle::Plugin
|
59
75
|
post_install_message:
|
60
76
|
rdoc_options: []
|
61
77
|
require_paths:
|
@@ -64,14 +80,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
80
|
requirements:
|
65
81
|
- - ">="
|
66
82
|
- !ruby/object:Gem::Version
|
67
|
-
version: 2.
|
83
|
+
version: 2.7.0
|
68
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
85
|
requirements:
|
70
86
|
- - ">="
|
71
87
|
- !ruby/object:Gem::Version
|
72
88
|
version: '0'
|
73
89
|
requirements: []
|
74
|
-
rubygems_version: 3.2.
|
90
|
+
rubygems_version: 3.2.18
|
75
91
|
signing_key:
|
76
92
|
specification_version: 4
|
77
93
|
summary: A RuboCop extension for Active Record Oracle enhanced adapter.
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module Oracle
|
5
|
-
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
6
|
-
# bit of our configuration.
|
7
|
-
module Inject
|
8
|
-
def self.defaults!
|
9
|
-
path = CONFIG_DEFAULT.to_s
|
10
|
-
hash = ConfigLoader.send(:load_yaml_configuration, path)
|
11
|
-
config = Config.new(hash, path).tap(&:make_excludes_absolute)
|
12
|
-
puts "configuration from #{path}" if ConfigLoader.debug?
|
13
|
-
config = ConfigLoader.merge_with_default(config, path, unset_nil: false)
|
14
|
-
ConfigLoader.instance_variable_set(:@default_configuration, config)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|