lite-validators 1.0.6 → 1.0.7

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: a4ab573f6333ac1eef65062bd05ae783281cd2da6f70d1a6e146ba5befe6a29d
4
- data.tar.gz: 5b69cad7d3d9021016b78753f6dc028e9f353e88f53177b992a0bef1ea6b279a
3
+ metadata.gz: aa4341244152d291308c7a9edd48e8d235f1657578a9eecd8d3d5d28b465d00a
4
+ data.tar.gz: b34592d551ef350f1b216fbd88f9ad7f8e0d11193ac9400d3e3eac0103b7653f
5
5
  SHA512:
6
- metadata.gz: 2818016f0d2f7411102d45ba354e1e5edd21d25b4a4e935f1d1e98bc7778caf451d5101061a6b33e4114e9d6b663f117711c69ecf9169b1bca38b70105b75660
7
- data.tar.gz: ad7fec82c975771f716c0239c7bfb66abdf6781423986021397a56676f12c8911178dc773f7630310fb1abdd82688c8c45bd4558e8631c06b77522258c7a39cd
6
+ metadata.gz: 49a85d5b957728130ffcf4462bd7d3b6105723fcd7ee9c48c19f8946981f5e74ab8d4f9ad9422d42a267a22d8c3c1fb29685262e0825cb3fc6a150d408be3106
7
+ data.tar.gz: 47bf5ed04f21427556a67d7bb06f92f8015a4c7b2d452dce4d42ae97d98bc1eb97e53c378bb3f08e7e11cbf39911e24bbca4028136b23c426f023a8bd1d5c70c
@@ -2,11 +2,12 @@ require:
2
2
  - rubocop-performance
3
3
  - rubocop-rspec
4
4
  AllCops:
5
- TargetRubyVersion: 2.6
5
+ TargetRubyVersion: 2.7
6
+ NewCops: enable
6
7
  DisplayCopNames: true
7
8
  DisplayStyleGuide: true
8
- LineLength:
9
- Max: 100
9
+ Layout/EmptyLinesAroundAttributeAccessor:
10
+ Enabled: true
10
11
  Layout/EmptyLinesAroundBlockBody:
11
12
  Exclude:
12
13
  - 'spec/**/**/*'
@@ -14,6 +15,14 @@ Layout/EmptyLinesAroundClassBody:
14
15
  EnforcedStyle: empty_lines_except_namespace
15
16
  Layout/EmptyLinesAroundModuleBody:
16
17
  EnforcedStyle: empty_lines_except_namespace
18
+ Layout/LineLength:
19
+ Max: 100
20
+ Layout/SpaceAroundMethodCallOperator:
21
+ Enabled: true
22
+ Lint/RaiseException:
23
+ Enabled: true
24
+ Lint/StructNewOverride:
25
+ Enabled: true
17
26
  Metrics/BlockLength:
18
27
  Exclude:
19
28
  - 'spec/**/**/*'
@@ -4,6 +4,7 @@ cache: bundler
4
4
  rvm:
5
5
  - 2.5
6
6
  - 2.6
7
+ - 2.7
7
8
  - ruby-head
8
9
  matrix:
9
10
  fast_finish: true
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.0.7] - 2020-07-03
10
+ ### Added
11
+ - Added Ruby 2.7 support
12
+
9
13
  ## [1.0.6] - 2019-09-18
10
14
  ### Added
11
15
  - Added true and false only checks to boolean validator
@@ -1,115 +1,120 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lite-validators (1.0.6)
4
+ lite-validators (1.0.7)
5
5
  activemodel
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionpack (6.0.0)
11
- actionview (= 6.0.0)
12
- activesupport (= 6.0.0)
13
- rack (~> 2.0)
10
+ actionpack (6.0.3.2)
11
+ actionview (= 6.0.3.2)
12
+ activesupport (= 6.0.3.2)
13
+ rack (~> 2.0, >= 2.0.8)
14
14
  rack-test (>= 0.6.3)
15
15
  rails-dom-testing (~> 2.0)
16
16
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
17
- actionview (6.0.0)
18
- activesupport (= 6.0.0)
17
+ actionview (6.0.3.2)
18
+ activesupport (= 6.0.3.2)
19
19
  builder (~> 3.1)
20
20
  erubi (~> 1.4)
21
21
  rails-dom-testing (~> 2.0)
