validators 2.8.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +86 -0
  3. data/.travis.yml +12 -9
  4. data/Gemfile +2 -0
  5. data/Rakefile +10 -1
  6. data/bin/sync-disposable-hostnames +3 -3
  7. data/data/disposable.json +854 -4
  8. data/data/tld.json +2 -5
  9. data/lib/validators/constants.rb +9 -7
  10. data/lib/validators/disposable_hostnames.rb +4 -2
  11. data/lib/validators/hostname.rb +12 -10
  12. data/lib/validators/ip.rb +7 -3
  13. data/lib/validators/tld.rb +5 -2
  14. data/lib/validators/validates_cnpj_format_of.rb +6 -2
  15. data/lib/validators/validates_cpf_format_of.rb +6 -2
  16. data/lib/validators/validates_datetime.rb +23 -22
  17. data/lib/validators/validates_email_format_of.rb +4 -2
  18. data/lib/validators/validates_hostname_format_of.rb +2 -0
  19. data/lib/validators/validates_ip_address.rb +5 -1
  20. data/lib/validators/validates_ownership_of.rb +5 -1
  21. data/lib/validators/validates_ssh_private_key.rb +5 -5
  22. data/lib/validators/validates_ssh_public_key.rb +3 -1
  23. data/lib/validators/validates_url_format_of.rb +11 -5
  24. data/lib/validators/version.rb +6 -4
  25. data/lib/validators.rb +2 -0
  26. data/test/schema.rb +2 -0
  27. data/test/support/dates.rb +4 -2
  28. data/test/support/emails.rb +8 -6
  29. data/test/support/hostnames.rb +6 -4
  30. data/test/support/ips.rb +4 -2
  31. data/test/support/models.rb +2 -0
  32. data/test/support/urls.rb +8 -7
  33. data/test/test_helper.rb +21 -6
  34. data/test/validators/disposable_email_test.rb +2 -0
  35. data/test/validators/ip_test.rb +2 -0
  36. data/test/validators/validates_cnpj_format_of_test.rb +22 -7
  37. data/test/validators/validates_cpf_format_of_test.rb +22 -7
  38. data/test/validators/validates_datetime/after_option_test.rb +27 -1
  39. data/test/validators/validates_datetime/before_option_test.rb +2 -0
  40. data/test/validators/validates_datetime/defaults_test.rb +2 -0
  41. data/test/validators/validates_email_format_of_test.rb +2 -0
  42. data/test/validators/validates_hostname_format_of/with_tld_validation_test.rb +2 -0
  43. data/test/validators/validates_hostname_format_of/without_tld_validation_test.rb +7 -0
  44. data/test/validators/validates_ip_address/ipv4_test.rb +8 -0
  45. data/test/validators/validates_ip_address/ipv6_test.rb +2 -0
  46. data/test/validators/validates_ip_address_test.rb +2 -0
  47. data/test/validators/validates_ownership_of_test.rb +2 -0
  48. data/test/validators/validates_ssh_private_key/bits_test.rb +12 -8
  49. data/test/validators/validates_ssh_private_key/common_test.rb +22 -7
  50. data/test/validators/validates_ssh_private_key/dsa_test.rb +12 -8
  51. data/test/validators/validates_ssh_private_key/rsa_test.rb +12 -8
  52. data/test/validators/validates_ssh_public_key_test.rb +22 -7
  53. data/test/validators/validates_url_format_of/with_tld_validation_test.rb +2 -0
  54. data/test/validators/validates_url_format_of/without_tld_validation_test.rb +2 -0
  55. data/validators.gemspec +12 -7
  56. metadata +52 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d95fb5794f7e88f797b37396dce38a4878a4c6536a279e33ddffae6ac23fd9d
4
- data.tar.gz: 895f28e49687ebb33366b9fefa581bb1690b30bdd69634047b1ad537443e1715
3
+ metadata.gz: dff27e8c867e5bec933ca7d0a48d39a9035d305fce4abc45fdf172aad10ef832
4
+ data.tar.gz: b84c8d392ecca8b049b8c200057d9790cda2d7837d5107a0c41a7f68d1b0edaa
5
5
  SHA512:
6
- metadata.gz: 9ae0ef43719f0368b7417d3a5184645b7dbfcc0a7962871dffdeb69405df3e74b0a4922dbcb8827caa0033fb1df11b0867404d1dc03b1c2e2f002516e85581d4
7
- data.tar.gz: a382303b51eafd21c2f4a1907b58c1111d8e2d3dca62f94fa2033f2f0b7f77d3c59cb47fdffd4c5121266ac2269af35bb0e20a5d43ab785d7e8e7438103d035a
6
+ metadata.gz: 367bc5f122844017dd15e14d5f44dbc9837ac46d5492d3e8fe892f1525a470a624235432b86644078f81a46e240857a26745f885ebedd1d6096f7dff1dc05df6
7
+ data.tar.gz: 2ab57842a75aaec739b70ed0f29efd5d227a6ec857b0814bbbaee5b75e66382154e4f763c5f6750a7692cb61497612050dc79681c21d2edca7a7f7f3cf55cc37
data/.rubocop.yml ADDED
@@ -0,0 +1,86 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+ TargetRailsVersion: 5.2
4
+
5
+ Exclude:
6
+ - db/schema.rb
7
+ - db/seeds.rb
8
+ - config/environments/**/*.rb
9
+ - bin/**/*
10
+ - vendor/**/*
11
+
12
+ Style/Documentation:
13
+ Enabled: false
14
+
15
+ Style/StringLiterals:
16
+ EnforcedStyle: double_quotes
17
+
18
+ Layout/SpaceInsideBlockBraces:
19
+ EnforcedStyle: space
20
+ EnforcedStyleForEmptyBraces: space
21
+ SpaceBeforeBlockParameters: false
22
+
23
+ Layout/SpaceInsideHashLiteralBraces:
24
+ EnforcedStyle: no_space
25
+ EnforcedStyleForEmptyBraces: no_space
26
+
27
+ Layout/FirstArrayElementLineBreak:
28
+ Enabled: true
29
+
30
+ Layout/FirstHashElementLineBreak:
31
+ Enabled: true
32
+
33
+ Style/PercentLiteralDelimiters:
34
+ PreferredDelimiters:
35
+ '%': '[]'
36
+ '%i': '[]'
37
+ '%q': '[]'
38
+ '%Q': '[]'
39
+ '%r': '{}'
40
+ '%s': '[]'
41
+ '%w': '[]'
42
+ '%W': '[]'
43
+ '%x': '[]'
44
+
45
+ Metrics/LineLength:
46
+ Enabled: false
47
+
48
+ Metrics/MethodLength:
49
+ Enabled: false
50
+
51
+ Style/EmptyMethod:
52
+ EnforcedStyle: expanded
53
+
54
+ Layout/IndentArray:
55
+ EnforcedStyle: consistent
56
+
57
+ Style/AccessModifierDeclarations:
58
+ EnforcedStyle: inline
59
+
60
+ Naming/UncommunicativeMethodParamName:
61
+ Enabled: false
62
+
63
+ Style/Alias:
64
+ EnforcedStyle: prefer_alias_method
65
+
66
+ Metrics/CyclomaticComplexity:
67
+ Enabled: false
68
+
69
+ Metrics/AbcSize:
70
+ Enabled: false
71
+
72
+ Metrics/PerceivedComplexity:
73
+ Enabled: false
74
+
75
+ Style/AsciiComments:
76
+ Enabled: false
77
+
78
+ Style/HashSyntax:
79
+ Exclude:
80
+ - Rakefile
81
+ - "**/*.rake"
82
+
83
+ Style/SymbolArray:
84
+ Exclude:
85
+ - Rakefile
86
+ - "**/*.rake"
data/.travis.yml CHANGED
@@ -2,15 +2,18 @@ language: ruby
2
2
  cache: bundler
3
3
  sudo: false
4
4
  script: bundle exec rake
5
+ before_script:
6
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
7
+ - chmod +x ./cc-test-reporter
8
+ - "./cc-test-reporter before-build"
9
+ after_script:
10
+ - "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"
5
11
  notifications:
6
12
  email: false
7
13
  rvm:
8
- - '2.4.1'
9
- - '2.3.0'
10
- - '2.2.7'
11
- addons:
12
- code_climate:
13
- repo_token:
14
- secure: CX0AIDehELC1kcnvfeLLnhKpX68OCh7OhyRuFhJbMLt9NEu5FjLJgR3IF4V/e+BeyUIEi+xidi/Xa9j+06BbCGtjGmmgTde/Zp9qpVHOwsiGXYn4zkZZmudUQXdF/S3CrBkwauXC8HTUS1OIeGylK5fhW/fz+PpwU7ocQahrhvc=
15
- after_success:
16
- - bundle exec codeclimate-test-reporter
14
+ - 2.6.1
15
+ - 2.5.3
16
+ - 2.4.5
17
+ env:
18
+ global:
19
+ secure: P3k49Psmw9C7Z0FL0A93H/aD4Xsu+VEccD51FmP2Cw0oeGHpReafU07izyYkQ/Y8jmxOiPiLS29b39PNuGa0DF1MnbW9Tmr9eSrct3v4B0WTj+SA8ZcBEKwS/SQMgJnfEJq6jeWS9gpRtCrDHFGGFHJvtVYGHragwfY+evlN2MI=
data/Gemfile CHANGED
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "http://rubygems.org"
2
4
  gemspec
data/Rakefile CHANGED
@@ -1,5 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/setup"
1
4
  require "bundler/gem_tasks"
2
5
  require "rake/testtask"
6
+ require "rubocop/rake_task"
7
+
8
+ RuboCop::RakeTask.new(:rubocop) do |t|
9
+ t.options << "--config"
10
+ t.options << File.expand_path(".rubocop.yml", __dir__)
11
+ end
3
12
 
4
13
  Rake::TestTask.new(:test) do |t|
5
14
  t.libs << "test"
@@ -7,4 +16,4 @@ Rake::TestTask.new(:test) do |t|
7
16
  t.warning = false
8
17
  end
9
18
 
10
- task :default => :test
19
+ task :default => [:test, :rubocop]
@@ -3,9 +3,9 @@
3
3
  require "open-uri"
4
4
  require "json"
5
5
 
6
- domains = JSON.load(open("https://raw.githubusercontent.com/ivolo/disposable-email-domains/master/index.json").read)
7
- domains += JSON.load(open("https://raw.githubusercontent.com/andreis/disposable-email-domains/master/domains.json").read)
8
- domains += JSON.load(open("https://raw.githubusercontent.com/FGRibreau/mailchecker/master/list.json").read).flatten
6
+ domains = JSON.parse(open("https://raw.githubusercontent.com/ivolo/disposable-email-domains/master/index.json").read)
7
+ domains += JSON.parse(open("https://raw.githubusercontent.com/andreis/disposable-email-domains/master/domains.json").read)
8
+ domains += JSON.parse(open("https://raw.githubusercontent.com/FGRibreau/mailchecker/master/list.json").read).flatten
9
9
 
10
10
  domains.map!(&:downcase)
11
11
  domains.uniq!