rubocop-sequel 0.3.4 → 0.3.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9946d5d75823d8bf843b76fcf363080f6fe7b89898a5cd83fda2c2474f75e188
4
- data.tar.gz: ca925b88e4778ae0a255f24d3ab03c1802989d64943b3b74128c305fb99405d5
3
+ metadata.gz: af5f93d560c9a6dcb0216440641d3b108a466f5f536d296f1602ab9e38cc9d9e
4
+ data.tar.gz: e76e3f9bc6f6a768d500955c88e94b2b05c70486e6978317542cbf7d808e6e5b
5
5
  SHA512:
6
- metadata.gz: f68ad1bd6c68025ed7d974e4d68f900583bfa9e7136247be140930a9d40a5c6a22c6be9a671c6f3042d6a0ce3655c9932405c0d4ce0900a1e4a9d991f425aff0
7
- data.tar.gz: 7f020ea08ebc0f993e4809ff47c240663ca4b0d4854fafb28773fc25d16f210cabf435e194ee3c2d4bf7dd5acc7c1bc2a3364de7ca0501bc2f412d7383bbbac4
6
+ metadata.gz: d7eb9f7f0c40b0ad3cf542fabd76d3ab506505e0d4f40cf831b6de91719186b57750e13036a600b303928cbc28ebf5d2dfec68802c692b9b3580b8943821ad2d
7
+ data.tar.gz: 5cd74af9570a31c507b45fe5258234e2204cb112bbb7fb051f5531d8e08ffcfd1bdeb93d8757d9c8e77d37babc16e7e6b3dee2c3729631c205ea1cf5ef8b1d07
@@ -4,3 +4,7 @@ updates:
4
4
  directory: /
5
5
  schedule:
6
6
  interval: "weekly"
7
+ - package-ecosystem: 'github-actions'
8
+ directory: '/'
9
+ schedule:
10
+ interval: 'weekly'
@@ -1,6 +1,5 @@
1
1
  name: CI
2
2
  on: [push, pull_request]
3
-
4
3
  jobs:
5
4
  main:
6
5
  name: Ruby ${{ matrix.ruby }}
@@ -8,22 +7,18 @@ jobs:
8
7
  strategy:
9
8
  matrix:
10
9
  ruby:
11
- - 2.5
12
- - 2.6
13
10
  - 2.7
14
11
  - 3.0
12
+ - 3.1
13
+ - 3.2
15
14
  steps:
16
- - uses: actions/checkout@v2
17
-
15
+ - uses: actions/checkout@v4
18
16
  - uses: ruby/setup-ruby@v1
19
17
  with:
20
18
  ruby-version: ${{ matrix.ruby }}
21
-
22
19
  - name: Install gems
23
20
  run: bundle install
24
-
25
21
  - name: RuboCop
26
22
  run: bundle exec rubocop --parallel
27
-
28
23
  - name: RSpec
29
24
  run: bundle exec rspec