22
22
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
23
- activemodel (6.0.0)
24
- activesupport (= 6.0.0)
25
- activesupport (6.0.0)
23
+ activemodel (6.0.3.2)
24
+ activesupport (= 6.0.3.2)
25
+ activesupport (6.0.3.2)
26
26
  concurrent-ruby (~> 1.0, >= 1.0.2)
27
27
  i18n (>= 0.7, < 2)
28
28
  minitest (~> 5.1)
29
29
  tzinfo (~> 1.1)
30
- zeitwerk (~> 2.1, >= 2.1.8)
31
- ast (2.4.0)
32
- builder (3.2.3)
30
+ zeitwerk (~> 2.2, >= 2.2.2)
31
+ ast (2.4.1)
32
+ builder (3.2.4)
33
33
  colorize (0.8.1)
34
- concurrent-ruby (1.1.5)
35
- crass (1.0.4)
36
- diff-lcs (1.3)
37
- erubi (1.8.0)
38
- fasterer (0.6.0)
34
+ concurrent-ruby (1.1.6)
35
+ crass (1.0.6)
36
+ diff-lcs (1.4.4)
37
+ erubi (1.9.0)
38
+ fasterer (0.8.3)
39
39
  colorize (~> 0.7)
40
- ruby_parser (>= 3.13.0)
41
- i18n (1.6.0)
40
+ ruby_parser (>= 3.14.1)
41
+ i18n (1.8.3)
42
42
  concurrent-ruby (~> 1.0)
43
- jaro_winkler (1.5.3)
44
- loofah (2.2.3)
43
+ loofah (2.6.0)
45
44
  crass (~> 1.0.2)
46
45
  nokogiri (>= 1.5.9)
47
- method_source (0.9.2)
46
+ method_source (1.0.0)
48
47
  mini_portile2 (2.4.0)
49
- minitest (5.11.3)
50
- nokogiri (1.10.4)
48
+ minitest (5.14.1)
49
+ nokogiri (1.10.9)
51
50
  mini_portile2 (~> 2.4.0)
52
- parallel (1.17.0)
53
- parser (2.6.4.1)
54
- ast (~> 2.4.0)
55
- rack (2.0.7)
51
+ parallel (1.19.2)
52
+ parser (2.7.1.4)
53
+ ast (~> 2.4.1)
54
+ rack (2.2.3)
56
55
  rack-test (1.1.0)
57
56
  rack (>= 1.0, < 3)
58
57
  rails-dom-testing (2.0.3)
59
58
  activesupport (>= 4.2.0)
60
59
  nokogiri (>= 1.6)
61
- rails-html-sanitizer (1.2.0)
62
- loofah (~> 2.2, >= 2.2.2)
63
- railties (6.0.0)
64
- actionpack (= 6.0.0)
65
- activesupport (= 6.0.0)
60
+ rails-html-sanitizer (1.3.0)
61
+ loofah (~> 2.3)
62
+ railties (6.0.3.2)
63
+ actionpack (= 6.0.3.2)
64
+ activesupport (= 6.0.3.2)
66
65
  method_source
67
66
  rake (>= 0.8.7)
68
67
  thor (>= 0.20.3, < 2.0)
69
68
  rainbow (3.0.0)
70
- rake (12.3.3)
71
- rspec (3.8.0)
72
- rspec-core (~> 3.8.0)
73
- rspec-expectations (~> 3.8.0)
74
- rspec-mocks (~> 3.8.0)
75
- rspec-core (3.8.2)
76
- rspec-support (~> 3.8.0)
77
- rspec-expectations (3.8.4)
69
+ rake (13.0.1)
70
+ regexp_parser (1.7.1)
71
+ rexml (3.2.4)
72
+ rspec (3.9.0)
73
+ rspec-core (~> 3.9.0)
74
+ rspec-expectations (~> 3.9.0)
75
+ rspec-mocks (~> 3.9.0)
76
+ rspec-core (3.9.2)
77
+ rspec-support (~> 3.9.3)
78
+ rspec-expectations (3.9.2)
78
79
  diff-lcs (>= 1.2.0, < 2.0)
79
- rspec-support (~> 3.8.0)
80
- rspec-mocks (3.8.1)
80
+ rspec-support (~> 3.9.0)
81
+ rspec-mocks (3.9.1)
81
82
  diff-lcs (>= 1.2.0, < 2.0)
