Skip to content

Commit

Permalink
Update Rubocop config, fix offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
n-rodriguez committed Aug 29, 2024
1 parent 438422f commit 0983111
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
23 changes: 10 additions & 13 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
---
require:
- rubocop-performance
- rubocop-rake
- rubocop-rspec
- rubocop-rspec_rails

AllCops:
NewCops: enable
SuggestExtensions: false
TargetRubyVersion: '3.0'
Exclude:
- bin/*

Gemspec/DevelopmentDependencies:
Enabled: false
- lib/datatables-factory.rb

Gemspec/RequireMFA:
Enabled: false
Expand Down Expand Up @@ -57,13 +61,6 @@ Layout/HashAlignment:
Metrics/MethodLength:
Max: 12

Metrics/ModuleLength:
Max: 140
Metrics/ClassLength:
Max: 110

##########
# NAMING #
##########

Naming/FileName:
Exclude:
- lib/datatables-factory.rb
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ gem 'pry'
gem 'rake'
gem 'rspec-rails'
gem 'rubocop'
gem 'rubocop-performance'
gem 'rubocop-rake'
gem 'rubocop-rspec'
gem 'rubocop-rspec_rails'
gem 'simplecov'
gem 'sqlite3', '~> 1.5.0'
6 changes: 3 additions & 3 deletions lib/datatables_factory/presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def search_form(options = {}, &block)
options[:html] ||= {}
options[:html][:role] ||= 'form'
options[:layout] ||= :horizontal
options[:acts_like_form_tag] = true
options[:datatable] = self
options[:acts_like_form_tag] = true
options[:datatable] = self

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


def final_namespace
@final_namespace ||= @namespace.prepend(:datatables).map(&:to_s).map(&:camelize)
@final_namespace ||= @namespace.prepend(:datatables).map { |x| x.to_s.camelize }
end


Expand Down
4 changes: 2 additions & 2 deletions lib/datatables_factory/view_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def datatable_options_for_range_date

def label_filter_by(label, prefix: true)
label = t("datatables.filter.#{label}")
label = prefix ? label.downcase : label
label = label.downcase if prefix
prefix = prefix ? "#{t('text.filter_by')} " : ''
"#{prefix}#{label}"
end
Expand Down Expand Up @@ -80,7 +80,7 @@ def datatables_translations
rows: t('datatables.select.rows'),
},
buttons: {
pageLength: {
pageLength: {
_: t('datatables.buttons.pageLength._'),
'-1': t('datatables.buttons.pageLength.-1'),
},
Expand Down

0 comments on commit 0983111

Please sign in to comment.