public_suffix 2.0.5 → 4.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +5 -5
  2. data/.github/FUNDING.yml +12 -0
  3. data/.github/dependabot.yml +8 -0
  4. data/.github/workflows/release.yml +16 -0
  5. data/.github/workflows/tests.yml +28 -0
  6. data/.gitignore +5 -8
  7. data/.rubocop.yml +19 -1
  8. data/{.rubocop_defaults.yml → .rubocop_opinionated.yml} +62 -34
  9. data/CHANGELOG.md +156 -54
  10. data/Gemfile +9 -5
  11. data/LICENSE.txt +1 -1
  12. data/README.md +44 -15
  13. data/Rakefile +9 -4
  14. data/SECURITY.md +104 -0
  15. data/bin/console +15 -0
  16. data/data/list.txt +3163 -973
  17. data/lib/public_suffix/domain.rb +4 -4
  18. data/lib/public_suffix/errors.rb +3 -1
  19. data/lib/public_suffix/list.rb +78 -117
  20. data/lib/public_suffix/rule.rb +54 -62
  21. data/lib/public_suffix/version.rb +8 -3
  22. data/lib/public_suffix.rb +38 -32
  23. data/public_suffix.gemspec +9 -5
  24. data/test/.empty +2 -0
  25. data/test/acceptance_test.rb +43 -31
  26. data/test/benchmarks/bm_find.rb +66 -0
  27. data/test/benchmarks/bm_find_all.rb +102 -0
  28. data/test/benchmarks/bm_names.rb +91 -0
  29. data/test/benchmarks/bm_select.rb +26 -0
  30. data/test/benchmarks/bm_select_incremental.rb +25 -0
  31. data/test/benchmarks/bm_valid.rb +101 -0
  32. data/test/profilers/domain_profiler.rb +12 -0
  33. data/test/profilers/find_profiler.rb +12 -0
  34. data/test/profilers/find_profiler_jp.rb +12 -0
  35. data/test/{initialization_profiler.rb → profilers/initialization_profiler.rb} +1 -1
  36. data/test/profilers/list_profsize.rb +11 -0
  37. data/test/profilers/object_binsize.rb +57 -0
  38. data/test/psl_test.rb +7 -4
  39. data/test/test_helper.rb +3 -14
  40. data/test/unit/domain_test.rb +17 -15
  41. data/test/unit/errors_test.rb +2 -0
  42. data/test/unit/list_test.rb +54 -72
  43. data/test/unit/public_suffix_test.rb +24 -22
  44. data/test/unit/rule_test.rb +77 -79
  45. metadata +32 -70
  46. data/.ruby-gemset +0 -1
  47. data/.travis.yml +0 -23
  48. data/test/benchmark_helper.rb +0 -4
  49. data/test/execution_profiler.rb +0 -14
  50. data/test/performance_benchmark.rb +0 -38
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8cfe3b74b59027cb0ea547a7434da2665825ef04
4
- data.tar.gz: 10279692a57a255917c1555ff74c7f992afd4f2a
2
+ SHA256:
3
+ metadata.gz: 4ea7129dc0659a87fad96459afefddaafdb4280eac62895e036ce1e2bcf14d91
4
+ data.tar.gz: a335705e6ba76d959f52b3e4acea7be1f97c472af3b05a34cd15bae9a3301582
5
5
  SHA512:
6
- metadata.gz: e352ccd768b78298ec8be30f2c6c15234c76251f214437e163e2d2ded6d7d3ded12772bea050363d4c589017f3c554ff460007f069aa756e25c6ce89aad3aabe
7
- data.tar.gz: 3f2b212e721922a0e161c15ecaeb6ceaa5ac81fb0fbca8a744058760fb1ec51e9ea1b5a90da9c10ca14e0618fcafb1e548f1f3b3740d8940b57e022a9294acb3
6
+ metadata.gz: 1d1a8d2f55e733e6f2ed7f7ed233cda997e55b0838b2926488c15e86586a72329ee2392af7ccc94dd3a5b04c60f3bbd0358fe38c0f4e82e0c13ae513a0dafdf4
7
+ data.tar.gz: aced9afff807ed3c71457871d68b56f7288cff8e5379da534f9deccea735ca1911074b7f300795f021e7b17a1ccf4ced27630efd3d1dd667c10a998b611fb71c
@@ -0,0 +1,12 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: "rubygems/public_suffix"
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ otechie: # Replace with a single Otechie username
12
+ custom: # Replace with a single custom sponsorship URL
@@ -0,0 +1,8 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "04:00"
8
+ open-pull-requests-limit: 10
@@ -0,0 +1,16 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - v*.*.*
7
+ jobs:
8
+ release:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - name: Release Gem
13
+ uses: cadwallion/publish-rubygems-action@8f9e0538302643309e4e43bf48cd34173ca48cfc
14
+ env:
15
+ RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
16
+ RELEASE_COMMAND: rake release
@@ -0,0 +1,28 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ build:
10
+ strategy:
11
+ matrix:
12
+ ruby-version:
13
+ - "2.6"
14
+ - "2.7"
15
+ - "3.0"
16
+ - "3.1"
17
+ platform: [ubuntu-latest]
18
+ runs-on: ${{ matrix.platform }}
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby-version }}
25
+ - name: Install dependencies
26
+ run: bundle install
27
+ - name: Run tests
28
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -1,11 +1,8 @@
1
1
  # Bundler