data/Gemfile CHANGED
@@ -3,3 +3,10 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
+
7
+ gem 'rake', '~> 13.2.1'
8
+ gem 'rspec', '~> 3.7'
9
+ gem 'rubocop-rspec', '~> 2.0'
10
+ gem 'sequel', '~> 5.47'
11
+ gem 'simplecov', '~> 0.16'
12
+ gem 'sqlite3', '~> 1.3', '>= 1.3.12'
@@ -0,0 +1,54 @@
1
+ # This is the default configuration file.
2
+
3
+ Sequel:
4
+ Enabled: true
5
+ DocumentationBaseURL: https://github.com/rubocop/rubocop-sequel/blob/master/README.md
6
+
7
+ Sequel/ConcurrentIndex:
8
+ Description: Encourages the creation of indexes with the `NOT VALID` option to avoid locking tables.
9
+ Reference: https://www.rubydoc.info/gems/rubocop-sequel/RuboCop/Cop/Sequel/ConcurrentIndex
10
+ Enabled: true
11
+ VersionAdded: 0.0.1
12
+ VersionChanged: 0.3.3
13
+
14
+ Sequel/IrreversibleMigration:
15
+ Description: >-
16
+ Warns against using certain methods inside a migration file's `change` block that would cause the migration to become irreversible.
17
+ Reference: https://www.rubydoc.info/gems/rubocop-sequel/RuboCop/Cop/Sequel/IrreversibleMigration
18
+ Enabled: true
19
+ VersionAdded: 0.3.4
20
+ VersionChanged: 0.3.4
21
+
22
+ Sequel/JSONColumn:
23
+ Description: >-
24
+ Advocates the use of the `jsonb` column type over `json` or `hstore` for performance
25
+ benefits and additional functionality.
26
+ Reference: https://www.rubydoc.info/gems/rubocop-sequel/RuboCop/Cop/Sequel/JSONColumn
27
+ Enabled: true
28
+ Safe: false
29
+ VersionAdded: 0.0.1
30
+ VersionChanged: 0.3.3
31
+
32
+ Sequel/MigrationName:
33
+ Description: >-
34
+ Helps to name migration files descriptively in order to avoid the use of default or generic names.
35
+ Reference: https://www.rubydoc.info/gems/rubocop-sequel/RuboCop/Cop/Sequel/MigrationName
36
+ Enabled: true
37
+ VersionAdded: '0.0.1'
38
+ VersionChanged: '0.3.3'
39
+ DefaultName: new_migration
40
+
41
+ Sequel/PartialConstraint:
42
+ Description: Advises on the correct use of partial indexes by specifying the `where' argument.
43
+ Reference: https://www.rubydoc.info/gems/rubocop-sequel/RuboCop/Cop/Sequel/PartialConstraint
44
+ Enabled: true
45
+ VersionAdded: '0.3.0'
46
+ VersionChanged: '0.3.3'
47
+
48
+ Sequel/SaveChanges:
49
+ Description: Ensures the use of save_changes instead of save to persist changes to models.
50
+ Reference: https://www.rubydoc.info/gems/rubocop-sequel/RuboCop/Cop/Sequel/SaveChanges
51
+ Enabled: true
52
+ SafeAutoCorrect: false
53
+ VersionAdded: '0.0.1'
54
+ VersionChanged: '0.3.3'
@@ -0,0 +1,14 @@
1
+ #
2
+ # Configuration for obsoletion.
3
+ #
4
+ # See: https://docs.rubocop.org/rubocop/extensions.html#config-obsoletions
5
+ #
6
+ extracted:
7
+ Sequel/*: ~
8
+
9
+ removed:
10
+ Sequel/ColumnDefault:
11
+ reason: >-
12
+ ColumnDefault cop since it's mostly outdated advice.
13
+ Details [#33](https://github.com/rubocop/rubocop-sequel/issues/32)
14
+
@@ -5,7 +5,7 @@ module RuboCop
5
5
  module Sequel
6
6
  # ConcurrentIndex looks for non-concurrent index creation.
7
7
  class ConcurrentIndex < Base
8
- MSG = 'Prefer creating or dropping new index concurrently'
8
+ MSG = 'Specify `concurrently` option when creating or dropping an index.'
9
9
  RESTRICT_ON_SEND = %i[add_index drop_index].freeze
10
10
 
11
11
  def_node_matcher :indexes?, <<-MATCHER
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Sequel
6
+ # IrreversibleMigration looks for methods inside a `change` block that cannot be reversed.
7
+ class IrreversibleMigration < Base
8
+ # https://sequel.jeremyevans.net/rdoc/files/doc/migration_rdoc.html#label-A+Basic+Migration
9
+ VALID_CHANGE_METHODS = %i[
10
+ create_table
11
+ create_join_table
12
+ create_view
13
+ add_column
14
+ add_index
15
+ rename_column
16
+ rename_table
17
+ alter_table
18
+ add_column
19
+ add_constraint
20
+ add_foreign_key
21
+ add_primary_key
22
+ add_index
23
+ add_full_text_index
24
+ add_spatial_index
25
+ rename_column
26
+ set_column_allow_null
27
+ ].freeze
28
+
29
+ MSG = 'Avoid using `%<name>s` inside a `change` block. Use `up` & `down` blocks instead.'
30
+ PRIMARY_KEY_MSG = 'Avoid using `add_primary_key` with an array argument inside a `change` block.'
31
+
32
+ def on_block(node)
33
+ return unless node.method_name == :change
34
+
35
+ body = node.body
36
+ return unless body
37
+
38
+ body.each_node(:send) { |child_node| validate_node(child_node) }
39
+ end
40
+
41
+ private
42
+
43
+ def validate_node(node)
44
+ name = node.method_name
45
+
46
+ add_offense(node.loc.selector, message: format(MSG, name: name)) unless VALID_CHANGE_METHODS.include?(name)
47
+
48
+ return unless name == :add_primary_key
49
+
50
+ return unless node.arguments.any?(&:array_type?)
51
+
52
+ add_offense(node.loc.selector, message: PRIMARY_KEY_MSG)
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -7,8 +7,7 @@ module RuboCop
7
7
  class SaveChanges < Base
8
8
  extend AutoCorrector
9
9
 
10
- MSG = 'Use `Sequel::Model#save_changes` instead of '\
11
- '`Sequel::Model#save`.'
10
+ MSG = 'Use `Sequel::Model#save_changes` instead of `Sequel::Model#save`.'
12
11
  RESTRICT_ON_SEND = %i[save].freeze
