File tree Expand file tree Collapse file tree 8 files changed +33
-23
lines changed Expand file tree Collapse file tree 8 files changed +33
-23
lines changed Original file line number Diff line number Diff line change 30
30
run : bundle
31
31
- name : Install appraisal
32
32
run : bundle exec appraisal install
33
+ - name : Run rubocop
34
+ run : bundle exec appraisal ${{ matrix.appraisal }} rubocop
33
35
- name : Run tests
34
36
run : bundle exec appraisal ${{ matrix.appraisal }} rspec
Original file line number Diff line number Diff line change @@ -5,12 +5,14 @@ inherit_from: .rubocop_todo.yml
5
5
AllCops :
6
6
Exclude :
7
7
- bin/*
8
+ - ' vendor/**/*'
9
+ - ' gemfiles/**/*'
8
10
TargetRubyVersion : 2.2
9
11
10
12
Metrics/BlockLength :
11
13
Enabled : false
12
14
13
- Metrics /LineLength :
15
+ Layout /LineLength :
14
16
Max : 120
15
17
16
18
Style/BlockDelimiters :
Original file line number Diff line number Diff line change 1
1
# This configuration was generated by
2
2
# `rubocop --auto-gen-config`
3
- # on 2019-10-15 13:32:11 +0200 using RuboCop version 0.68 .1.
3
+ # on 2024-03-21 09:05:20 UTC using RuboCop version 1.62 .1.
4
4
# The point is for the user to remove these configuration records
5
5
# one by one as the offenses are removed from the code base.
6
6
# Note that changes in the inspected code, or installation of new
7
7
# versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: Severity, Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RequiredRubyVersion :
13
+ Exclude :
14
+ - ' permanent_records.gemspec'
Original file line number Diff line number Diff line change @@ -23,11 +23,10 @@ namespace :db do
23
23
end
24
24
end
25
25
26
- # TODO: add rubocop
27
- # require 'rubocop/rake_task'
28
- # RuboCop::RakeTask.new do |t|
29
- # t.options = ['-d']
30
- # end
26
+ require 'rubocop/rake_task'
27
+ RuboCop ::RakeTask . new do |t |
28
+ t . options = [ '-d' ]
29
+ end
31
30
32
31
require 'rspec/core/rake_task'
33
32
RSpec ::Core ::RakeTask . new ( :rspec ) do |t |
@@ -38,13 +37,11 @@ task :pandoc do
38
37
system ( 'pandoc -s -r markdown -w rst README.md -o README.rst' )
39
38
end
40
39
41
- task publish : %i[ pandoc rspec ] do # TODO: add rubocop
40
+ task publish : %i[ pandoc rubocop rspec ] do
42
41
# Ensure the gem builds
43
42
system ( 'gem build permanent_records.gemspec' ) &&
44
43
# And we didn't leave anything (aside from the gem) uncommitted
45
44
!system ( 'git status -s | egrep -v .' ) &&
46
45
system ( 'git push' ) &&
47
46
system ( "gem push permanent_records-#{ version } .gem" )
48
47
end
49
-
50
- task default : %i[ rspec ] # TODO: add rubocop
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ def is_permanent? # rubocop:disable Naming/PredicateName
28
28
29
29
def deleted?
30
30
if is_permanent?
31
- !!deleted_at # rubocop:disable Style/DoubleNegation
31
+ !!deleted_at
32
32
else
33
33
destroyed?
34
34
end
@@ -177,7 +177,7 @@ def destroyed_dependent_relations
177
177
178
178
def attempt_notifying_observers ( callback )
179
179
notify_observers ( callback )
180
- rescue NoMethodError # rubocop:disable Lint/HandleExceptions
180
+ rescue NoMethodError
181
181
# do nothing: this model isn't being observed
182
182
end
183
183
@@ -279,7 +279,7 @@ def self.dependent_permanent_reflections(klass)
279
279
end
280
280
281
281
ActiveSupport . on_load ( :active_record ) do
282
- ActiveRecord ::Base . send ( : include, PermanentRecords ::ActiveRecord )
282
+ ActiveRecord ::Base . include PermanentRecords ::ActiveRecord
283
283
284
284
if [ ActiveRecord ::VERSION ::MAJOR , ActiveRecord ::VERSION ::MINOR ] == [ 5 , 2 ] || ActiveRecord ::VERSION ::MAJOR > 5
285
285
require 'permanent_records/active_record_5_2'
Original file line number Diff line number Diff line change @@ -28,12 +28,12 @@ Gem::Specification.new do |s|
28
28
29
29
s . add_runtime_dependency 'activerecord' , ver || '>= 5.0.0'
30
30
s . add_runtime_dependency 'activesupport' , ver || '>= 5.0.0'
31
+ s . add_development_dependency 'appraisal'
31
32
s . add_development_dependency 'database_cleaner' , '>= 1.5.1'
32
33
s . add_development_dependency 'pry-byebug'
33
34
s . add_development_dependency 'rake'
34
35
s . add_development_dependency 'rspec' , '>= 3.5.0'
35
- # s.add_development_dependency 'rubocop'
36
- # s.add_development_dependency 'rubocop-performance'
36
+ s . add_development_dependency 'rubocop' , '~> 1.62.1 '
37
+ s . add_development_dependency 'rubocop-performance' , '~> 1.20.2 '
37
38
s . add_development_dependency 'sqlite3'
38
- s . add_development_dependency 'appraisal'
39
39
end
Original file line number Diff line number Diff line change 11
11
let! ( :difficulty ) { hole . create_difficulty }
12
12
let! ( :comments ) { 2 . times . map { hole . comments . create! } }
13
13
let! ( :bed ) { Bed . create! }
14
- let! ( :kitty ) { Kitty . create! ( beds : [ bed ] ) }
15
- let! ( :meerkat ) { Meerkat . create! ( holes : [ hole ] ) }
14
+ let! ( :kitty ) { Kitty . create! ( beds : [ bed ] ) }
15
+ let! ( :meerkat ) { Meerkat . create! ( holes : [ hole ] ) }
16
16
17
17
describe '#destroy' do
18
18
let ( :record ) { hole }
363
363
end
364
364
end
365
365
it 'revives them' do
366
- subject . comments . each { |c | expect ( c ) . not_to be_deleted }
367
- subject . comments . each { |c | expect ( Comment . find_by_id ( c . id ) ) . to eq ( c ) }
366
+ subject . comments . each { |c |
367
+ expect ( c ) . not_to be_deleted
368
+ expect ( Comment . find_by_id ( c . id ) ) . to eq ( c )
369
+ }
368
370
end
369
371
end
370
372
context 'with :has_one cardinality' do
391
393
392
394
context '.not_deleted' do
393
395
it 'counts' do
394
- expect ( Muskrat . not_deleted . count ) . to eq ( Muskrat . all . reject ( & : deleted?) . size )
396
+ expect ( Muskrat . not_deleted . count ) . to eq ( Muskrat . all . count { | element | ! element . deleted? } )
395
397
end
396
398
397
399
it 'has no deleted records' do
401
403
402
404
context '.deleted' do
403
405
it 'counts' do
404
- expect ( Muskrat . deleted . count ) . to eq ( Muskrat . all . select ( &:deleted? ) . size )
406
+ expect ( Muskrat . deleted . count ) . to eq ( Muskrat . all . count ( &:deleted? ) )
405
407
end
406
408
407
409
it 'has no non-deleted records' do
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ def self.env
32
32
33
33
load 'schema.rb' if File . exist? ( support . join ( 'schema.rb' ) )
34
34
35
- Dir . glob ( support . join ( '*.rb' ) ) . each do |file |
35
+ Dir . glob ( support . join ( '*.rb' ) ) . sort . each do |file |
36
36
autoload File . basename ( file ) . chomp ( '.rb' ) . camelcase . intern , file
37
37
require file
38
38
end
You can’t perform that action at this time.
0 commit comments