82
- rspec-support (~> 3.8.0)
83
- rspec-rails (3.8.2)
84
- actionpack (>= 3.0)
85
- activesupport (>= 3.0)
86
- railties (>= 3.0)
87
- rspec-core (~> 3.8.0)
88
- rspec-expectations (~> 3.8.0)
89
- rspec-mocks (~> 3.8.0)
90
- rspec-support (~> 3.8.0)
91
- rspec-support (3.8.2)
92
- rubocop (0.74.0)
93
- jaro_winkler (~> 1.5.1)
83
+ rspec-support (~> 3.9.0)
84
+ rspec-rails (4.0.1)
85
+ actionpack (>= 4.2)
86
+ activesupport (>= 4.2)
87
+ railties (>= 4.2)
88
+ rspec-core (~> 3.9)
89
+ rspec-expectations (~> 3.9)
90
+ rspec-mocks (~> 3.9)
91
+ rspec-support (~> 3.9)
92
+ rspec-support (3.9.3)
93
+ rubocop (0.86.0)
94
94
  parallel (~> 1.10)
95
- parser (>= 2.6)
95
+ parser (>= 2.7.0.1)
96
96
  rainbow (>= 2.2.2, < 4.0)
97
+ regexp_parser (>= 1.7)
98
+ rexml
99
+ rubocop-ast (>= 0.0.3, < 1.0)
97
100
  ruby-progressbar (~> 1.7)
98
- unicode-display_width (>= 1.4.0, < 1.7)
99
- rubocop-performance (1.4.1)
101
+ unicode-display_width (>= 1.4.0, < 2.0)
102
+ rubocop-ast (0.1.0)
103
+ parser (>= 2.7.0.1)
104
+ rubocop-performance (1.6.1)
100
105
  rubocop (>= 0.71.0)
101
- rubocop-rspec (1.35.0)
102
- rubocop (>= 0.60.0)
106
+ rubocop-rspec (1.41.0)
107
+ rubocop (>= 0.68.1)
103
108
  ruby-progressbar (1.10.1)
104
- ruby_parser (3.13.1)
109
+ ruby_parser (3.14.2)
105
110
  sexp_processor (~> 4.9)
106
- sexp_processor (4.12.1)
107
- thor (0.20.3)
111
+ sexp_processor (4.15.0)
112
+ thor (1.0.1)
108
113
  thread_safe (0.3.6)
109
- tzinfo (1.2.5)
114
+ tzinfo (1.2.7)
110
115
  thread_safe (~> 0.1)
111
- unicode-display_width (1.6.0)
112
- zeitwerk (2.1.10)
116
+ unicode-display_width (1.7.0)
117
+ zeitwerk (2.3.1)
113
118
 
114
119
  PLATFORMS
115
120
  ruby
@@ -127,4 +132,4 @@ DEPENDENCIES
127
132
  rubocop-rspec
128
133
 
129
134
  BUNDLED WITH
130
- 2.0.1
135
+ 2.1.4
@@ -2,8 +2,8 @@
2
2
 
3
3
  class Base64Validator < BaseValidator
4
4
 
5
- # rubocop:disable Metrics/LineLength
5
+ # rubocop:disable Layout/LineLength
6
6
  REGEXP ||= /^(?:[A-Za-z0-9+$]{4})*(?:[A-Za-z0-9+$]{2}==|[A-Za-z0-9+$]{3}=|[A-Za-z0-9+$]{4})$/.freeze
7
- # rubocop:enable Metrics/LineLength
7
+ # rubocop:enable Layout/LineLength
8
8
 
9
9
  end
@@ -19,7 +19,7 @@ class BaseValidator < ActiveModel::EachValidator
19
19
  @value = value
20
20
  end
21
21
 
22
- # rubocop:disable Metrics/LineLength
22
+ # rubocop:disable Layout/LineLength
23
23
  def assert_valid_option!(name, collection, option: nil)
24
24
  option ||= send(name)
25
25
 
@@ -29,7 +29,7 @@ class BaseValidator < ActiveModel::EachValidator
29
29
  raise ArgumentError, "Unknown #{name}: #{option_value.inspect}. Valid options are: #{collection.map(&:inspect).join(', ')}"
30
30
  end
31
31
  end
32
- # rubocop:enable Metrics/LineLength
32
+ # rubocop:enable Layout/LineLength
33
33
 