13
12
 
14
13
  def_node_matcher :model_save?, <<-MATCHER
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Sequel
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
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module Sequel
5
5
  # This module holds the RuboCop Sequel version information.
6
6
  module Version
7
- STRING = '0.3.4'
7
+ STRING = '0.3.5'
8
8
  end
9
9
  end
10
10
  end
@@ -3,5 +3,14 @@
3
3
  module RuboCop
4
4
  # RuboCop Sequel project namespace
5
5
  module Sequel
6
+ PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
7
+ CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
8
+ CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
9
+
10
+ private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
11
+
12
+ if ::RuboCop.const_defined?(:ConfigObsoletion)
13
+ ::RuboCop::ConfigObsoletion.files << PROJECT_ROOT.join('config', 'obsoletion.yml')
14
+ end
6
15
  end
7
16
  end
@@ -1,10 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rubocop'
4
-
4
+ require 'rubocop/sequel'
5
5
  require 'rubocop/sequel/version'
6
- require 'rubocop/cop/sequel/column_default'
6
+ require 'rubocop/sequel/inject'
7
+
8
+ RuboCop::Sequel::Inject.defaults!
9
+
7
10
  require 'rubocop/cop/sequel/concurrent_index'
11
+ require 'rubocop/cop/sequel/irreversible_migration'
8
12
  require 'rubocop/cop/sequel/json_column'
9
13
  require 'rubocop/cop/sequel/migration_name'
10
14
  require 'rubocop/cop/sequel/save_changes'
@@ -12,18 +12,10 @@ Gem::Specification.new do |gem|
12
12
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
13
13
  gem.name = 'rubocop-sequel'
14
14
  gem.require_paths = ['lib']
15
- gem.version = '0.3.4'
15
+ gem.version = '0.3.5'
16
16
  gem.metadata['rubygems_mfa_required'] = 'true'
17
17
 
18
18
  gem.required_ruby_version = '>= 2.5'
19
19
 
20
- gem.add_runtime_dependency 'rubocop', '~> 1.0'
21
-
22
- gem.add_development_dependency 'rake', '~> 13.0.6'
23
- gem.add_development_dependency 'rspec', '~> 3.7'
24
- gem.add_development_dependency 'rubocop-rake', '~> 0.6.0'
25
- gem.add_development_dependency 'rubocop-rspec', '~> 2.0'
26
- gem.add_development_dependency 'sequel', '~> 5.47'
27
- gem.add_development_dependency 'simplecov', '~> 0.16'
28
- gem.add_development_dependency 'sqlite3', '~> 1.3', '>= 1.3.12'
20
+ gem.add_dependency 'rubocop', '~> 1.0'
29
21
  end
