Skip to content

Commit 0983111

Browse files
committed
Update Rubocop config, fix offenses
1 parent 438422f commit 0983111

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

.rubocop.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
---
2+
require:
3+
- rubocop-performance
4+
- rubocop-rake
5+
- rubocop-rspec
6+
- rubocop-rspec_rails
7+
18
AllCops:
29
NewCops: enable
3-
SuggestExtensions: false
410
TargetRubyVersion: '3.0'
511
Exclude:
612
- bin/*
7-
8-
Gemspec/DevelopmentDependencies:
9-
Enabled: false
13+
- lib/datatables-factory.rb
1014

1115
Gemspec/RequireMFA:
1216
Enabled: false
@@ -57,13 +61,6 @@ Layout/HashAlignment:
5761
Metrics/MethodLength:
5862
Max: 12
5963

60-
Metrics/ModuleLength:
61-
Max: 140
64+
Metrics/ClassLength:
65+
Max: 110
6266

63-
##########
64-
# NAMING #
65-
##########
66-
67-
Naming/FileName:
68-
Exclude:
69-
- lib/datatables-factory.rb

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,9 @@ gem 'pry'
1010
gem 'rake'
1111
gem 'rspec-rails'
1212
gem 'rubocop'
13+
gem 'rubocop-performance'
14+
gem 'rubocop-rake'
15+
gem 'rubocop-rspec'
16+
gem 'rubocop-rspec_rails'
1317
gem 'simplecov'
1418
gem 'sqlite3', '~> 1.5.0'

lib/datatables_factory/presenter.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ def search_form(options = {}, &block)
5252
options[:html] ||= {}
5353
options[:html][:role] ||= 'form'
5454
options[:layout] ||= :horizontal
55-
options[:acts_like_form_tag] = true
56-
options[:datatable] = self
55+
options[:acts_like_form_tag] = true
56+
options[:datatable] = self
5757

5858
layout = "form-#{options[:layout]}"
5959
options[:html][:class] = [options[:html][:class], layout].compact.join(' ')
@@ -106,7 +106,7 @@ def datatable_id
106106

107107

108108
def final_namespace
109-
@final_namespace ||= @namespace.prepend(:datatables).map(&:to_s).map(&:camelize)
109+
@final_namespace ||= @namespace.prepend(:datatables).map { |x| x.to_s.camelize }
110110
end
111111

112112

lib/datatables_factory/view_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def datatable_options_for_range_date
4747

4848
def label_filter_by(label, prefix: true)
4949
label = t("datatables.filter.#{label}")
50-
label = prefix ? label.downcase : label
50+
label = label.downcase if prefix
5151
prefix = prefix ? "#{t('text.filter_by')} " : ''
5252
"#{prefix}#{label}"
5353
end
@@ -80,7 +80,7 @@ def datatables_translations
8080
rows: t('datatables.select.rows'),
8181
},
8282
buttons: {
83-
pageLength: {
83+
pageLength: {
8484
_: t('datatables.buttons.pageLength._'),
8585
'-1': t('datatables.buttons.pageLength.-1'),
8686
},

0 commit comments

Comments
 (0)