baza_models 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +134 -25
  3. data/.rubocop_todo.yml +47 -32
  4. data/Gemfile +3 -1
  5. data/Gemfile.lock +55 -48
  6. data/Rakefile +2 -4
  7. data/VERSION +1 -1
  8. data/baza_models.gemspec +9 -4
  9. data/lib/baza_models/autoloader.rb +1 -0
  10. data/lib/baza_models/errors.rb +2 -3
  11. data/lib/baza_models/model.rb +22 -21
  12. data/lib/baza_models/model/belongs_to_relations.rb +1 -3
  13. data/lib/baza_models/model/has_many_relations.rb +2 -2
  14. data/lib/baza_models/model/has_one_relations.rb +2 -2
  15. data/lib/baza_models/model/manipulation.rb +20 -18
  16. data/lib/baza_models/model/queries.rb +2 -0
  17. data/lib/baza_models/model/scopes.rb +1 -0
  18. data/lib/baza_models/model/validations.rb +1 -0
  19. data/lib/baza_models/query.rb +12 -10
  20. data/lib/baza_models/query/inspector.rb +2 -0
  21. data/lib/baza_models/query/pagination.rb +5 -7
  22. data/lib/baza_models/query/sql_generator.rb +3 -3
  23. data/lib/baza_models/ransacker.rb +3 -1
  24. data/lib/baza_models/ransacker/relationship_scanner.rb +3 -0
  25. data/lib/baza_models/validators/confirmation_validator.rb +1 -3
  26. data/lib/baza_models/validators/uniqueness_validator.rb +2 -4
  27. data/peak_flow.yml +1 -0
  28. data/spec/baza_models/autoloader_spec.rb +1 -1
  29. data/spec/baza_models/baza_orm_adapter_spec.rb +1 -1
  30. data/spec/baza_models/model/has_many_relations_spec.rb +1 -1
  31. data/spec/baza_models/model/manipulation_spec.rb +3 -3
  32. data/spec/baza_models/model_spec.rb +22 -4
  33. data/spec/baza_models/query_spec.rb +14 -6
  34. data/spec/spec_helper.rb +1 -1
  35. data/spec/support/database_helper.rb +6 -3
  36. data/spec/test_classes/user.rb +2 -1
  37. metadata +30 -3
  38. data/spec/baza_models_spec.rb +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b85dd648cc5d0b9bfa6ba4f5ec3dd4c2538eb698dbdcdf235d22d3565d2819d
4
- data.tar.gz: c99d6805bd05efd1903e5eeb23d0bceecc3b9c57c62d04ba727153b0a9463640
3
+ metadata.gz: f5dafeb31c0031ed98a959b129cd089bc70cbf015ce1bf0d84289bc70099f4c0
4
+ data.tar.gz: b8590ae630f7d9b3581e62f48c8fdf944476b69ff7b5c4f39e21df4f6125f552
5
5
  SHA512:
6
- metadata.gz: 8a49bc042ac2866a09a48caedde95dbf269da107199a72a214e386040a1fe4f05d0fd286b56e48e74a7be2e614f2611cbcde32d5fa57061c522c859dbbb2fb71
7
- data.tar.gz: 04ad6a6b2486242fada1a94f2b78c9a91a03c6b9be50968579131a5dbce5f3a0662757a8c43c33e9b2eba2e1123f236607ea5219f8da53d9ec07ca3d27cdf2ee
6
+ metadata.gz: 380631dfc0d02e9a59e97eb33df3bc17ad32c707aef2976a5e502225c543d7f8fa094577ead0449cd70b68adae712cda45b9c193f629dbcd758814342b347b60
7
+ data.tar.gz: 6c9ce953c117d3eea42a165f31f1184c7bfa2af76fea98c0bedd14a40ff728962133db13eb7df44022273866d842dbde33b002e38b6a2404f37d272df1ee5ea1
@@ -6,35 +6,118 @@ AllCops:
6
6
  Exclude:
7
7
  - db/schema.rb
8
8
  - spec/dummy/db/schema.rb
