rubocop-sequel 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7073b0420635bddacfe692ad89623e834d7f576cc6ca04cef3e3ec60523b1928
4
- data.tar.gz: a6b020500eddc1c6936cbf1759aaff0191e0f214186f6d4a746b80845a093ba5
3
+ metadata.gz: 1426529648e896758505cc0f580c8a9dfd04eaaadf041e01fe8a38f1452fc549
4
+ data.tar.gz: 8105c3044c2536f0f57fc79346ecf2349036b5d918fa7312f1d35e55ffc41bc0
5
5
  SHA512:
6
- metadata.gz: 6bc69edcb167c25de701d0d1825ec44ce9581e08148d93261719b9c25253c1dcbfd566b6d4073bc231b0300f6c2f5cda4c0c5f93a07392e9253d850bc736ddb0
7
- data.tar.gz: c539f918bac9007971a1b21ca58cc984c5ee4ae3fb1d5b951522f6e08b0d49df08264f55e8e20d6b4dce8e7b8e4d9aab736dcd3822e08515742c923fa6f5279b
6
+ metadata.gz: 3eb093802d46566d8a0e0e4920af488673448bbd1ae9e8dab89b4dd2aedd11494f2222bfd4ae1fcaff01104b848d50510fef518daa0b947e741f85d009a04d33
7
+ data.tar.gz: 5570ee0d798a47808cacb9a162db33a141c0055147dbedbb88fba614ecc9b14ce6c50bd66f9911f01136515f5d94ed4634cbdb76355a68d628755426b8d4c3d4
@@ -1,10 +1,13 @@
1
1
  require:
2
2
  - rubocop-rspec
3
3
 
4
+ AllCops:
5
+ TargetRubyVersion: 2.3
6
+
4
7
  # Offense count: 1
5
8
  # Configuration parameters: CountComments, ExcludedMethods.
6
9
  Metrics/BlockLength:
7
- Max: 30
10
+ Max: 31
8
11
 
9
12
  # Offense count: 1
10
13
  # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
@@ -6,3 +6,5 @@ rvm:
6
6
  script:
7
7
  - bundle exec rubocop --parallel
8
8
  - bundle exec rspec
9
+ notifications:
10
+ email: false
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubocop'
2
4
 
3
5
  require 'rubocop/cop/sequel/column_default'
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RuboCop
2
4
  module Cop
3
5
  module Sequel
4
6
  # ColumnDefault looks for column creation with a default value.
5
7
  class ColumnDefault < Cop
6
- MSG = "Don't create new column with default values".freeze
8
+ MSG = "Don't create new column with default values"
7
9
 
8
10
  def_node_matcher :add_column_default, <<-MATCHER
9
11
  (send _ :add_column ... (hash (pair (sym :default) _)))
@@ -1,16 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RuboCop
2
4
  module Cop
3
5
  module Sequel
4
6
  # ConcurrentIndex looks for non-concurrent index creation.
5
7
  class ConcurrentIndex < Cop
6
- MSG = 'Prefer creating new index concurrently'.freeze
8
+ MSG = 'Prefer creating or dropping new index concurrently'
7
9
 
8
- def_node_matcher :add_index, <<-MATCHER
9
- (send _ :add_index $...)
10
+ def_node_matcher :indexes, <<-MATCHER
11
+ (send _ {:add_index :drop_index} $...)
10
12
  MATCHER
11
13
 
12
14
  def on_send(node)
13
- add_index(node) do |args|
15
+ indexes(node) do |args|
14
16
  if offensive?(args)
15
17
  add_offense(node, location: :selector, message: MSG)
16
18
  end
@@ -1,9 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RuboCop
2
4
  module Cop
3
5
  module Sequel
4
6
  # MigrationName looks for migration files named with a default name.
5
7
  class MigrationName < Cop
6
- MSG = 'Migration files should not use default name.'.freeze
8
+ include RangeHelp
9
+
10
+ MSG = 'Migration files should not use default name.'
7
11
 