34
34
  def error_message
35
35
  [options[:message] || :invalid]
@@ -19,7 +19,7 @@ class CsvValidator < FileSizeValidator
19
19
 
20
20
  private
21
21
 
22
- # rubocop:disable Metrics/LineLength, Style/GuardClause
22
+ # rubocop:disable Layout/LineLength, Style/GuardClause
23
23
  def assert_valid_dimensions!
24
24
  if dimensions.empty?
25
25
  raise ArgumentError, "Missing atleast one dimension of #{DIMENSIONS.map(&:inspect).join(', ')} attribute for comparison."
@@ -27,7 +27,7 @@ class CsvValidator < FileSizeValidator
27
27
  assert_valid_option!(:dimensions, DIMENSIONS)
28
28
  end
29
29
  end
30
- # rubocop:enable Metrics/LineLength, Style/GuardClause
30
+ # rubocop:enable Layout/LineLength, Style/GuardClause
31
31
 
32
32
  def csv_dimensions(path)
33
33
  dimension = { columns: 0, rows: 0 }
@@ -52,7 +52,7 @@ class CsvValidator < FileSizeValidator
52
52
  def error_message_for(dimension, check, check_value)
53
53
  options[:message] || I18n.t(
54
54
  "errors.messages.csv.#{check}",
55
- error_options(check_value).merge(dimension: dimension)
55
+ **error_options(check_value).merge(dimension: dimension)
56
56
  )
57
57
  end
58
58
 
@@ -20,7 +20,7 @@ class FileSizeValidator < BaseValidator
20
20
 
21
21
  private
22
22
 
23
- # rubocop:disable Metrics/LineLength, Style/GuardClause
23
+ # rubocop:disable Layout/LineLength, Style/GuardClause
24
24
  def assert_valid_checks!
25
25
  if checks.empty?
26
26
  raise ArgumentError, "Missing atleast one check of #{CHECKS.keys.map(&:inspect).join(', ')} attribute for comparison."
@@ -28,7 +28,7 @@ class FileSizeValidator < BaseValidator
28
28
  assert_valid_option!(:checks, CHECKS.keys)
29
29
  end
30
30
  end
31
- # rubocop:enable Metrics/LineLength, Style/GuardClause
31
+ # rubocop:enable Layout/LineLength, Style/GuardClause
32
32
 
33
33
  def checks
34
34
  options.keys & CHECKS.keys
@@ -37,7 +37,7 @@ class FileSizeValidator < BaseValidator
37
37
  def error_message_for(option, option_value)
38
38
  options[:message] || I18n.t(
39
39
  "errors.messages.file_size.#{option}",
40
- error_options(option_value)
40
+ **error_options(option_value)
41
41
  )
42
42
  end
43
43
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  class ImeiValidator < BaseValidator
4
4
 
5
- REGEXP ||= /\A[\d\.\:\-\s]+\z/i.freeze
5
+ REGEXP ||= /\A[\d.:\-\s]+\z/i.freeze
6
6
 
7
7
  private
8
8
 
@@ -2,9 +2,9 @@
2
2
 
3
3
  class IsinValidator < BaseValidator
4
4
 
5
- # rubocop:disable Metrics/LineLength
5
+ # rubocop:disable Layout/LineLength
6
6
  REGEXP ||= /^((AF|AX|AL|DZ|AS|AD|AO|AI|AQ|AG|AR|AM|AW|AU|AT|AZ|BS|BH|BD|BB|BY|BE|BZ|BJ|BM|BT|BO|BQ|BA|BW|BV|BR|IO|BN|BG|BF|BI|KH|CM|CA|CV|KY|CF|TD|CL|CN|CX|CC|CO|KM|CG|CD|CK|CR|CI|HR|CU|CW|CY|CZ|DK|DJ|DM|DO|EC|EG|SV|GQ|ER|EE|ET|FK|FO|FJ|FI|FR|GF|PF|TF|GA|GM|GE|DE|GH|GI|GR|GL|GD|GP|GU|GT|GG|GN|GW|GY|HT|HM|VA|HN|HK|HU|IS|IN|ID|IR|IQ|IE|IM|IL|IT|JM|JP|JE|JO|KZ|KE|KI|KP|KR|KW|KG|LA|LV|LB|LS|LR|LY|LI|LT|LU|MO|MK|MG|MW|MY|MV|ML|MT|MH|MQ|MR|MU|YT|MX|FM|MD|MC|MN|ME|MS|MA|MZ|MM|NA|NR|NP|NL|NC|NZ|NI|NE|NG|NU|NF|MP|NO|OM|PK|PW|PS|PA|PG|PY|PE|PH|PN|PL|PT|PR|QA|RE|RO|RU|RW|BL|SH|KN|LC|MF|PM|VC|WS|SM|ST|SA|SN|RS|SC|SL|SG|SX|SK|SI|SB|SO|ZA|GS|SS|ES|LK|SD|SR|SJ|SZ|SE|CH|SY|TW|TJ|TZ|TH|TL|TG|TK|TO|TT|TN|TR|TM|TC|TV|UG|UA|AE|GB|US|UM|UY|UZ|VU|VE|VN|VG|VI|WF|EH|YE|ZM|ZW{2})([A-Z0-9]{9}))(\d{1})$/.freeze
