public_suffix 4.0.6 → 5.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +45 -0
- data/LICENSE.txt +1 -1
- data/README.md +20 -3
- data/SECURITY.md +2 -81
- data/data/list.txt +4262 -2211
- data/lib/public_suffix/domain.rb +1 -1
- data/lib/public_suffix/errors.rb +1 -1
- data/lib/public_suffix/list.rb +4 -4
- data/lib/public_suffix/rule.rb +16 -16
- data/lib/public_suffix/version.rb +5 -4
- data/lib/public_suffix.rb +12 -14
- metadata +10 -64
- data/.github/FUNDING.yml +0 -12
- data/.github/workflows/tests.yml +0 -36
- data/.gitignore +0 -8
- data/.rubocop.yml +0 -36
- data/.rubocop_opinionated.yml +0 -157
- data/.travis.yml +0 -23
- data/Gemfile +0 -15
- data/Rakefile +0 -51
- data/bin/console +0 -15
- data/codecov.yml +0 -12
- data/public_suffix.gemspec +0 -29
- data/test/.empty +0 -2
- data/test/acceptance_test.rb +0 -131
- data/test/benchmarks/bm_find.rb +0 -66
- data/test/benchmarks/bm_find_all.rb +0 -102
- data/test/benchmarks/bm_names.rb +0 -91
- data/test/benchmarks/bm_select.rb +0 -26
- data/test/benchmarks/bm_select_incremental.rb +0 -25
- data/test/benchmarks/bm_valid.rb +0 -101
- data/test/profilers/domain_profiler.rb +0 -12
- data/test/profilers/find_profiler.rb +0 -12
- data/test/profilers/find_profiler_jp.rb +0 -12
- data/test/profilers/initialization_profiler.rb +0 -11
- data/test/profilers/list_profsize.rb +0 -11
- data/test/profilers/object_binsize.rb +0 -57
- data/test/psl_test.rb +0 -52
- data/test/test_helper.rb +0 -18
- data/test/tests.txt +0 -98
- data/test/unit/domain_test.rb +0 -106
- data/test/unit/errors_test.rb +0 -25
- data/test/unit/list_test.rb +0 -241
- data/test/unit/public_suffix_test.rb +0 -188
- data/test/unit/rule_test.rb +0 -222
data/lib/public_suffix/domain.rb
CHANGED
data/lib/public_suffix/errors.rb
CHANGED
data/lib/public_suffix/list.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
#
|
5
5
|
# Domain name parser based on the Public Suffix List.
|
6
6
|
#
|
7
|
-
# Copyright (c) 2009-
|
7
|
+
# Copyright (c) 2009-2023 Simone Carletti <weppos@weppos.net>
|
8
8
|
|
9
9
|
module PublicSuffix
|
10
10
|
|
@@ -63,7 +63,7 @@ module PublicSuffix
|
|
63
63
|
#
|
64
64
|
# See http://publicsuffix.org/format/ for more details about input format.
|
65
65
|
#
|
66
|
-
# @param
|
66
|
+
# @param input [#each_line] the list to parse
|
67
67
|
# @param private_domains [Boolean] whether to ignore the private domains section
|
68
68
|
# @return [PublicSuffix::List]
|
69
69
|
def self.parse(input, private_domains: true)
|
@@ -87,7 +87,7 @@ module PublicSuffix
|
|
87
87
|
section = 2
|
88
88
|
|
89
89
|
# skip comments
|
90
|
-
when line.start_with?(comment_token)
|
90
|
+
when line.start_with?(comment_token) # rubocop:disable Lint/DuplicateBranch
|
91
91
|
next
|
92
92
|
|
93
93
|
else
|
@@ -173,7 +173,7 @@ module PublicSuffix
|
|
173
173
|
# @return [PublicSuffix::Rule::*]
|
174
174
|
def find(name, default: default_rule, **options)
|
175
175
|
rule = select(name, **options).inject do |l, r|
|
176
|
-
return r if r.
|
176
|
+
return r if r.instance_of?(Rule::Exception)
|
177
177
|
|
178
178
|
l.length > r.length ? l : r
|
179
179
|
end
|
data/lib/public_suffix/rule.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
#
|
5
5
|
# Domain name parser based on the Public Suffix List.
|
6
6
|
#
|
7
|
-
# Copyright (c) 2009-
|
7
|
+
# Copyright (c) 2009-2023 Simone Carletti <weppos@weppos.net>
|
8
8
|
|
9
9
|
module PublicSuffix
|
10
10
|
|
@@ -125,16 +125,15 @@ module PublicSuffix
|
|
125
125
|
# @param private [Boolean]
|
126
126
|
def initialize(value:, length: nil, private: false)
|
127
127
|
@value = value.to_s
|
128
|
-
@length = length || @value.count(DOT) + 1
|
128
|
+
@length = length || (@value.count(DOT) + 1)
|
129
129
|
@private = private
|
130
130
|
end
|
131
131
|
|
132
132
|
# Checks whether this rule is equal to <tt>other</tt>.
|
133
133
|
#
|
134
|
-
# @param [PublicSuffix::Rule::*]
|
135
|
-
# @return [Boolean]
|
136
|
-
#
|
137
|
-
# and has the same value, false otherwise.
|
134
|
+
# @param other [PublicSuffix::Rule::*] The rule to compare
|
135
|
+
# @return [Boolean] true if this rule and other are instances of the same class
|
136
|
+
# and has the same value, false otherwise.
|
138
137
|
def ==(other)
|
139
138
|
equal?(other) || (self.class == other.class && value == other.value)
|
140
139
|
end
|
@@ -162,7 +161,7 @@ module PublicSuffix
|
|
162
161
|
# @param name [String] the domain name to check
|
163
162
|
# @return [Boolean]
|
164
163
|
def match?(name)
|
165
|
-
#
|
164
|
+
# NOTE: it works because of the assumption there are no
|
166
165
|
# rules like foo.*.com. If the assumption is incorrect,
|
167
166
|
# we need to properly walk the input and skip parts according
|
168
167
|
# to wildcard component.
|
@@ -176,7 +175,7 @@ module PublicSuffix
|
|
176
175
|
end
|
177
176
|
|
178
177
|
# @abstract
|
179
|
-
# @param [
|
178
|
+
# @param domain [#to_s] The domain name to decompose
|
180
179
|
# @return [Array<String, nil>]
|
181
180
|
def decompose(*)
|
182
181
|
raise NotImplementedError
|
@@ -196,7 +195,7 @@ module PublicSuffix
|
|
196
195
|
|
197
196
|
# Decomposes the domain name according to rule properties.
|
198
197
|
#
|
199
|
-
# @param [
|
198
|
+
# @param domain [#to_s] The domain name to decompose
|
200
199
|
# @return [Array<String>] The array with [trd + sld, tld].
|
201
200
|
def decompose(domain)
|
202
201
|
suffix = parts.join('\.')
|
@@ -222,12 +221,13 @@ module PublicSuffix
|
|
222
221
|
# @param content [String] the content of the rule
|
223
222
|
# @param private [Boolean]
|
224
223
|
def self.build(content, private: false)
|
225
|
-
new(value: content.to_s[2
|
224
|
+
new(value: content.to_s[2..], private: private)
|
226
225
|
end
|
227
226
|
|
228
227
|
# Initializes a new rule.
|
229
228
|
#
|
230
229
|
# @param value [String]
|
230
|
+
# @param length [Integer]
|
231
231
|
# @param private [Boolean]
|
232
232
|
def initialize(value:, length: nil, private: false)
|
233
233
|
super(value: value, length: length, private: private)
|
@@ -243,7 +243,7 @@ module PublicSuffix
|
|
243
243
|
|
244
244
|
# Decomposes the domain name according to rule properties.
|
245
245
|
#
|
246
|
-
# @param [
|
246
|
+
# @param domain [#to_s] The domain name to decompose
|
247
247
|
# @return [Array<String>] The array with [trd + sld, tld].
|
248
248
|
def decompose(domain)
|
249
249
|
suffix = ([".*?"] + parts).join('\.')
|
@@ -266,10 +266,10 @@ module PublicSuffix
|
|
266
266
|
|
267
267
|
# Initializes a new rule from the content.
|
268
268
|
#
|
269
|
-
# @param content [
|
269
|
+
# @param content [#to_s] the content of the rule
|
270
270
|
# @param private [Boolean]
|
271
271
|
def self.build(content, private: false)
|
272
|
-
new(value: content.to_s[1
|
272
|
+
new(value: content.to_s[1..], private: private)
|
273
273
|
end
|
274
274
|
|
275
275
|
# Gets the original rule definition.
|
@@ -281,7 +281,7 @@ module PublicSuffix
|
|
281
281
|
|
282
282
|
# Decomposes the domain name according to rule properties.
|
283
283
|
#
|
284
|
-
# @param [
|
284
|
+
# @param domain [#to_s] The domain name to decompose
|
285
285
|
# @return [Array<String>] The array with [trd + sld, tld].
|
286
286
|
def decompose(domain)
|
287
287
|
suffix = parts.join('\.')
|
@@ -299,7 +299,7 @@ module PublicSuffix
|
|
299
299
|
#
|
300
300
|
# @return [Array<String>]
|
301
301
|
def parts
|
302
|
-
@value.split(DOT)[1
|
302
|
+
@value.split(DOT)[1..]
|
303
303
|
end
|
304
304
|
|
305
305
|
end
|
@@ -321,7 +321,7 @@ module PublicSuffix
|
|
321
321
|
# PublicSuffix::Rule.factory("!congresodelalengua3.ar")
|
322
322
|
# # => #<PublicSuffix::Rule::Exception>
|
323
323
|
#
|
324
|
-
# @param [
|
324
|
+
# @param content [#to_s] the content of the rule
|
325
325
|
# @return [PublicSuffix::Rule::*] A rule instance.
|
326
326
|
def self.factory(content, private: false)
|
327
327
|
case content.to_s[0, 1]
|
@@ -1,13 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
4
3
|
# = Public Suffix
|
5
4
|
#
|
6
5
|
# Domain name parser based on the Public Suffix List.
|
7
6
|
#
|
8
|
-
# Copyright (c) 2009-
|
7
|
+
# Copyright (c) 2009-2023 Simone Carletti <weppos@weppos.net>
|
9
8
|
|
10
9
|
module PublicSuffix
|
11
|
-
|
12
|
-
|
10
|
+
|
11
|
+
# @return [String] the current library version
|
12
|
+
VERSION = "5.0.4"
|
13
|
+
|
13
14
|
end
|
data/lib/public_suffix.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
#
|
5
5
|
# Domain name parser based on the Public Suffix List.
|
6
6
|
#
|
7
|
-
# Copyright (c) 2009-
|
7
|
+
# Copyright (c) 2009-2023 Simone Carletti <weppos@weppos.net>
|
8
8
|
|
9
9
|
require_relative "public_suffix/domain"
|
10
10
|
require_relative "public_suffix/version"
|
@@ -57,15 +57,13 @@ module PublicSuffix
|
|
57
57
|
# # => PublicSuffix::DomainInvalid: http://www.google.com is not expected to contain a scheme
|
58
58
|
#
|
59
59
|
#
|
60
|
-
# @param [
|
61
|
-
# @param [PublicSuffix::List]
|
62
|
-
# @param [Boolean]
|
60
|
+
# @param name [#to_s] The domain name or fully qualified domain name to parse.
|
61
|
+
# @param list [PublicSuffix::List] The rule list to search, defaults to the default {PublicSuffix::List}
|
62
|
+
# @param ignore_private [Boolean]
|
63
63
|
# @return [PublicSuffix::Domain]
|
64
64
|
#
|
65
|
-
# @raise [PublicSuffix::DomainInvalid]
|
66
|
-
#
|
67
|
-
# @raise [PublicSuffix::DomainNotAllowed]
|
68
|
-
# If a rule for +domain+ is found, but the rule doesn't allow +domain+.
|
65
|
+
# @raise [PublicSuffix::DomainInvalid] If domain is not a valid domain.
|
66
|
+
# @raise [PublicSuffix::DomainNotAllowed] If a rule for +domain+ is found, but the rule doesn't allow +domain+.
|
69
67
|
def self.parse(name, list: List.default, default_rule: list.default_rule, ignore_private: false)
|
70
68
|
what = normalize(name)
|
71
69
|
raise what if what.is_a?(DomainInvalid)
|
@@ -119,8 +117,8 @@ module PublicSuffix
|
|
119
117
|
# # => false
|
120
118
|
#
|
121
119
|
#
|
122
|
-
# @param [
|
123
|
-
# @param [Boolean]
|
120
|
+
# @param name [#to_s] The domain name or fully qualified domain name to validate.
|
121
|
+
# @param ignore_private [Boolean]
|
124
122
|
# @return [Boolean]
|
125
123
|
def self.valid?(name, list: List.default, default_rule: list.default_rule, ignore_private: false)
|
126
124
|
what = normalize(name)
|
@@ -135,9 +133,9 @@ module PublicSuffix
|
|
135
133
|
#
|
136
134
|
# This method doesn't raise. Instead, it returns nil if the domain is not valid for whatever reason.
|
137
135
|
#
|
138
|
-
# @param [
|
139
|
-
# @param [PublicSuffix::List]
|
140
|
-
# @param [Boolean]
|
136
|
+
# @param name [#to_s] The domain name or fully qualified domain name to parse.
|
137
|
+
# @param list [PublicSuffix::List] The rule list to search, defaults to the default {PublicSuffix::List}
|
138
|
+
# @param ignore_private [Boolean]
|
141
139
|
# @return [String]
|
142
140
|
def self.domain(name, **options)
|
143
141
|
parse(name, **options).domain
|
@@ -171,7 +169,7 @@ module PublicSuffix
|
|
171
169
|
|
172
170
|
return DomainInvalid.new("Name is blank") if name.empty?
|
173
171
|
return DomainInvalid.new("Name starts with a dot") if name.start_with?(DOT)
|
174
|
-
return DomainInvalid.new("%s is not expected to contain a scheme"
|
172
|
+
return DomainInvalid.new(format("%s is not expected to contain a scheme", name)) if name.include?("://")
|
175
173
|
|
176
174
|
name
|
177
175
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: public_suffix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simone Carletti
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: PublicSuffix can parse and decompose a domain name into top level domain,
|
14
14
|
domain and subdomains.
|
@@ -19,22 +19,12 @@ extensions: []
|
|
19
19
|
extra_rdoc_files:
|
20
20
|
- LICENSE.txt
|
21
21
|
files:
|
22
|
-
- ".github/FUNDING.yml"
|
23
|
-
- ".github/workflows/tests.yml"
|
24
|
-
- ".gitignore"
|
25
|
-
- ".rubocop.yml"
|
26
|
-
- ".rubocop_opinionated.yml"
|
27
|
-
- ".travis.yml"
|
28
22
|
- ".yardopts"
|
29
23
|
- 2.0-Upgrade.md
|
30
24
|
- CHANGELOG.md
|
31
|
-
- Gemfile
|
32
25
|
- LICENSE.txt
|
33
26
|
- README.md
|
34
|
-
- Rakefile
|
35
27
|
- SECURITY.md
|
36
|
-
- bin/console
|
37
|
-
- codecov.yml
|
38
28
|
- data/list.txt
|
39
29
|
- lib/public_suffix.rb
|
40
30
|
- lib/public_suffix/domain.rb
|
@@ -42,39 +32,16 @@ files:
|
|
42
32
|
- lib/public_suffix/list.rb
|
43
33
|
- lib/public_suffix/rule.rb
|
44
34
|
- lib/public_suffix/version.rb
|
45
|
-
- public_suffix.gemspec
|
46
|
-
- test/.empty
|
47
|
-
- test/acceptance_test.rb
|
48
|
-
- test/benchmarks/bm_find.rb
|
49
|
-
- test/benchmarks/bm_find_all.rb
|
50
|
-
- test/benchmarks/bm_names.rb
|
51
|
-
- test/benchmarks/bm_select.rb
|
52
|
-
- test/benchmarks/bm_select_incremental.rb
|
53
|
-
- test/benchmarks/bm_valid.rb
|
54
|
-
- test/profilers/domain_profiler.rb
|
55
|
-
- test/profilers/find_profiler.rb
|
56
|
-
- test/profilers/find_profiler_jp.rb
|
57
|
-
- test/profilers/initialization_profiler.rb
|
58
|
-
- test/profilers/list_profsize.rb
|
59
|
-
- test/profilers/object_binsize.rb
|
60
|
-
- test/psl_test.rb
|
61
|
-
- test/test_helper.rb
|
62
|
-
- test/tests.txt
|
63
|
-
- test/unit/domain_test.rb
|
64
|
-
- test/unit/errors_test.rb
|
65
|
-
- test/unit/list_test.rb
|
66
|
-
- test/unit/public_suffix_test.rb
|
67
|
-
- test/unit/rule_test.rb
|
68
35
|
homepage: https://simonecarletti.com/code/publicsuffix-ruby
|
69
36
|
licenses:
|
70
37
|
- MIT
|
71
38
|
metadata:
|
72
39
|
bug_tracker_uri: https://github.com/weppos/publicsuffix-ruby/issues
|
73
40
|
changelog_uri: https://github.com/weppos/publicsuffix-ruby/blob/master/CHANGELOG.md
|
74
|
-
documentation_uri: https://rubydoc.info/gems/public_suffix/
|
41
|
+
documentation_uri: https://rubydoc.info/gems/public_suffix/5.0.4
|
75
42
|
homepage_uri: https://simonecarletti.com/code/publicsuffix-ruby
|
76
|
-
source_code_uri: https://github.com/weppos/publicsuffix-ruby/tree/
|
77
|
-
post_install_message:
|
43
|
+
source_code_uri: https://github.com/weppos/publicsuffix-ruby/tree/v5.0.4
|
44
|
+
post_install_message:
|
78
45
|
rdoc_options: []
|
79
46
|
require_paths:
|
80
47
|
- lib
|
@@ -82,36 +49,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
49
|
requirements:
|
83
50
|
- - ">="
|
84
51
|
- !ruby/object:Gem::Version
|
85
|
-
version: '2.
|
52
|
+
version: '2.6'
|
86
53
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
54
|
requirements:
|
88
55
|
- - ">="
|
89
56
|
- !ruby/object:Gem::Version
|
90
57
|
version: '0'
|
91
58
|
requirements: []
|
92
|
-
rubygems_version: 3.
|
93
|
-
signing_key:
|
59
|
+
rubygems_version: 3.4.10
|
60
|
+
signing_key:
|
94
61
|
specification_version: 4
|
95
62
|
summary: Domain name parser based on the Public Suffix List.
|
96
|
-
test_files:
|
97
|
-
- test/acceptance_test.rb
|
98
|
-
- test/benchmarks/bm_find.rb
|
99
|
-
- test/benchmarks/bm_find_all.rb
|
100
|
-
- test/benchmarks/bm_names.rb
|
101
|
-
- test/benchmarks/bm_select.rb
|
102
|
-
- test/benchmarks/bm_select_incremental.rb
|
103
|
-
- test/benchmarks/bm_valid.rb
|
104
|
-
- test/profilers/domain_profiler.rb
|
105
|
-
- test/profilers/find_profiler.rb
|
106
|
-
- test/profilers/find_profiler_jp.rb
|
107
|
-
- test/profilers/initialization_profiler.rb
|
108
|
-
- test/profilers/list_profsize.rb
|
109
|
-
- test/profilers/object_binsize.rb
|
110
|
-
- test/psl_test.rb
|
111
|
-
- test/test_helper.rb
|
112
|
-
- test/tests.txt
|
113
|
-
- test/unit/domain_test.rb
|
114
|
-
- test/unit/errors_test.rb
|
115
|
-
- test/unit/list_test.rb
|
116
|
-
- test/unit/public_suffix_test.rb
|
117
|
-
- test/unit/rule_test.rb
|
63
|
+
test_files: []
|
data/.github/FUNDING.yml
DELETED
@@ -1,12 +0,0 @@
|
|
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
|
data/.github/workflows/tests.yml
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
name: Tests
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ master ]
|
6
|
-
pull_request:
|
7
|
-
branches: [ master ]
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
|
11
|
-
build:
|
12
|
-
strategy:
|
13
|
-
matrix:
|
14
|
-
ruby-version:
|
15
|
-
# - "2.3"
|
16
|
-
- "2.4"
|
17
|
-
- "2.5"
|
18
|
-
- "2.6"
|
19
|
-
- "2.7"
|
20
|
-
platform: [ubuntu-latest]
|
21
|
-
|
22
|
-
runs-on: ${{ matrix.platform }}
|
23
|
-
steps:
|
24
|
-
|
25
|
-
- uses: actions/checkout@v2
|
26
|
-
|
27
|
-
- name: Set up Ruby
|
28
|
-
uses: ruby/setup-ruby@v1
|
29
|
-
with:
|
30
|
-
ruby-version: ${{ matrix.ruby-version }}
|
31
|
-
|
32
|
-
- name: Install dependencies
|
33
|
-
run: bundle install
|
34
|
-
|
35
|
-
- name: Run tests
|
36
|
-
run: bundle exec rake
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
inherit_from:
|
2
|
-
- .rubocop_opinionated.yml
|
3
|
-
|
4
|
-
AllCops:
|
5
|
-
Exclude:
|
6
|
-
# Exclude .gemspec files because they are generally auto-generated
|
7
|
-
- '*.gemspec'
|
8
|
-
# Exclude vendored folders
|
9
|
-
- 'tmp/**/*'
|
10
|
-
- 'vendor/**/*'
|
11
|
-
# Exclude artifacts
|
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
|
20
|
-
|
21
|
-
Style/ClassAndModuleChildren:
|
22
|
-
Exclude:
|
23
|
-
- 'spec/**/*_spec.rb'
|
24
|
-
- 'test/**/*_test.rb'
|
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
|
data/.rubocop_opinionated.yml
DELETED
@@ -1,157 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
Exclude:
|
3
|
-
# Exclude .gemspec files because they are generally auto-generated
|
4
|
-
- '*.gemspec'
|
5
|
-
# Exclude vendored folders
|
6
|
-
- 'tmp/**/*'
|
7
|
-
- 'vendor/**/*'
|
8
|
-
NewCops: enable
|
9
|
-
|
10
|
-
# [codesmell]
|
11
|
-
Layout/LineLength:
|
12
|
-
Enabled: false
|
13
|
-
Exclude:
|
14
|
-
- 'spec/**/*_spec.rb'
|
15
|
-
- 'test/**/*_test.rb'
|
16
|
-
Max: 100
|
17
|
-
|
18
|
-
# [codesmell]
|
19
|
-
Metrics/AbcSize:
|
20
|
-
Enabled: false
|
21
|
-
Exclude:
|
22
|
-
- 'spec/**/*_spec.rb'
|
23
|
-
- 'test/**/*_test.rb'
|
24
|
-
|
25
|
-
# [codesmell]
|
26
|
-
Metrics/BlockLength:
|
27
|
-
Enabled: false
|
28
|
-
|
29
|
-
# [codesmell]
|
30
|
-
Metrics/CyclomaticComplexity:
|
31
|
-
Enabled: false
|
32
|
-
Exclude:
|
33
|
-
- 'spec/**/*_spec.rb'
|
34
|
-
- 'test/**/*_test.rb'
|
35
|
-
|
36
|
-
# [codesmell]
|
37
|
-
Metrics/ClassLength:
|
38
|
-
Enabled: false
|
39
|
-
Exclude:
|
40
|
-
- 'spec/**/*_spec.rb'
|
41
|
-
- 'test/**/*_test.rb'
|
42
|
-
|
43
|
-
# [codesmell]
|
44
|
-
Metrics/MethodLength:
|
45
|
-
Enabled: false
|
46
|
-
Exclude:
|
47
|
-
- 'spec/**/*_spec.rb'
|
48
|
-
- 'test/**/*_test.rb'
|
49
|
-
Max: 10
|
50
|
-
|
51
|
-
# [codesmell]
|
52
|
-
Metrics/ModuleLength:
|
53
|
-
Enabled: false
|
54
|
-
Exclude:
|
55
|
-
- 'spec/**/*_spec.rb'
|
56
|
-
- 'test/**/*_test.rb'
|
57
|
-
|
58
|
-
# [codesmell]
|
59
|
-
Metrics/ParameterLists:
|
60
|
-
Enabled: false
|
61
|
-
Max: 5
|
62
|
-
|
63
|
-
# [codesmell]
|
64
|
-
Metrics/PerceivedComplexity:
|
65
|
-
Enabled: false
|
66
|
-
|
67
|
-
# Do not use "and" or "or" in conditionals, but for readability we can use it
|
68
|
-
# to chain executions. Just beware of operator order.
|
69
|
-
Style/AndOr:
|
70
|
-
EnforcedStyle: conditionals
|
71
|
-
|
72
|
-
Style/Documentation:
|
73
|
-
Exclude:
|
74
|
-
- 'spec/**/*'
|
75
|
-
- 'test/**/*'
|
76
|
-
|
77
|
-
# Double empty lines are useful to separate conceptually different methods
|
78
|
-
# in the same class or module.
|
79
|
-
Layout/EmptyLines:
|
80
|
-
Enabled: false
|
81
|
-
|
82
|
-
# In most cases, a space is nice. Sometimes, it's not.
|
83
|
-
# Just be consistent with the rest of the surrounding code.
|
84
|
-
Layout/EmptyLinesAroundClassBody:
|
85
|
-
Enabled: false
|
86
|
-
|
87
|
-
# In most cases, a space is nice. Sometimes, it's not.
|
88
|
-
# Just be consistent with the rest of the surrounding code.
|
89
|
-
Layout/EmptyLinesAroundModuleBody:
|
90
|
-
Enabled: false
|
91
|
-
|
92
|
-
# This is quite buggy, as it doesn't recognize double lines.
|
93
|
-
# Double empty lines are useful to separate conceptually different methods
|
94
|
-
# in the same class or module.
|
95
|
-
Layout/EmptyLineBetweenDefs:
|
96
|
-
Enabled: false
|
97
|
-
|
98
|
-
# I personally don't care about the format style.
|
99
|
-
# In most cases I like to use %, but not at the point I want to enforce it
|
100
|
-
# as a convention in the entire code.
|
101
|
-
Style/FormatString:
|
102
|
-
Enabled: false
|
103
|
-
|
104
|
-
# Annotated tokens (like %<foo>s) are a good thing, but in most cases we don't need them.
|
105
|
-
# %s is a simpler and straightforward version that works in almost all cases. So don't complain.
|
106
|
-
Style/FormatStringToken:
|
107
|
-
Enabled: false
|
108
|
-
|
109
|
-
# unless is not always cool.
|
110
|
-
Style/NegatedIf:
|
111
|
-
Enabled: false
|
112
|
-
|
113
|
-
# For years, %w() has been the de-facto standard. A lot of libraries are using ().
|
114
|
-
# Switching to [] would be a nightmare.
|
115
|
-
Style/PercentLiteralDelimiters:
|
116
|
-
Enabled: false
|
117
|
-
|
118
|
-
# There are cases were the inline rescue is ok. We can either downgrade the severity,
|
119
|
-
# or rely on the developer judgement on a case-by-case basis.
|
120
|
-
Style/RescueModifier:
|
121
|
-
Enabled: false
|
122
|
-
|
123
|
-
Style/SymbolArray:
|
124
|
-
EnforcedStyle: brackets
|
125
|
-
|
126
|
-
# Sorry, but using trailing spaces helps readability.
|
127
|
-
#
|
128
|
-
# %w( foo bar )
|
129
|
-
#
|
130
|
-
# looks better to me than
|
131
|
-
#
|
132
|
-
# %w( foo bar )
|
133
|
-
#
|
134
|
-
Layout/SpaceInsidePercentLiteralDelimiters:
|
135
|
-
Enabled: false
|
136
|
-
|
137
|
-
# Hate It or Love It, I prefer double quotes as this is more consistent
|
138
|
-
# with several other programming languages and the output of puts and inspect.
|
139
|
-
Style/StringLiterals:
|
140
|
-
EnforcedStyle: double_quotes
|
141
|
-
|
142
|
-
# It's nice to be consistent. The trailing comma also allows easy reordering,
|
143
|
-
# and doesn't cause a diff in Git when you add a line to the bottom.
|
144
|
-
Style/TrailingCommaInArrayLiteral:
|
145
|
-
EnforcedStyleForMultiline: consistent_comma
|
146
|
-
Style/TrailingCommaInHashLiteral:
|
147
|
-
EnforcedStyleForMultiline: consistent_comma
|
148
|
-
|
149
|
-
Style/TrivialAccessors:
|
150
|
-
# IgnoreClassMethods because I want to be able to define class-level accessors
|
151
|
-
# that sets an instance variable on the metaclass, such as:
|
152
|
-
#
|
153
|
-
# def self.default=(value)
|
154
|
-
# @default = value
|
155
|
-
# end
|
156
|
-
#
|
157
|
-
IgnoreClassMethods: true
|
data/.travis.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
rvm:
|
4
|
-
# - 2.3
|
5
|
-
- 2.4
|
6
|
-
- 2.5
|
7
|
-
- 2.6
|
8
|
-
- 2.7
|
9
|
-
- ruby-head
|
10
|
-
|
11
|
-
env:
|
12
|
-
- COVERAGE=1
|
13
|
-
|
14
|
-
cache:
|
15
|
-
- bundler
|
16
|
-
|
17
|
-
matrix:
|
18
|
-
allow_failures:
|
19
|
-
- rvm: ruby-head
|
20
|
-
|
21
|
-
before_install:
|
22
|
-
- gem update --system
|
23
|
-
- gem install bundler
|
data/Gemfile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gemspec
|
6
|
-
|
7
|
-
gem "rake"
|
8
|
-
|
9
|
-
gem "codecov", require: false
|
10
|
-
gem "memory_profiler", require: false
|
11
|
-
gem "minitest"
|
12
|
-
gem "minitest-reporters"
|
13
|
-
gem "mocha"
|
14
|
-
gem "rubocop", "~>0.90", require: false
|
15
|
-
gem "yard"
|