rubocop-config-captive 1.11.0 → 1.12.0
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e81a471fa3598969b05e170d8e0c4306d92e23c3cbd94004a04fe5b158974ce
|
4
|
+
data.tar.gz: 22035f11b13c2d090985a2ae076f79622e6ab2924db3010283539a4a96fb2b25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5e5960449fab282489dd89f18d7d0c4d03aafb413c64144519d2009ba811587f18c3a158da27349ad435976f8608c7e7eab6942a22e3f31e8caacdc9ba14440
|
7
|
+
data.tar.gz: 743c84ce65acf593a6a11d7712a451f53a096545686d61a1f42428553dc9ad6d7eff7f5d24a28dad80b7fd84c4913d7bd33a3ce59c6c8ef6e589e81d42cd7338
|
data/config/rubocop-captive.yml
CHANGED
@@ -7,6 +7,7 @@ require:
|
|
7
7
|
- ../lib/rubocop/cop/captive/rails/force_ssl_enabled_in_production.rb
|
8
8
|
- ../lib/rubocop/cop/captive/rails/migration_methods.rb
|
9
9
|
- ../lib/rubocop/cop/captive/rails/no_email_from_controller.rb
|
10
|
+
- ../lib/rubocop/cop/captive/rails/no_float_price_columns.rb
|
10
11
|
- ../lib/rubocop/cop/captive/string_where_in_scope.rb
|
11
12
|
- ../lib/rubocop/cop/captive/no_app_env.rb
|
12
13
|
|
@@ -56,6 +57,12 @@ Captive/Rails/NoEmailFromController:
|
|
56
57
|
Include:
|
57
58
|
- 'app/controllers/**/*'
|
58
59
|
|
60
|
+
# Rails
|
61
|
+
Captive/Rails/NoFloatPriceColumns:
|
62
|
+
Description: "Avoid using `float` type for price columns. Use `decimal, precision: 10, scale: 2` instead."
|
63
|
+
Include:
|
64
|
+
- 'db/migrate/**/*'
|
65
|
+
|
59
66
|
# other
|
60
67
|
Captive/StringWhereInScope:
|
61
68
|
Description: 'The `where` method should be used in a scope in a model.'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Captive
|
6
|
+
module Rails
|
7
|
+
class NoFloatPriceColumns < Base
|
8
|
+
MSG = "Avoid using `float` type for price columns. \
|
9
|
+
Use `decimal, precision: 10, scale: 2` instead."
|
10
|
+
|
11
|
+
def_node_matcher :add_column_call?, <<~PATTERN
|
12
|
+
(send nil? :add_column _ $(sym {:price :prix}) (sym :float) ...)
|
13
|
+
PATTERN
|
14
|
+
|
15
|
+
def on_send(node)
|
16
|
+
add_column_call?(node) do |column|
|
17
|
+
add_offense(column, message: MSG)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-config-captive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Captive
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-07-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|
@@ -187,6 +187,7 @@ files:
|
|
187
187
|
- lib/rubocop/cop/captive/rails/force_ssl_enabled_in_production.rb
|
188
188
|
- lib/rubocop/cop/captive/rails/migration_methods.rb
|
189
189
|
- lib/rubocop/cop/captive/rails/no_email_from_controller.rb
|
190
|
+
- lib/rubocop/cop/captive/rails/no_float_price_columns.rb
|
190
191
|
- lib/rubocop/cop/captive/rspec/specify_before_parameter.rb
|
191
192
|
- lib/rubocop/cop/captive/string_where_in_scope.rb
|
192
193
|
- lib/rubocop/cop/captive/translation/devise_i18n_presence.rb
|
@@ -212,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
213
|
- !ruby/object:Gem::Version
|
213
214
|
version: '0'
|
214
215
|
requirements: []
|
215
|
-
rubygems_version: 3.3.
|
216
|
+
rubygems_version: 3.3.27
|
216
217
|
signing_key:
|
217
218
|
specification_version: 4
|
218
219
|
summary: Shared rubocop configurations
|