9
+ - baza_models.gemspec
10
+ NewCops: enable
11
+ TargetRubyVersion: 2.5
9
12
 
10
- # https://github.com/AtomLinter/linter-rubocop/issues/2
11
- Style/FileName:
13
+ require:
14
+ - rubocop-performance
15
+ - rubocop-rspec
16
+
17
+ Layout/AccessModifierIndentation:
18
+ EnforcedStyle: outdent
19
+
20
+ Layout/ArgumentAlignment:
21
+ EnforcedStyle: with_fixed_indentation
22
+
23
+ Layout/CaseIndentation:
24
+ EnforcedStyle: end
25
+
26
+ Layout/EmptyLines:
12
27
  Enabled: false
13
28
 
14
- # Metrics/CyclomaticComplexity:
15
- # Max: 10
29
+ Layout/EmptyLinesAroundAttributeAccessor:
30
+ Enabled: true
31
+
32
+ Layout/EmptyLinesAroundArguments:
33
+ Enabled: false
34
+
35
+ Layout/EndAlignment:
36
+ EnforcedStyleAlignWith: variable
16
37
 
17
- Metrics/LineLength:
38
+ Layout/LineLength:
18
39
  Max: 160
19
40
 
20
- # Metrics/MethodLength:
21
- # Max: 50
41
+ Layout/MultilineMethodCallIndentation:
42
+ EnforcedStyle: indented
43
+
44
+ Layout/MultilineOperationIndentation:
45
+ EnforcedStyle: indented
46
+
47
+ Layout/ParameterAlignment:
48
+ EnforcedStyle: with_fixed_indentation
49
+
50
+ Layout/SpaceAroundMethodCallOperator:
51
+ Enabled: true
52
+
53
+ Layout/SpaceInsideHashLiteralBraces:
54
+ EnforcedStyle: no_space
55
+
56
+ Lint/DeprecatedOpenSSLConstant:
57
+ Enabled: true
58
+
59
+ Lint/MissingSuper:
60
+ Enabled: false
61
+
62
+ Lint/MixedRegexpCaptureTypes:
63
+ Enabled: true
64
+
65
+ Lint/RaiseException:
66
+ Enabled: true
67
+
68
+ Lint/StructNewOverride:
69
+ Enabled: true
22
70
 
23
71
  # Metrics/AbcSize:
24
72
  # Max: 25
25
73
 
74
+ Metrics/BlockLength:
75
+ Enabled: false
76
+
26
77
  # Metrics/ClassLength:
27
- # Max: 250
78
+ # $ Max: 250
79
+
80
+ # Metrics/CyclomaticComplexity:
81
+ # Max: 10
28
82
 
29
- # .find_each is not the same as .each
30
- Rails/FindEach:
83
+ # Metrics/MethodLength:
84
+ # Max: 50
85
+
86
+ # Metrics/PerceivedComplexity:
87
+ # Max: 10
88
+
89
+ RSpec/AnyInstance:
31
90
  Enabled: false
32
91
 
33
- Style/AccessModifierIndentation:
34
- EnforcedStyle: outdent
92
+ RSpec/ContextWording:
93
+ Enabled: false
35
94
 
36
- Style/AlignParameters:
37
- EnforcedStyle: with_fixed_indentation
95
+ RSpec/DescribeClass:
96
+ Enabled: false
97
+
98
+ RSpec/DescribedClass:
99
+ Enabled: false
100
+
101
+ RSpec/ExampleLength:
102
+ Enabled: false
103
+
104
+ RSpec/LetSetup:
105
+ Enabled: false
106
+
107
+ RSpec/MessageSpies:
108
+ Enabled: false
109
+
110
+ RSpec/MultipleExpectations:
111
+ Enabled: false
112
+
113
+ RSpec/NamedSubject:
114
+ Enabled: false
115
+
116
+ RSpec/NestedGroups:
117
+ Enabled: false
118
+
119
+ Style/CaseLikeIf:
120
+ Enabled: false
38
121
 
39
122
  Style/ClassAndModuleChildren:
40
123
  EnforcedStyle: compact
@@ -45,18 +128,45 @@ Style/ConditionalAssignment:
45
128
  Style/Documentation:
46
129
  Enabled: false
47
130
 
48
- Style/EmptyLines:
131
+ Style/ExponentialNotation:
132
+ Enabled: true
133
+
134
+ Style/FrozenStringLiteralComment:
49
135
  Enabled: false
50
136
 
51
137
  # Will report offences for many places that are much more readable without using a guard clause
52
138
  Style/GuardClause:
53
139
  Enabled: false
54
140
 
55
- Style/MultilineMethodCallIndentation:
56
- EnforcedStyle: indented
141
+ Style/HashEachMethods:
142
+ Enabled: true
57
143
 
58
- Style/MultilineOperationIndentation:
59
- EnforcedStyle: indented
144
+ Style/HashTransformKeys:
145
+ Enabled: true
146
+
147
+ Style/HashTransformValues:
148
+ Enabled: true
149
+
150
+ Style/Lambda:
151
+ Enabled: false
152
+
153
+ Style/LambdaCall:
154
+ Enabled: false
155
+
156
+ Style/MultipleComparison:
157
+ Enabled: false
158
+
159
+ Style/RedundantFetchBlock:
160
+ Enabled: true
161
+
162
+ Style/RedundantRegexpCharacterClass:
163
+ Enabled: true
164
+
165
+ Style/RedundantRegexpEscape:
166
+ Enabled: true
167
+
168
+ Style/RegexpLiteral:
169
+ Enabled: false
60
170
 
61
171
  Style/StringLiterals:
62
172
  EnforcedStyle: double_quotes
@@ -70,16 +180,15 @@ Style/NilComparison:
70
180
  Style/SignalException:
71
181
  EnforcedStyle: only_raise
72
182
 
73
- Style/MultilineOperationIndentation:
74
- EnforcedStyle: indented
183
+ Style/SlicingWithRange:
184
+ Enabled: true
75
185
 
76
- Style/SpaceInsideHashLiteralBraces:
77
- EnforcedStyle: no_space
186
+ Style/SymbolArray:
187
+ Enabled: false
78
188
 
79
189
  Style/TrivialAccessors:
80
190
  ExactNameMatch: true
81
191
  Enabled: true
82
192
 
83
- # Disabled on purpose: https://github.com/bbatsov/rubocop/issues/1758
84
- Style/ClosingParenthesisIndentation:
193
+ Style/WordArray:
85
194
  Enabled: false
@@ -1,68 +1,83 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-04-06 18:56:17 +0200 using RuboCop version 0.37.0.
3
+ # on 2019-10-20 06:56:57 +0000 using RuboCop version 0.75.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
+ # Offense count: 2
10
+ Layout/ConditionPosition:
11
+ Exclude:
12
+ - 'lib/baza_models/query.rb'
13
+ - 'lib/baza_models/ransacker.rb'
14
+
15
+ # Offense count: 2
16
+ Lint/DuplicateMethods:
17
+ Exclude:
18
+ - 'lib/baza_models/model.rb'
19
+
9
20
  # Offense count: 2
10
21
  Lint/IneffectiveAccessModifier:
11
22
  Exclude:
12
23
  - 'lib/baza_models/model.rb'
13
24
 
14
- # Offense count: 7
25
+ # Offense count: 6
15
26
  Metrics/AbcSize:
16
- Max: 44
27
+ Max: 45
17
28
 
18
29
  # Offense count: 2
19
30
  # Configuration parameters: CountComments.
20
31
  Metrics/ClassLength:
21
- Max: 386
32
+ Max: 385
22
33
 
23
34
  # Offense count: 1
24
35
  Metrics/CyclomaticComplexity:
25
36
  Max: 15
26
37
 
27
- # Offense count: 2
28
- # Configuration parameters: CountComments.
38
+ # Offense count: 1
39
+ # Configuration parameters: CountComments, ExcludedMethods.
29
40
  Metrics/MethodLength:
30
- Max: 74
41
+ Max: 63
31
42
 