7
- # rubocop:enable Metrics/LineLength
7
+ # rubocop:enable Layout/LineLength
8
8
 
9
9
  private
10
10
 
@@ -12,7 +12,7 @@ class IsinValidator < BaseValidator
12
12
  valid_regexp? && valid_checksum?
13
13
  end
14
14
 
15
- # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
15
+ # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
16
16
  def valid_checksum?
17
17
  characters = value.chars
18
18
  digits = characters.map { |chr| /[A-Z]/.match?(chr) ? (chr.ord - 55) : chr.to_i }
@@ -31,6 +31,6 @@ class IsinValidator < BaseValidator
31
31
 
32
32
  (10 - (total % 10)) % 10
33
33
  end
34
- # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
34
+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
35
35
 
36
36
  end
@@ -3,10 +3,10 @@
3
3
  class MacAddressValidator < BaseValidator
4
4
 
5
5
  REGEXP ||= [
6
- /^([\h]{2}[-|\.:|\s]){5}[\h]{2}?$/i,
7
- /^([\h]{4}[-|\.:|\s]){2}[\h]{4}?$/i,
8
- /^([\h]{6}[-|\.:|\s])[\h]{6}?$/i,
9
- /^[\h]{12}?$/i
6
+ /^(\h{2}[-|.:|\s]){5}\h{2}?$/i,
7
+ /^(\h{4}[-|.:|\s]){2}\h{4}?$/i,
8
+ /^(\h{6}[-|.:|\s])\h{6}?$/i,
9
+ /^\h{12}?$/i
10
10
  ].freeze
11
11
 
12
12
  private
@@ -2,6 +2,6 @@
2
2
 
3
3
  class PhoneNumberValidator < BaseValidator
4
4
 
5
- REGEXP ||= %r{^[0-9+\(\)#\.\s/ext-]+$}.freeze
5
+ REGEXP ||= %r{^[0-9+()#.\s/ext-]+$}.freeze
6
6
 
7
7
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  class SsnValidator < BaseValidator
4
4
 
5
- REGEXP ||= /^\A([\d]{3}\-[\d]{2}\-[\d]{4}|[\d]{9})\Z$/.freeze
5
+ REGEXP ||= /^\A(\d{3}-\d{2}-\d{4}|\d{9})\Z$/.freeze
6
6
 
7
7
  end
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Validators
5
5
 
6
- VERSION ||= '1.0.6'
6
+ VERSION ||= '1.0.7'
7
7
 
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lite-validators
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-18 00:00:00.000000000 Z
11
+ date: 2020-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -150,7 +150,7 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
- description:
153
+ description:
154
154
  email:
155
155
  - j.gomez@drexed.com
156
156
  executables: []
@@ -245,7 +245,7 @@ homepage: http://drexed.github.io/lite-validators
245
245
  licenses:
246
246
  - MIT
247
247
  metadata: {}
248
- post_install_message:
248
+ post_install_message:
249
249
  rdoc_options: []
250
250
  require_paths:
251
251
  - lib
@@ -260,8 +260,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
260
  - !ruby/object:Gem::Version
261
261
  version: '0'
262
262
  requirements: []
263
- rubygems_version: 3.0.4
264
- signing_key:
263
+ rubygems_version: 3.1.4
264
+ signing_key:
265
265
  specification_version: 4
266
266
  summary: Collection of ActiveModel/ActiveRecord validators
267
267
  test_files: []