File tree Expand file tree Collapse file tree 4 files changed +31
-33
lines changed
lib/ajax-datatables-rails Expand file tree Collapse file tree 4 files changed +31
-33
lines changed Original file line number Diff line number Diff line change @@ -14,54 +14,50 @@ AllCops:
1414 - gemfiles/*
1515 - spec/**/*
1616
17- Gemspec/DevelopmentDependencies :
18- Enabled : false
17+ # ########
18+ # STYLE #
19+ # ########
1920
2021Style/Documentation :
2122 Enabled : false
2223
23- Layout/HashAlignment :
24- Enabled : false
24+ Style/TrailingCommaInArrayLiteral :
25+ EnforcedStyleForMultiline : comma
2526
26- Layout/EmptyLines :
27- Enabled : false
27+ Style/TrailingCommaInHashLiteral :
28+ EnforcedStyleForMultiline : comma
2829
29- Layout/EmptyLinesAroundClassBody :
30- Enabled : false
30+ # #########
31+ # LAYOUT #
32+ # #########
3133
32- Layout/EmptyLinesAroundBlockBody :
33- Enabled : false
34+ Layout/LineLength :
35+ Exclude :
36+ - ajax-datatables-rails.gemspec
3437
35- Layout/EmptyLinesAroundModuleBody :
38+ Layout/EmptyLines :
3639 Enabled : false
3740
3841Layout/EmptyLineBetweenDefs :
3942 Enabled : false
4043
41- Metrics/CyclomaticComplexity :
42- Max : 7
44+ Layout/EmptyLinesAroundClassBody :
45+ Enabled : false
4346
44- Metrics/LineLength :
47+ Layout/EmptyLinesAroundBlockBody :
4548 Enabled : false
4649
47- Metrics/BlockLength :
48- Max : 30
50+ Layout/EmptyLinesAroundModuleBody :
51+ Enabled : false
4952
50- Metrics/MethodLength :
51- Max : 15
53+ Layout/HashAlignment :
54+ EnforcedColonStyle : table
55+ EnforcedHashRocketStyle : table
5256
53- Metrics/ClassLength :
54- Max : 130
55-
56- Naming/AccessorMethodName :
57- Enabled : false
57+ # #########
58+ # NAMING #
59+ # #########
5860
5961Naming/FileName :
6062 Exclude :
6163 - lib/ajax-datatables-rails.rb
62-
63- Style/TrailingCommaInArrayLiteral :
64- EnforcedStyleForMultiline : comma
65-
66- Style/TrailingCommaInHashLiteral :
67- EnforcedStyleForMultiline : comma
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33module AjaxDatatablesRails
4- class Base
4+ class Base # rubocop:disable Metrics/ClassLength
55
66 class << self
77 def default_db_adapter
@@ -40,7 +40,7 @@ def view_columns
4040 ERROR
4141 end
4242
43- def get_raw_records
43+ def get_raw_records # rubocop:disable Naming/AccessorMethodName
4444 raise ( NotImplementedError , <<~ERROR )
4545
4646 You should implement this method in your class and specify
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ class Column
1111 attr_reader :datatable , :index , :options , :column_name
1212 attr_writer :search
1313
14- def initialize ( datatable , index , options )
14+ def initialize ( datatable , index , options ) # rubocop:disable Metrics/MethodLength
1515 @datatable = datatable
1616 @index = index
1717 @options = options
@@ -99,11 +99,13 @@ def casted_column
9999 @casted_column ||= ::Arel ::Nodes ::NamedFunction . new ( 'CAST' , [ table [ field ] . as ( type_cast ) ] )
100100 end
101101
102+ # rubocop:disable Layout/LineLength
102103 def validate_settings!
103104 raise AjaxDatatablesRails ::Error ::InvalidSearchColumn , 'Unknown column. Check that `data` field is filled on JS side with the column name' if column_name . empty?
104105 raise AjaxDatatablesRails ::Error ::InvalidSearchColumn , "Check that column '#{ column_name } ' exists in view_columns" unless valid_search_column? ( column_name )
105106 raise AjaxDatatablesRails ::Error ::InvalidSearchCondition , cond unless valid_search_condition? ( cond )
106107 end
108+ # rubocop:enable Layout/LineLength
107109
108110 def valid_search_column? ( column_name )
109111 !datatable . view_columns [ column_name ] . nil?
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ def use_regex?
4848 # The solution is to bypass regex_search and use non_regex_search with :in operator
4949 def regex_search
5050 if use_regex?
51- ::Arel ::Nodes ::Regexp . new ( ( custom_field? ? field : table [ field ] ) , ::Arel ::Nodes . build_quoted ( formatted_value ) )
51+ ::Arel ::Nodes ::Regexp . new ( ( custom_field? ? field : table [ field ] ) , ::Arel ::Nodes . build_quoted ( formatted_value ) ) # rubocop:disable Layout/LineLength
5252 else
5353 non_regex_search
5454 end
You can’t perform that action at this time.
0 commit comments