Skip to content

Commit 9d420a3

Browse files
authored
Merge pull request #19 from tungleduyxyz/kaui_4.8
Added new rubocop extensions
2 parents 2d84088 + 1fa56aa commit 9d420a3

6 files changed

Lines changed: 50 additions & 8 deletions

File tree

.rubocop.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
require:
2+
- rubocop-performance
3+
- rubocop-rails
4+
- rubocop-rspec
5+
- rubocop-thread_safety
6+
17
inherit_mode:
28
merge:
39
- Exclude
@@ -8,6 +14,7 @@ AllCops:
814
- 'app/controllers/deposit/engine_controller.rb' # Too much magic going on
915
NewCops: enable
1016
SuggestExtensions: false
17+
TargetRubyVersion: 3.2
1118

1219
Gemspec/RequiredRubyVersion:
1320
Enabled: false
@@ -51,3 +58,34 @@ Style/Documentation:
5158

5259
Style/EmptyElse:
5360
EnforcedStyle: empty
61+
62+
# Rails cops
63+
Rails:
64+
Enabled: true
65+
66+
Rails/I18nLocaleTexts:
67+
Enabled: false
68+
69+
Rails/SkipsModelValidations:
70+
Enabled: false
71+
72+
# RSpec cops
73+
RSpec:
74+
Enabled: true
75+
76+
RSpec/MultipleExpectations:
77+
Enabled: false
78+
79+
RSpec/ExampleLength:
80+
Enabled: false
81+
82+
# Performance cops
83+
Performance:
84+
Enabled: true
85+
86+
# Thread Safety cops
87+
ThreadSafety:
88+
Enabled: true
89+
90+
ThreadSafety/ClassAndModuleAttributes:
91+
Enabled: false

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ group :development do
2424
gem 'puma'
2525
gem 'rake'
2626
gem 'rubocop'
27+
gem 'rubocop-performance'
28+
gem 'rubocop-rails'
29+
gem 'rubocop-rspec'
30+
gem 'rubocop-thread_safety'
2731
gem 'simplecov'
2832
gem 'sprockets-rails'
2933
end

app/controllers/deposit/collection_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def account_invoices
126126
pages.each { |page| json[:data] << formatter.call(page) }
127127

128128
respond_to do |format|
129-
format.json { render json: json }
129+
format.json { render json: }
130130
end
131131
end
132132

config/routes.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
resources :collection, only: [:index]
77

88
scope '/collection' do
9-
match '/record' => 'collection#record_payments', :via => :post, :as => 'do_record_payments'
10-
match '/account_invoices' => 'collection#account_invoices', :via => :get, :as => 'account_invoices'
9+
post '/record' => 'collection#record_payments', :as => 'do_record_payments'
10+
get '/account_invoices' => 'collection#account_invoices', :as => 'account_invoices'
1111
end
1212
end

lib/deposit/client.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ def record_payments(account_id, effective_date, payment_reference_number, deposi
1717
effectiveDate: effective_date,
1818
paymentReferenceNumber: payment_reference_number,
1919
depositType: deposit_type,
20-
payments: payments
20+
payments:
2121
}.to_json
2222

2323
path = "#{KILLBILL_DEPOSIT_PREFIX}/record"
2424
response = KillBillClient::API.post path,
2525
body,
2626
{},
2727
{
28-
user: user,
29-
reason: reason,
30-
comment: comment
28+
user:,
29+
reason:,
30+
comment:
3131
}.merge(options)
3232
response.body
3333
end

test/test_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
99

1010
# Load support files
11-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
11+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
1212

1313
# Load fixtures from the engine
1414
if ActiveSupport::TestCase.respond_to?(:fixture_path=)

0 commit comments

Comments
 (0)