32
- # Offense count: 7
43
+ # Offense count: 4
33
44
  Metrics/PerceivedComplexity:
34
45
  Max: 21
35
46
 
36
- # Offense count: 2
37
- # Cop supports --auto-correct.
38
- Style/MultilineIfThen:
47
+ # Offense count: 1
48
+ # Configuration parameters: EnforcedStyleForLeadingUnderscores.
49
+ # SupportedStylesForLeadingUnderscores: disallowed, required, optional
50
+ Naming/MemoizedInstanceVariableName:
39
51
  Exclude:
40
- - 'baza_models.gemspec'
52
+ - 'lib/baza_models/model/validations.rb'
41
53
 
42
- # Offense count: 42
43
- # Cop supports --auto-correct.
44
- # Configuration parameters: PreferredDelimiters.
45
- Style/PercentLiteralDelimiters:
54
+ # Offense count: 1
55
+ # Configuration parameters: CustomIncludeMethods.
56
+ RSpec/EmptyExampleGroup:
46
57
  Exclude:
47
- - 'baza_models.gemspec'
58
+ - 'spec/baza_models_spec.rb'
48
59
 
49
- # Offense count: 1
50
- # Cop supports --auto-correct.
51
- # Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
52
- # SupportedStyles: single_quotes, double_quotes
53
- Style/StringLiterals:
54
- Enabled: false
60
+ # Offense count: 4
61
+ # Configuration parameters: CustomTransform, IgnoreMethods.
62
+ RSpec/FilePath:
63
+ Exclude:
64
+ - 'spec/baza_models/baza_orm_adapter_spec.rb'
65
+ - 'spec/baza_models/model/delgation_spec.rb'
66
+ - 'spec/baza_models/model/translate_functionality_spec.rb'
67
+ - 'spec/baza_models/ransacker_spec.rb'
55
68
 
56
- # Offense count: 1
57
- # Cop supports --auto-correct.
58
- # Configuration parameters: EnforcedStyle, SupportedStyles.
59
- # SupportedStyles: final_newline, final_blank_line
60
- Style/TrailingBlankLines:
69
+ # Offense count: 2
70
+ Style/MissingRespondToMissing:
61
71
  Exclude:
62
- - 'baza_models.gemspec'
72
+ - 'lib/baza_models/model.rb'
73
+ - 'lib/baza_models/query.rb'
63
74
 
64
- # Offense count: 42
75
+ # Offense count: 2
65
76
  # Cop supports --auto-correct.
66
- Style/UnneededPercentQ:
77
+ # Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
78
+ # SupportedStyles: predicate, comparison
79
+ Style/NumericPredicate:
67
80
  Exclude:
68
- - 'baza_models.gemspec'
81
+ - 'spec/**/*'
82
+ - 'lib/baza_models/model.rb'
83
+ - 'lib/baza_models/query.rb'
data/Gemfile CHANGED
@@ -11,7 +11,7 @@ gem "simple_delegate"
11
11
  gem "string-cases"
12
12
 
13
13
  group :development, :test do
14
- gem "best_practice_project", require: false, github: "kaspernj/best_practice_project"
14
+ gem "best_practice_project", require: false
15
15
  gem "bundler"
16
16
  gem "factory_bot"
17
17
  gem "jdbc-sqlite3", platform: :jruby
@@ -20,5 +20,7 @@ group :development, :test do
20
20
  gem "rdoc"
21
21
  gem "rspec"
22
22
  gem "rubocop", require: false
23
+ gem "rubocop-performance", require: false
24
+ gem "rubocop-rspec", require: false
23
25
  gem "sqlite3", platform: :ruby
24
26
  end
@@ -1,15 +1,8 @@
1
- GIT
2
- remote: git://github.com/kaspernj/best_practice_project.git
3
- revision: cf3a8e27b173540118278331a58177c5a8d857cc
4
- specs:
5
- best_practice_project (0.0.9)
6
- auto_autoloader
7
-
8
1
  GIT
9
2
  remote: https://github.com/kaspernj/baza.git