2
- .bundle
3
- Gemfile.lock
4
- pkg/*
5
-
6
- # Rubinius
7
- *.rbc
2
+ /.bundle
3
+ /Gemfile.lock
4
+ /pkg/*
8
5
 
9
6
  # YARD
10
- .yardoc
11
- yardoc/
7
+ /.yardoc
8
+ /yardoc/
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  inherit_from:
2
- - .rubocop_defaults.yml
2
+ - .rubocop_opinionated.yml
3
3
 
4
4
  AllCops:
5
5
  Exclude:
@@ -10,9 +10,27 @@ AllCops:
10
10
  - 'vendor/**/*'
11
11
  # Exclude artifacts
12
12
  - 'pkg/**/*'
13
+ # Other
14
+ - 'test/benchmarks/**/*'
15
+ - 'test/profilers/**/*'
16
+
17
+ # I often use @_variable to avoid clashing.
18
+ Naming/MemoizedInstanceVariableName:
19
+ Enabled: false
13
20
 
14
21
  Style/ClassAndModuleChildren:
15
22
  Exclude:
16
23
  - 'spec/**/*_spec.rb'
17
24
  - 'test/**/*_test.rb'
18
25
 
26
+ # Dear Rubocop, I don't want to use String#strip_heredoc
27
+ Layout/HeredocIndentation:
28
+ Enabled: false
29
+
30
+ Style/WordArray:
31
+ Enabled: false
32
+ MinSize: 3
33
+
34
+ Style/SymbolArray:
35
+ Enabled: false
36
+ MinSize: 3
@@ -5,9 +5,21 @@ AllCops:
5
5
  # Exclude vendored folders
6
6
  - 'tmp/**/*'
7
7
  - 'vendor/**/*'
8
+ NewCops: enable
8
9
 
9
- Lint/AmbiguousRegexpLiteral:
10
+ # [codesmell]
11
+ Layout/LineLength:
10
12
  Enabled: false
13
+ Exclude:
14
+ - 'spec/**/*_spec.rb'
15
+ - 'test/**/*_test.rb'
16
+ Max: 100
17
+
18
+ Lint/ConstantDefinitionInBlock:
19
+ Exclude:
20
+ - 'Rakefile'
21
+ - 'spec/**/*'
22
+ - 'test/**/*'
11
23
 
12
24
  # [codesmell]
13
25
  Metrics/AbcSize:
@@ -16,26 +28,47 @@ Metrics/AbcSize:
16
28
  - 'spec/**/*_spec.rb'
17
29
  - 'test/**/*_test.rb'
18
30
 
31
+ # [codesmell]
32
+ Metrics/BlockLength:
33
+ Enabled: false
34
+
35
+ # [codesmell]
36
+ Metrics/CyclomaticComplexity:
37
+ Enabled: false
38
+ Exclude:
39
+ - 'spec/**/*_spec.rb'
40
+ - 'test/**/*_test.rb'
41
+
19
42
  # [codesmell]
20
43
  Metrics/ClassLength:
44
+ Enabled: false
21
45
  Exclude:
22
46
  - 'spec/**/*_spec.rb'
23
47
  - 'test/**/*_test.rb'
24
48
 
25
49
  # [codesmell]
26
50
  Metrics/MethodLength:
51
+ Enabled: false
27
52
  Exclude:
28
53
  - 'spec/**/*_spec.rb'
29
54
  - 'test/**/*_test.rb'
30
- Max: 15
55
+ Max: 10
31
56
 
32
57
  # [codesmell]
33
- Metrics/LineLength:
58
+ Metrics/ModuleLength:
34
59
  Enabled: false
35
60
  Exclude:
36
61
  - 'spec/**/*_spec.rb'
37
62
  - 'test/**/*_test.rb'
38
- Max: 100
63
+
64
+ # [codesmell]
65
+ Metrics/ParameterLists:
66
+ Enabled: false
67
+ Max: 5
68
+
69
+ # [codesmell]
70
+ Metrics/PerceivedComplexity:
71
+ Enabled: false
39
72
 
