File tree 4 files changed +31
-33
lines changed
lib/ajax-datatables-rails
4 files changed +31
-33
lines changed Original file line number Diff line number Diff line change @@ -14,54 +14,50 @@ AllCops:
14
14
- gemfiles/*
15
15
- spec/**/*
16
16
17
- Gemspec/DevelopmentDependencies :
18
- Enabled : false
17
+ # ########
18
+ # STYLE #
19
+ # ########
19
20
20
21
Style/Documentation :
21
22
Enabled : false
22
23
23
- Layout/HashAlignment :
24
- Enabled : false
24
+ Style/TrailingCommaInArrayLiteral :
25
+ EnforcedStyleForMultiline : comma
25
26
26
- Layout/EmptyLines :
27
- Enabled : false
27
+ Style/TrailingCommaInHashLiteral :
28
+ EnforcedStyleForMultiline : comma
28
29
29
- Layout/EmptyLinesAroundClassBody :
30
- Enabled : false
30
+ # #########
31
+ # LAYOUT #
32
+ # #########
31
33
32
- Layout/EmptyLinesAroundBlockBody :
33
- Enabled : false
34
+ Layout/LineLength :
35
+ Exclude :
36
+ - ajax-datatables-rails.gemspec
34
37
35
- Layout/EmptyLinesAroundModuleBody :
38
+ Layout/EmptyLines :
36
39
Enabled : false
37
40
38
41
Layout/EmptyLineBetweenDefs :
39
42
Enabled : false
40
43
41
- Metrics/CyclomaticComplexity :
42
- Max : 7
44
+ Layout/EmptyLinesAroundClassBody :
45
+ Enabled : false
43
46
44
- Metrics/LineLength :
47
+ Layout/EmptyLinesAroundBlockBody :
45
48
Enabled : false
46
49
47
- Metrics/BlockLength :
48
- Max : 30
50
+ Layout/EmptyLinesAroundModuleBody :
51
+ Enabled : false
49
52
50
- Metrics/MethodLength :
51
- Max : 15
53
+ Layout/HashAlignment :
54
+ EnforcedColonStyle : table
55
+ EnforcedHashRocketStyle : table
52
56
53
- Metrics/ClassLength :
54
- Max : 130
55
-
56
- Naming/AccessorMethodName :
57
- Enabled : false
57
+ # #########
58
+ # NAMING #
59
+ # #########
58
60
59
61
Naming/FileName :
60
62
Exclude :
61
63
- 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 1
1
# frozen_string_literal: true
2
2
3
3
module AjaxDatatablesRails
4
- class Base
4
+ class Base # rubocop:disable Metrics/ClassLength
5
5
6
6
class << self
7
7
def default_db_adapter
@@ -40,7 +40,7 @@ def view_columns
40
40
ERROR
41
41
end
42
42
43
- def get_raw_records
43
+ def get_raw_records # rubocop:disable Naming/AccessorMethodName
44
44
raise ( NotImplementedError , <<~ERROR )
45
45
46
46
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
11
11
attr_reader :datatable , :index , :options , :column_name
12
12
attr_writer :search
13
13
14
- def initialize ( datatable , index , options )
14
+ def initialize ( datatable , index , options ) # rubocop:disable Metrics/MethodLength
15
15
@datatable = datatable
16
16
@index = index
17
17
@options = options
@@ -99,11 +99,13 @@ def casted_column
99
99
@casted_column ||= ::Arel ::Nodes ::NamedFunction . new ( 'CAST' , [ table [ field ] . as ( type_cast ) ] )
100
100
end
101
101
102
+ # rubocop:disable Layout/LineLength
102
103
def validate_settings!
103
104
raise AjaxDatatablesRails ::Error ::InvalidSearchColumn , 'Unknown column. Check that `data` field is filled on JS side with the column name' if column_name . empty?
104
105
raise AjaxDatatablesRails ::Error ::InvalidSearchColumn , "Check that column '#{ column_name } ' exists in view_columns" unless valid_search_column? ( column_name )
105
106
raise AjaxDatatablesRails ::Error ::InvalidSearchCondition , cond unless valid_search_condition? ( cond )
106
107
end
108
+ # rubocop:enable Layout/LineLength
107
109
108
110
def valid_search_column? ( column_name )
109
111
!datatable . view_columns [ column_name ] . nil?
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ def use_regex?
48
48
# The solution is to bypass regex_search and use non_regex_search with :in operator
49
49
def regex_search
50
50
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
52
52
else
53
53
non_regex_search
54
54
end
You can’t perform that action at this time.
0 commit comments