10
- revision: 18f3235a9a57319fceceea191df578de95bd46a7
3
+ revision: 9fd96eab7bb315cf650cbdaa1b066d6fea8b9aa9
11
4
  specs:
12
- baza (0.0.36)
5
+ baza (0.0.37)
13
6
  array_enumerator (~> 0.0.10)
14
7
  auto_autoloader (~> 0.0.5)
15
8
  datet (~> 0.0.25)
@@ -21,27 +14,29 @@ GIT
21
14
  GEM
22
15
  remote: http://rubygems.org/
23
16
  specs:
24
- activesupport (6.0.0)
17
+ activesupport (6.0.3.2)
25
18
  concurrent-ruby (~> 1.0, >= 1.0.2)
26
19
  i18n (>= 0.7, < 2)
27
20
  minitest (~> 5.1)
28
21
  tzinfo (~> 1.1)
29
- zeitwerk (~> 2.1, >= 2.1.8)
22
+ zeitwerk (~> 2.2, >= 2.2.2)
30
23
  addressable (2.7.0)
31
24
  public_suffix (>= 2.0.2, < 5.0)
32
25
  array_enumerator (0.0.10)
33
- ast (2.4.0)
26
+ ast (2.4.1)
34
27
  auto_autoloader (0.0.5)
35
28
  string-cases
29
+ best_practice_project (0.0.11)
30
+ auto_autoloader (>= 0.0.5)
36
31
  builder (3.2.3)
37
- concurrent-ruby (1.1.5)
32
+ concurrent-ruby (1.1.6)
38
33
  datet (0.0.25)
39
34
  descendants_tracker (0.0.4)
40
35
  thread_safe (~> 0.3, >= 0.3.1)
41
- diff-lcs (1.3)
36
+ diff-lcs (1.4.4)
42
37
  event_handler (0.0.0)
43
- factory_bot (5.1.1)
44
- activesupport (>= 4.2.0)
38
+ factory_bot (6.1.0)
39
+ activesupport (>= 5.0.0)
45
40
  faraday (0.17.0)
46
41
  multipart-post (>= 1.2, < 3)
47
42
  git (1.5.0)
@@ -55,11 +50,9 @@ GEM
55
50
  highline (2.0.3)
56
51
  html_gen (0.0.16)
57
52
  string-cases
58
- i18n (1.7.0)
53
+ i18n (1.8.5)
59
54
  concurrent-ruby (~> 1.0)
60
55
  jar-dependencies (0.4.0)
61
- jaro_winkler (1.5.3)
62
- jaro_winkler (1.5.3-java)
63
56
  jdbc-sqlite3 (3.28.0)
64
57
  juwelier (2.4.9)
65
58
  builder
@@ -77,13 +70,13 @@ GEM
77
70
  kamelcase (0.0.2)
78
71
  semver2 (~> 3)
79
72
  mini_portile2 (2.4.0)
80
- minitest (5.12.2)
73
+ minitest (5.14.1)
81
74
  multi_json (1.14.1)
82
75
  multi_xml (0.6.0)
83
76
  multipart-post (2.1.1)
84
- nokogiri (1.10.4)
77
+ nokogiri (1.10.8)
85
78
  mini_portile2 (~> 2.4.0)
86
- nokogiri (1.10.4-java)
79
+ nokogiri (1.10.8-java)
87
80
  oauth2 (1.4.2)
88
81
  faraday (>= 0.8, < 2.0)
89
82
  jwt (>= 1.0, < 3.0)
@@ -91,49 +84,61 @@ GEM
91
84
  multi_xml (~> 0.5)
92
85
  rack (>= 1.2, < 3)
93
86
  orm_adapter (0.5.0)
94
- parallel (1.18.0)
95
- parser (2.6.5.0)
96
- ast (~> 2.4.0)
87
+ parallel (1.20.1)
88
+ parser (3.0.0.0)
89
+ ast (~> 2.4.1)
97
90
  psych (3.1.0)
98
91
  psych (3.1.0-java)