8
12
  def investigate(processed_source)
9
13
  file_path = processed_source.buffer.name
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RuboCop
2
4
  module Cop
3
5
  module Sequel
4
6
  # SaveChanges promotes the use of save_changes.
5
7
  class SaveChanges < Cop
6
8
  MSG = 'Use `Sequel::Model#save_changes` instead of '\
7
- '`Sequel::Model#save`.'.freeze
9
+ '`Sequel::Model#save`.'
8
10
 
9
11
  def_node_matcher :model_save, <<-MATCHER
10
12
  (send _ :save)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RuboCop
2
4
  # RuboCop Sequel project namespace
3
5
  module Sequel
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gem::Specification.new do |gem|
2
4
  gem.authors = ['Timothée Peignier']
3
5
  gem.email = ['timothee.peignier@tryphon.org']
@@ -11,7 +13,7 @@ Gem::Specification.new do |gem|
11
13
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
12
14
  gem.name = 'rubocop-sequel'
13
15
  gem.require_paths = ['lib']
14
- gem.version = '0.0.4'
16
+ gem.version = '0.0.5'
15
17
 
16
18
  gem.add_runtime_dependency 'rubocop', '~> 0.52', '>= 0.52'
17
19
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe RuboCop::Cop::Sequel::ColumnDefault do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe RuboCop::Cop::Sequel::ConcurrentIndex do
@@ -5,25 +7,35 @@ describe RuboCop::Cop::Sequel::ConcurrentIndex do
5
7
 
6
8
  context 'without the concurrent option' do
7
9
  it 'registers an offense without options' do
8
- inspect_source('add_index(:products, :name)')
9
- expect(cop.offenses.size).to eq(1)
10
+ inspect_source(<<~SOURCE)
11
+ add_index(:products, :name)
12
+ drop_index(:products, :name)
13
+ SOURCE
14
+ expect(cop.offenses.size).to eq(2)
10
15
  end
11
16
 
12
17
  it 'registers an offense with other options' do
13
- inspect_source('add_index(:products, :name, unique: true)')
14
- expect(cop.offenses.size).to eq(1)
18
+ inspect_source(<<~SOURCE)
19
+ add_index(:products, :name, unique: true)
20
+ drop_index(:products, :name, unique: true)
21
+ SOURCE
22
+ expect(cop.offenses.size).to eq(2)
15
23
  end
16
24
 
17
25
  it 'registers an offense with composite index' do
18
- inspect_source('add_index(:products, [:name, :price], unique: true)')
19
- expect(cop.offenses.size).to eq(1)
26
+ inspect_source(<<~SOURCE)
27
+ add_index(:products, [:name, :price], unique: true)
28
+ drop_index(:products, [:name, :price])
29
+ SOURCE
30
+ expect(cop.offenses.size).to eq(2)
20
31
  end
21
32
  end
22
33
 
23
34
  it 'does not register an offense when using concurrent option' do
24
- inspect_source(
25
- 'add_index(:products, :name, unique: true, concurrently: true)'
26
- )
35
+ inspect_source(<<~SOURCE)
36
+ add_index(:products, :name, unique: true, concurrently: true)
37
+ drop_index(:products, :name, concurrently: true)
38
+ SOURCE
27
39
  expect(cop.offenses).to be_empty
28
40
  end
29
41
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe RuboCop::Cop::Sequel::MigrationName, :config do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe RuboCop::Cop::Sequel::SaveChanges do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubocop'
2
4
  require 'rubocop/rspec/support'
3
5
  require 'rubocop-sequel'
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.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timothée Peignier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-14 00:00:00.000000000 Z
11
+ date: 2018-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  version: '0'
192
192
  requirements: []
193
193
  rubyforge_project:
194
- rubygems_version: 2.7.4
194
+ rubygems_version: 2.7.6
195
195
  signing_key:
196
196
  specification_version: 4
197
197
  summary: A plugin for the RuboCop code style & linting tool.