40
73
  # Do not use "and" or "or" in conditionals, but for readability we can use it
41
74
  # to chain executions. Just beware of operator order.
@@ -49,17 +82,23 @@ Style/Documentation:
49
82
 
50
83
  # Double empty lines are useful to separate conceptually different methods
51
84
  # in the same class or module.
52
- Style/EmptyLines:
85
+ Layout/EmptyLines:
53
86
  Enabled: false
54
87
 
55
88
  # In most cases, a space is nice. Sometimes, it's not.
56
89
  # Just be consistent with the rest of the surrounding code.
57
- Style/EmptyLinesAroundClassBody:
90
+ Layout/EmptyLinesAroundClassBody:
58
91
  Enabled: false
59
92
 
60
93
  # In most cases, a space is nice. Sometimes, it's not.
61
94
  # Just be consistent with the rest of the surrounding code.
62
- Style/EmptyLinesAroundModuleBody:
95
+ Layout/EmptyLinesAroundModuleBody:
96
+ Enabled: false
97
+
98
+ # This is quite buggy, as it doesn't recognize double lines.
99
+ # Double empty lines are useful to separate conceptually different methods
100
+ # in the same class or module.
101
+ Layout/EmptyLineBetweenDefs:
63
102
  Enabled: false
64
103
 
65
104
  # I personally don't care about the format style.
@@ -68,38 +107,28 @@ Style/EmptyLinesAroundModuleBody:
68
107
  Style/FormatString:
69
108
  Enabled: false
70
109
 
71
- # Prefer the latest Hash syntax
72
- Style/HashSyntax:
73
- Exclude:
74
- # But Rakefiles generally have some definition like
75
- # :default => :test
76
- # that looks nicer with the old rocket syntax.
77
- - 'Rakefile'
78
-
79
- # Array indentation should be considered like MultilineMethodCallIndentation indentation
80
- # and use 4 spaces instead of 2.
81
- Style/IndentArray:
82
- IndentationWidth: 4
83
-
84
- # Hash indentation should be considered like MultilineMethodCallIndentation indentation
85
- # and use 4 spaces instead of 2.
86
- Style/IndentHash:
87
- IndentationWidth: 4
88
-
89
- # Multi-line differs from standard indentation, they are indented twice.
90
- Style/MultilineMethodCallIndentation:
91
- EnforcedStyle: indented
92
- IndentationWidth: 4
110
+ # Annotated tokens (like %<foo>s) are a good thing, but in most cases we don't need them.
111
+ # %s is a simpler and straightforward version that works in almost all cases. So don't complain.
112
+ Style/FormatStringToken:
113
+ Enabled: false
93
114
 
94
115
  # unless is not always cool.
95
116
  Style/NegatedIf:
96
117
  Enabled: false
97
118
 
119
+ # For years, %w() has been the de-facto standard. A lot of libraries are using ().
120
+ # Switching to [] would be a nightmare.
121
+ Style/PercentLiteralDelimiters:
122
+ Enabled: false
123
+
98
124
  # There are cases were the inline rescue is ok. We can either downgrade the severity,
99
125
  # or rely on the developer judgement on a case-by-case basis.
100
126
  Style/RescueModifier:
101
127
  Enabled: false
102
128
 
129
+ Style/SymbolArray:
130
+ EnforcedStyle: brackets
131
+
103
132
  # Sorry, but using trailing spaces helps readability.
104
133
  #
105
134
  # %w( foo bar )
@@ -108,7 +137,7 @@ Style/RescueModifier:
108
137
  #
109
138
  # %w( foo bar )
110
139
  #
111
- Style/SpaceInsidePercentLiteralDelimiters:
140
+ Layout/SpaceInsidePercentLiteralDelimiters:
112
141
  Enabled: false
113
142
 
114
143
  # Hate It or Love It, I prefer double quotes as this is more consistent
@@ -118,7 +147,9 @@ Style/StringLiterals:
118
147
 
119
148
  # It's nice to be consistent. The trailing comma also allows easy reordering,
120
149
  # and doesn't cause a diff in Git when you add a line to the bottom.
121
- Style/TrailingCommaInLiteral:
150
+ Style/TrailingCommaInArrayLiteral:
151
+ EnforcedStyleForMultiline: consistent_comma
152
+ Style/TrailingCommaInHashLiteral:
122
153
  EnforcedStyleForMultiline: consistent_comma
123
154
 
124
155
  Style/TrivialAccessors:
@@ -130,6 +161,3 @@ Style/TrivialAccessors:
130
161
  # end
131
162
  #
132
163
  IgnoreClassMethods: true
133
-
134
- Style/WordArray:
135
- Enabled: false