@@ -0,0 +1,111 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe 'config/default.yml', type: :feature do
6
+ subject(:config) { RuboCop::ConfigLoader.load_file('config/default.yml') }
7
+
8
+ let(:configuration_keys) { config.tap { |c| c.delete('inherit_mode') }.keys }
9
+ let(:version_regexp) { /\A\d+\.\d+(?:\.\d+)?\z|\A<<next>>\z/ }
10
+
11
+ shared_examples 'has a nicely formatted description' do |cop_name|
12
+ it 'does not contain new lines' do
13
+ description = config.dig(cop_name, 'Description')
14
+
15
+ expect(description.include?("\n")).to be(false)
16
+ end
17
+
18
+ it 'stars from a verb' do # rubocop:disable RSpec/ExampleLength
19
+ description = config.dig(cop_name, 'Description')
20
+ start_with_subject = description.match(/\AThis cop (?<verb>.+?) .*/)
21
+ suggestion = start_with_subject[:verb]&.capitalize if start_with_subject
22
+ suggestion ||= 'a verb'
23
+
24
+ expect(start_with_subject).to(
25
+ be_nil, "should be started with `#{suggestion}` instead of `This cop ...`."
26
+ )
27
+ end
28
+
29
+ it 'has a period at EOL of description' do
30
+ description = config.dig(cop_name, 'Description')
31
+
32
+ expect(description).to match(/\.\z/)
33
+ end
34
+ end
35
+
36
+ shared_examples 'has metadata' do |cop_name|
37
+ context 'with VersionAdded' do
38
+ it 'required' do
39
+ version = config.dig(cop_name, 'VersionAdded')
40
+ expect(version).not_to be_nil
41
+ end
42
+
43
+ it 'nicely formatted' do
44
+ version = config.dig(cop_name, 'VersionAdded')
45
+ expect(version).to match(version_regexp), "should be format ('X.Y' or 'X.Y.Z' or '<<next>>')"
46
+ end
47
+ end
48
+
49
+ context 'with VersionChanged' do
50
+ it 'nicely formatted' do
51
+ version = config.dig(cop_name, 'VersionChanged')
52
+ next unless version
53
+
54
+ expect(version).to match(version_regexp), "should be format ('X.Y' or 'X.Y.Z' or '<<next>>')"
55
+ end
56
+ end
57
+
58
+ context 'with VersionRemoved' do
59
+ it 'nicely formatted' do
60
+ version = config.dig(cop_name, 'VersionRemoved')
61
+ next unless version
62
+
63
+ expect(version).to match(version_regexp), "should be format ('X.Y' or 'X.Y.Z' or '<<next>>')"
64
+ end
65
+ end
66
+
67
+ context 'with Safe' do
68
+ it 'does not include `true`' do
69
+ safe = config.dig(cop_name, 'Safe')
70
+ expect(safe).not_to be(true), 'has unnecessary `Safe: true` config.'
71
+ end
72
+ end
73
+
74
+ context 'with SafeAutoCorrect' do
75
+ it 'does not include unnecessary `false`' do
76
+ next unless config.dig(cop_name, 'Safe') == false
77
+
78
+ safe_autocorrect = config.dig(cop_name, 'SafeAutoCorrect')
79
+
80
+ expect(safe_autocorrect).not_to be(false), 'has unnecessary `SafeAutoCorrect: false` config.'
81
+ end
82
+ end
83
+ end
84
+
85
+ cop_names = RuboCop::Cop::Registry.global.with_department(:Sequel).cops.map(&:cop_name)
86
+ cop_names.each do |cop_name|
87
+ describe "Cop #{cop_name}" do
88
+ include_examples 'has a nicely formatted description', cop_name
89
+ include_examples 'has metadata', cop_name
90
+ end
91
+ end
92
+
93
+ it 'sorts configuration keys alphabetically' do
94
+ expected = configuration_keys.sort
95
+ configuration_keys.each_with_index do |key, idx|
96
+ expect(key).to eq expected[idx]
97
+ end
98
+ end
99
+
100
+ it 'sorts cop names alphabetically' do # rubocop:disable RSpec/ExampleLength
101
+ previous_key = ''
102
+ config_default = YAML.load_file('config/default.yml')
103
+
104
+ config_default.each_key do |key|
105
+ next if %w[inherit_mode AllCops].include?(key)
106
+
107
+ expect(previous_key <= key).to be(true), "Cops should be sorted alphabetically. Please sort #{key}."
108
+ previous_key = key
109
+ end
110
+ end
111
+ end
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
4
-
5
- describe RuboCop::Cop::Sequel::ConcurrentIndex do
3
+ RSpec.describe RuboCop::Cop::Sequel::ConcurrentIndex do
6
4
  subject(:cop) { described_class.new }
7
5
 