99
92
  jar-dependencies (>= 0.1.7)
100
93
  public_suffix (4.0.1)
101
- rack (2.0.7)
94
+ rack (2.2.3)
102
95
  rainbow (3.0.0)
103
96
  rake (13.0.0)
104
- rdoc (6.2.0)
105
- rspec (3.9.0)
106
- rspec-core (~> 3.9.0)
107
- rspec-expectations (~> 3.9.0)
108
- rspec-mocks (~> 3.9.0)
109
- rspec-core (3.9.0)
110
- rspec-support (~> 3.9.0)
111
- rspec-expectations (3.9.0)
97
+ rdoc (6.3.0)
98
+ regexp_parser (2.0.3)
99
+ rexml (3.2.4)
100
+ rspec (3.10.0)
101
+ rspec-core (~> 3.10.0)
102
+ rspec-expectations (~> 3.10.0)
103
+ rspec-mocks (~> 3.10.0)
104
+ rspec-core (3.10.0)
105
+ rspec-support (~> 3.10.0)
106
+ rspec-expectations (3.10.0)
112
107
  diff-lcs (>= 1.2.0, < 2.0)
113
- rspec-support (~> 3.9.0)
114
- rspec-mocks (3.9.0)
108
+ rspec-support (~> 3.10.0)
109
+ rspec-mocks (3.10.0)
115
110
  diff-lcs (>= 1.2.0, < 2.0)
116
- rspec-support (~> 3.9.0)
117
- rspec-support (3.9.0)
118
- rubocop (0.75.1)
119
- jaro_winkler (~> 1.5.1)
111
+ rspec-support (~> 3.10.0)
112
+ rspec-support (3.10.0)
113
+ rubocop (1.7.0)
120
114
  parallel (~> 1.10)
121
- parser (>= 2.6)
115
+ parser (>= 2.7.1.5)
122
116
  rainbow (>= 2.2.2, < 4.0)
117
+ regexp_parser (>= 1.8, < 3.0)
118
+ rexml
119
+ rubocop-ast (>= 1.2.0, < 2.0)
123
120
  ruby-progressbar (~> 1.7)
124
- unicode-display_width (>= 1.4.0, < 1.7)
125
- ruby-progressbar (1.10.1)
121
+ unicode-display_width (>= 1.4.0, < 2.0)
122
+ rubocop-ast (1.3.0)
123
+ parser (>= 2.7.1.5)
124
+ rubocop-performance (1.9.2)
125
+ rubocop (>= 0.90.0, < 2.0)
126
+ rubocop-ast (>= 0.4.0)
127
+ rubocop-rspec (2.1.0)
128
+ rubocop (~> 1.0)
129
+ rubocop-ast (>= 1.1.0)
130
+ ruby-progressbar (1.11.0)
126
131
  semver2 (3.4.2)
127
132
  simple_delegate (0.0.2)
128
- sqlite3 (1.4.1)
133
+ sqlite3 (1.4.2)
129
134
  string-cases (0.0.4)
130
135
  thread_safe (0.3.6)
131
136
  thread_safe (0.3.6-java)
132
- tzinfo (1.2.5)
137
+ tzinfo (1.2.7)
133
138
  thread_safe (~> 0.1)
134
- unicode-display_width (1.6.0)
139
+ unicode-display_width (1.7.0)
135
140
  wref (0.0.8)
136
- zeitwerk (2.2.0)
141
+ zeitwerk (2.4.0)
137
142
 
138
143
  PLATFORMS
139
144
  java
@@ -143,7 +148,7 @@ DEPENDENCIES
143
148
  array_enumerator
144
149
  auto_autoloader
145
150
  baza!
146
- best_practice_project!
151
+ best_practice_project
147
152
  bundler
148
153
  factory_bot
149
154
  html_gen
@@ -153,6 +158,8 @@ DEPENDENCIES
153
158
  rdoc
154
159
  rspec
155
160
  rubocop
161
+ rubocop-performance
162
+ rubocop-rspec
156
163
  simple_delegate
157
164
  sqlite3
158
165
  string-cases