8
6
  context 'without the concurrent option' do
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe RuboCop::Cop::Sequel::IrreversibleMigration do
4
+ subject(:cop) { described_class.new }
5
+
6
+ context 'when inside a change block' do
7
+ let(:invalid_source) do
8
+ <<~SOURCE
9
+ change do
10
+ alter_table(:stores) do
11
+ drop_column(:products, :name)
12
+ drop_index(:products, :price)
13
+ end
14
+ end
15
+ SOURCE
16
+ end
17
+
18
+ let(:valid_source) do
19
+ <<~SOURCE
20
+ change do
21
+ alter_table(:stores) do
22
+ add_primary_key(:id)
23
+ add_column(:products, :name)
24
+ add_index(:products, :price)
25
+ end
26
+ end
27
+ SOURCE
28
+ end
29
+
30
+ it 'registers an offense when there is an invalid method' do
31
+ offenses = inspect_source(invalid_source)
32
+ expect(offenses.size).to eq(2)
33
+ end
34
+
35
+ it 'does not register an offense with valid methods' do
36
+ offenses = inspect_source(valid_source)
37
+ expect(offenses).to be_empty
38
+ end
39
+
40
+ describe 'and an array is passed into `add_primary_key`' do
41
+ let(:source) do
42
+ <<~SOURCE
43
+ change do
44
+ alter_table(:stores) do
45
+ add_primary_key([:owner_id, :name])
46
+ end
47
+ end
48
+ SOURCE
49
+ end
50
+
51
+ it 'registers an offense' do
52
+ offenses = inspect_source(source)
53
+ expect(offenses.size).to eq(1)
54
+ end
55
+ end
56
+ end
57
+
58
+ context 'when inside an up block' do
59
+ let(:source) do
60
+ <<~SOURCE
61
+ up do
62
+ alter_table(:stores) do
63
+ add_primary_key([:owner_id, :name])
64
+ add_column(:products, :name)
65
+ drop_index(:products, :price)
66
+ end
67
+ end
68
+ SOURCE
69
+ end
70
+
71
+ it 'does not register an offense with any methods' do
72
+ offenses = inspect_source(source)
73
+ expect(offenses).to be_empty
74
+ end
75
+ end
76
+ end
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
4
-
5
- describe RuboCop::Cop::Sequel::JSONColumn do
3
+ RSpec.describe RuboCop::Cop::Sequel::JSONColumn do
6
4
  subject(:cop) { described_class.new }
7
5
 
8
6
  context 'with add_column' do
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
4
-
5
- describe RuboCop::Cop::Sequel::MigrationName, :config do
3
+ RSpec.describe RuboCop::Cop::Sequel::MigrationName, :config do
6
4
  subject(:cop) { described_class.new(config) }
7
5
 
8
6
  let(:config) do
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
4
-
5
- describe RuboCop::Cop::Sequel::PartialConstraint do
3
+ RSpec.describe RuboCop::Cop::Sequel::PartialConstraint do
6
4
  subject(:cop) { described_class.new }
7
5
 
8
6
  it 'registers an offense when using where for constraint' do
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
4
-
5
- describe RuboCop::Cop::Sequel::SaveChanges do
3
+ RSpec.describe RuboCop::Cop::Sequel::SaveChanges do
6
4
  subject(:cop) { described_class.new }
7
5
 
8
6
  it 'registers an offense when using save' do
data/spec/spec_helper.rb CHANGED
@@ -5,33 +5,12 @@ require 'rubocop/rspec/support'
5
5
  require 'rubocop-sequel'
6
6
 
7
7
  RSpec.configure do |config|
8
- # rspec-expectations config goes here. You can use an alternate
9
- # assertion/expectation library such as wrong or the stdlib/minitest
10
- # assertions if you prefer.
11
- config.expect_with :rspec do |expectations|
12
- # This option will default to `true` in RSpec 4. It makes the `description`
13
- # and `failure_message` of custom matchers include text for helper methods
14
- # defined using `chain`, e.g.:
15
- # be_bigger_than(2).and_smaller_than(4).description
16
- # # => "be bigger than 2 and smaller than 4"
17
- # ...rather than:
18
- # # => "be bigger than 2"
19
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
20
- end
8
+ config.include RuboCop::RSpec::ExpectOffense
9
+ config.disable_monkey_patching!
10
+ config.raise_errors_for_deprecations!
11
+ config.raise_on_warning = true
12
+ config.fail_if_no_examples = true
21
13
 
22
- # rspec-mocks config goes here. You can use an alternate test double
23
- # library (such as bogus or mocha) by changing the `mock_with` option here.
24
- config.mock_with :rspec do |mocks|
25
- # Prevents you from mocking or stubbing a method that does not exist on
26
- # a real object. This is generally recommended, and will default to
27
- # `true` in RSpec 4.
28
- mocks.verify_partial_doubles = true
29
- end
30
-
31
- # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
32
- # have no way to turn it off -- the option exists only for backwards
33
- # compatibility in RSpec 3). It causes shared context metadata to be
34
- # inherited by the metadata hash of host groups and examples, rather than
35
- # triggering implicit auto-inclusion in groups with matching metadata.
36
- config.shared_context_metadata_behavior = :apply_to_host_groups
14
+ config.order = :random
15
+ Kernel.srand config.seed
37
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-sequel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timothée Peignier
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-08 00:00:00.000000000 Z
11
+ date: 2024-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -24,110 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 13.0.6
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 13.0.6
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '3.7'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '3.7'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop-rake
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 0.6.0
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 0.6.0
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop-rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '2.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '2.0'
83
- - !ruby/object:Gem::Dependency
84
- name: sequel
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '5.47'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '5.47'
97
- - !ruby/object:Gem::Dependency
98
- name: simplecov
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '0.16'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '0.16'
111
- - !ruby/object:Gem::Dependency
112
- name: sqlite3
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '1.3'
118
- - - ">="
119
- - !ruby/object:Gem::Version
120
- version: 1.3.12
121
- type: :development
122
- prerelease: false
123
- version_requirements: !ruby/object:Gem::Requirement
124
- requirements:
125
- - - "~>"
126
- - !ruby/object:Gem::Version
127
- version: '1.3'
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- version: 1.3.12
131
27
  description: Code style checking for Sequel
132
28
  email:
133
29
  - timothee.peignier@tryphon.org
@@ -143,18 +39,22 @@ files:
143
39
  - Gemfile
144
40
  - LICENSE
145
41
  - README.md
42
+ - config/default.yml
43
+ - config/obsoletion.yml
146
44
  - lib/rubocop-sequel.rb
147
- - lib/rubocop/cop/sequel/column_default.rb
148
45
  - lib/rubocop/cop/sequel/concurrent_index.rb
46
+ - lib/rubocop/cop/sequel/irreversible_migration.rb
149
47
  - lib/rubocop/cop/sequel/json_column.rb
150
48
  - lib/rubocop/cop/sequel/migration_name.rb
151
49
  - lib/rubocop/cop/sequel/partial_constraint.rb
152
50
  - lib/rubocop/cop/sequel/save_changes.rb
153
51
  - lib/rubocop/sequel.rb
52
+ - lib/rubocop/sequel/inject.rb
154
53
  - lib/rubocop/sequel/version.rb
155
54
  - rubocop-sequel.gemspec
156
- - spec/rubocop/cop/sequel/column_default_spec.rb
55
+ - spec/project_spec.rb
157
56
  - spec/rubocop/cop/sequel/concurrent_index_spec.rb
57
+ - spec/rubocop/cop/sequel/irreversible_migration_spec.rb
158
58
  - spec/rubocop/cop/sequel/json_column_spec.rb
159
59
  - spec/rubocop/cop/sequel/migration_name_spec.rb
160
60
  - spec/rubocop/cop/sequel/partial_constraint_spec.rb
@@ -165,7 +65,7 @@ licenses:
165
65
  - MIT
166
66
  metadata:
167
67
  rubygems_mfa_required: 'true'
168
- post_install_message:
68
+ post_install_message:
169
69
  rdoc_options: []
170
70
  require_paths:
171
71
  - lib
@@ -180,8 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
80
  - !ruby/object:Gem::Version
181
81
  version: '0'
182
82
  requirements: []
183
- rubygems_version: 3.1.6
184
- signing_key:
83
+ rubygems_version: 3.0.3.1
84
+ signing_key:
185
85
  specification_version: 4
186
86
  summary: A Sequel plugin for RuboCop
187
87
  test_files: []
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module Cop
5
- module Sequel
6
- # ColumnDefault looks for column creation with a default value.
7
- class ColumnDefault < Base
8
- MSG = "Don't create new column with default values"
9
- RESTRICT_ON_SEND = %i[add_column].freeze
10
-
11
- def_node_matcher :add_column_default?, <<-MATCHER
12
- (send _ :add_column ... (hash (pair (sym :default) _)))
13
- MATCHER
14
-
15
- def on_send(node)
16
- return unless add_column_default?(node)
17
-
18
- add_offense(node.loc.selector, message: MSG)
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe RuboCop::Cop::Sequel::ColumnDefault do
6
- subject(:cop) { described_class.new }
7
-
8
- it 'registers an offense when setting a default' do
9
- offenses = inspect_source('add_column(:products, :type, :text, default: "cop")')
10
- expect(offenses.size).to eq(1)
11
- end
12
-
13
- it 'does not register an offense when not setting a default' do
14
- offenses = inspect_source('add_column(:products, :type, :text)')
15
- expect(offenses).to be_empty
16
- end
17
- end