public_suffix 3.1.1 → 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 +150 -52
- data/LICENSE.txt +1 -1
- data/README.md +37 -15
- data/SECURITY.md +25 -0
- data/data/list.txt +4775 -2310
- data/lib/public_suffix/domain.rb +1 -1
- data/lib/public_suffix/errors.rb +1 -1
- data/lib/public_suffix/list.rb +6 -6
- data/lib/public_suffix/rule.rb +17 -17
- data/lib/public_suffix/version.rb +5 -4
- data/lib/public_suffix.rb +12 -14
- metadata +16 -104
- data/.gitignore +0 -11
- data/.rubocop.yml +0 -36
- data/.rubocop_defaults.yml +0 -179
- data/.ruby-gemset +0 -1
- data/.travis.yml +0 -31
- data/Gemfile +0 -12
- data/Rakefile +0 -51
- data/bin/console +0 -15
- data/public_suffix.gemspec +0 -25
- data/test/.empty +0 -2
- data/test/acceptance_test.rb +0 -129
- 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
|
|
@@ -48,7 +48,7 @@ module PublicSuffix
|
|
48
48
|
#
|
49
49
|
# @return [PublicSuffix::List]
|
50
50
|
def self.default(**options)
|
51
|
-
@default ||= parse(File.read(DEFAULT_LIST_PATH), options)
|
51
|
+
@default ||= parse(File.read(DEFAULT_LIST_PATH), **options)
|
52
52
|
end
|
53
53
|
|
54
54
|
# Sets the default rule list to +value+.
|
@@ -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
|
@@ -216,7 +216,7 @@ module PublicSuffix
|
|
216
216
|
|
217
217
|
rules
|
218
218
|
end
|
219
|
-
private :select
|
219
|
+
private :select
|
220
220
|
|
221
221
|
# Gets the default rule.
|
222
222
|
#
|
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
|
|
@@ -22,7 +22,7 @@ module PublicSuffix
|
|
22
22
|
module Rule
|
23
23
|
|
24
24
|
# @api internal
|
25
|
-
Entry = Struct.new(:type, :length, :private)
|
25
|
+
Entry = Struct.new(:type, :length, :private) # rubocop:disable Lint/StructNewOverride
|
26
26
|
|
27
27
|
# = Abstract rule class
|
28
28
|
#
|
@@ -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,57 +1,15 @@
|
|
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:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rake
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: mocha
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: yard
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
11
|
+
date: 2023-11-17 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
55
13
|
description: PublicSuffix can parse and decompose a domain name into top level domain,
|
56
14
|
domain and subdomains.
|
57
15
|
email:
|
@@ -61,19 +19,12 @@ extensions: []
|
|
61
19
|
extra_rdoc_files:
|
62
20
|
- LICENSE.txt
|
63
21
|
files:
|
64
|
-
- ".gitignore"
|
65
|
-
- ".rubocop.yml"
|
66
|
-
- ".rubocop_defaults.yml"
|
67
|
-
- ".ruby-gemset"
|
68
|
-
- ".travis.yml"
|
69
22
|
- ".yardopts"
|
70
23
|
- 2.0-Upgrade.md
|
71
24
|
- CHANGELOG.md
|
72
|
-
- Gemfile
|
73
25
|
- LICENSE.txt
|
74
26
|
- README.md
|
75
|
-
-
|
76
|
-
- bin/console
|
27
|
+
- SECURITY.md
|
77
28
|
- data/list.txt
|
78
29
|
- lib/public_suffix.rb
|
79
30
|
- lib/public_suffix/domain.rb
|
@@ -81,34 +32,16 @@ files:
|
|
81
32
|
- lib/public_suffix/list.rb
|
82
33
|
- lib/public_suffix/rule.rb
|
83
34
|
- lib/public_suffix/version.rb
|
84
|
-
- public_suffix.gemspec
|
85
|
-
- test/.empty
|
86
|
-
- test/acceptance_test.rb
|
87
|
-
- test/benchmarks/bm_find.rb
|
88
|
-
- test/benchmarks/bm_find_all.rb
|
89
|
-
- test/benchmarks/bm_names.rb
|
90
|
-
- test/benchmarks/bm_select.rb
|
91
|
-
- test/benchmarks/bm_select_incremental.rb
|
92
|
-
- test/benchmarks/bm_valid.rb
|
93
|
-
- test/profilers/domain_profiler.rb
|
94
|
-
- test/profilers/find_profiler.rb
|
95
|
-
- test/profilers/find_profiler_jp.rb
|
96
|
-
- test/profilers/initialization_profiler.rb
|
97
|
-
- test/profilers/list_profsize.rb
|
98
|
-
- test/profilers/object_binsize.rb
|
99
|
-
- test/psl_test.rb
|
100
|
-
- test/test_helper.rb
|
101
|
-
- test/tests.txt
|
102
|
-
- test/unit/domain_test.rb
|
103
|
-
- test/unit/errors_test.rb
|
104
|
-
- test/unit/list_test.rb
|
105
|
-
- test/unit/public_suffix_test.rb
|
106
|
-
- test/unit/rule_test.rb
|
107
35
|
homepage: https://simonecarletti.com/code/publicsuffix-ruby
|
108
36
|
licenses:
|
109
37
|
- MIT
|
110
|
-
metadata:
|
111
|
-
|
38
|
+
metadata:
|
39
|
+
bug_tracker_uri: https://github.com/weppos/publicsuffix-ruby/issues
|
40
|
+
changelog_uri: https://github.com/weppos/publicsuffix-ruby/blob/master/CHANGELOG.md
|
41
|
+
documentation_uri: https://rubydoc.info/gems/public_suffix/5.0.4
|
42
|
+
homepage_uri: https://simonecarletti.com/code/publicsuffix-ruby
|
43
|
+
source_code_uri: https://github.com/weppos/publicsuffix-ruby/tree/v5.0.4
|
44
|
+
post_install_message:
|
112
45
|
rdoc_options: []
|
113
46
|
require_paths:
|
114
47
|
- lib
|
@@ -116,36 +49,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
49
|
requirements:
|
117
50
|
- - ">="
|
118
51
|
- !ruby/object:Gem::Version
|
119
|
-
version: '2.
|
52
|
+
version: '2.6'
|
120
53
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
54
|
requirements:
|
122
55
|
- - ">="
|
123
56
|
- !ruby/object:Gem::Version
|
124
57
|
version: '0'
|
125
58
|
requirements: []
|
126
|
-
rubygems_version: 3.
|
127
|
-
signing_key:
|
59
|
+
rubygems_version: 3.4.10
|
60
|
+
signing_key:
|
128
61
|
specification_version: 4
|
129
62
|
summary: Domain name parser based on the Public Suffix List.
|
130
|
-
test_files:
|
131
|
-
- test/acceptance_test.rb
|
132
|
-
- test/benchmarks/bm_find.rb
|
133
|
-
- test/benchmarks/bm_find_all.rb
|
134
|
-
- test/benchmarks/bm_names.rb
|
135
|
-
- test/benchmarks/bm_select.rb
|
136
|
-
- test/benchmarks/bm_select_incremental.rb
|
137
|
-
- test/benchmarks/bm_valid.rb
|
138
|
-
- test/profilers/domain_profiler.rb
|
139
|
-
- test/profilers/find_profiler.rb
|
140
|
-
- test/profilers/find_profiler_jp.rb
|
141
|
-
- test/profilers/initialization_profiler.rb
|
142
|
-
- test/profilers/list_profsize.rb
|
143
|
-
- test/profilers/object_binsize.rb
|
144
|
-
- test/psl_test.rb
|
145
|
-
- test/test_helper.rb
|
146
|
-
- test/tests.txt
|
147
|
-
- test/unit/domain_test.rb
|
148
|
-
- test/unit/errors_test.rb
|
149
|
-
- test/unit/list_test.rb
|
150
|
-
- test/unit/public_suffix_test.rb
|
151
|
-
- test/unit/rule_test.rb
|
63
|
+
test_files: []
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
inherit_from:
|
2
|
-
- .rubocop_defaults.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/IndentHeredoc:
|
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_defaults.yml
DELETED
@@ -1,179 +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
|
-
|
9
|
-
# [codesmell]
|
10
|
-
Metrics/AbcSize:
|
11
|
-
Enabled: false
|
12
|
-
Exclude:
|
13
|
-
- 'spec/**/*_spec.rb'
|
14
|
-
- 'test/**/*_test.rb'
|
15
|
-
|
16
|
-
# [codesmell]
|
17
|
-
Metrics/BlockLength:
|
18
|
-
Enabled: false
|
19
|
-
|
20
|
-
# [codesmell]
|
21
|
-
Metrics/CyclomaticComplexity:
|
22
|
-
Enabled: false
|
23
|
-
Exclude:
|
24
|
-
- 'spec/**/*_spec.rb'
|
25
|
-
- 'test/**/*_test.rb'
|
26
|
-
|
27
|
-
# [codesmell]
|
28
|
-
Metrics/ClassLength:
|
29
|
-
Enabled: false
|
30
|
-
Exclude:
|
31
|
-
- 'spec/**/*_spec.rb'
|
32
|
-
- 'test/**/*_test.rb'
|
33
|
-
|
34
|
-
# [codesmell]
|
35
|
-
Metrics/LineLength:
|
36
|
-
Enabled: false
|
37
|
-
Exclude:
|
38
|
-
- 'spec/**/*_spec.rb'
|
39
|
-
- 'test/**/*_test.rb'
|
40
|
-
Max: 100
|
41
|
-
|
42
|
-
# [codesmell]
|
43
|
-
Metrics/MethodLength:
|
44
|
-
Enabled: false
|
45
|
-
Exclude:
|
46
|
-
- 'spec/**/*_spec.rb'
|
47
|
-
- 'test/**/*_test.rb'
|
48
|
-
Max: 10
|
49
|
-
|
50
|
-
# [codesmell]
|
51
|
-
Metrics/ModuleLength:
|
52
|
-
Enabled: false
|
53
|
-
Exclude:
|
54
|
-
- 'spec/**/*_spec.rb'
|
55
|
-
- 'test/**/*_test.rb'
|
56
|
-
|
57
|
-
# [codesmell]
|
58
|
-
Metrics/ParameterLists:
|
59
|
-
Enabled: false
|
60
|
-
Max: 5
|
61
|
-
|
62
|
-
# [codesmell]
|
63
|
-
Metrics/PerceivedComplexity:
|
64
|
-
Enabled: false
|
65
|
-
|
66
|
-
# Do not use "and" or "or" in conditionals, but for readability we can use it
|
67
|
-
# to chain executions. Just beware of operator order.
|
68
|
-
Style/AndOr:
|
69
|
-
EnforcedStyle: conditionals
|
70
|
-
|
71
|
-
Style/Documentation:
|
72
|
-
Exclude:
|
73
|
-
- 'spec/**/*'
|
74
|
-
- 'test/**/*'
|
75
|
-
|
76
|
-
# Double empty lines are useful to separate conceptually different methods
|
77
|
-
# in the same class or module.
|
78
|
-
Layout/EmptyLines:
|
79
|
-
Enabled: false
|
80
|
-
|
81
|
-
# In most cases, a space is nice. Sometimes, it's not.
|
82
|
-
# Just be consistent with the rest of the surrounding code.
|
83
|
-
Layout/EmptyLinesAroundClassBody:
|
84
|
-
Enabled: false
|
85
|
-
|
86
|
-
# In most cases, a space is nice. Sometimes, it's not.
|
87
|
-
# Just be consistent with the rest of the surrounding code.
|
88
|
-
Layout/EmptyLinesAroundModuleBody:
|
89
|
-
Enabled: false
|
90
|
-
|
91
|
-
# This is quite buggy, as it doesn't recognize double lines.
|
92
|
-
# Double empty lines are useful to separate conceptually different methods
|
93
|
-
# in the same class or module.
|
94
|
-
Layout/EmptyLineBetweenDefs:
|
95
|
-
Enabled: false
|
96
|
-
|
97
|
-
# I personally don't care about the format style.
|
98
|
-
# In most cases I like to use %, but not at the point I want to enforce it
|
99
|
-
# as a convention in the entire code.
|
100
|
-
Style/FormatString:
|
101
|
-
Enabled: false
|
102
|
-
|
103
|
-
# Annotated tokens (like %<foo>s) are a good thing, but in most cases we don't need them.
|
104
|
-
# %s is a simpler and straightforward version that works in almost all cases. So don't complain.
|
105
|
-
Style/FormatStringToken:
|
106
|
-
Enabled: false
|
107
|
-
|
108
|
-
# Prefer the latest Hash syntax
|
109
|
-
Style/HashSyntax:
|
110
|
-
Exclude:
|
111
|
-
# But Rakefiles generally have some definition like
|
112
|
-
# :default => :test
|
113
|
-
# that looks nicer with the old rocket syntax.
|
114
|
-
- 'Rakefile'
|
115
|
-
|
116
|
-
Style/RescueStandardError:
|
117
|
-
Enabled: false
|
118
|
-
|
119
|
-
# Array indentation should be considered like MultilineMethodCallIndentation indentation
|
120
|
-
# and use 4 spaces instead of 2.
|
121
|
-
Layout/IndentFirstArrayElement:
|
122
|
-
IndentationWidth: 4
|
123
|
-
|
124
|
-
# Hash indentation should be considered like MultilineMethodCallIndentation indentation
|
125
|
-
# and use 4 spaces instead of 2.
|
126
|
-
Layout/IndentFirstHashElement:
|
127
|
-
IndentationWidth: 4
|
128
|
-
|
129
|
-
# Multi-line differs from standard indentation, they are indented twice.
|
130
|
-
Layout/MultilineMethodCallIndentation:
|
131
|
-
EnforcedStyle: indented
|
132
|
-
IndentationWidth: 4
|
133
|
-
|
134
|
-
# unless is not always cool.
|
135
|
-
Style/NegatedIf:
|
136
|
-
Enabled: false
|
137
|
-
|
138
|
-
# For years, %w() has been the de-facto standard. A lot of libraries are using ().
|
139
|
-
# Switching to [] would be a nightmare.
|
140
|
-
Style/PercentLiteralDelimiters:
|
141
|
-
Enabled: false
|
142
|
-
|
143
|
-
# There are cases were the inline rescue is ok. We can either downgrade the severity,
|
144
|
-
# or rely on the developer judgement on a case-by-case basis.
|
145
|
-
Style/RescueModifier:
|
146
|
-
Enabled: false
|
147
|
-
|
148
|
-
# Sorry, but using trailing spaces helps readability.
|
149
|
-
#
|
150
|
-
# %w( foo bar )
|
151
|
-
#
|
152
|
-
# looks better to me than
|
153
|
-
#
|
154
|
-
# %w( foo bar )
|
155
|
-
#
|
156
|
-
Layout/SpaceInsidePercentLiteralDelimiters:
|
157
|
-
Enabled: false
|
158
|
-
|
159
|
-
# Hate It or Love It, I prefer double quotes as this is more consistent
|
160
|
-
# with several other programming languages and the output of puts and inspect.
|
161
|
-
Style/StringLiterals:
|
162
|
-
EnforcedStyle: double_quotes
|
163
|
-
|
164
|
-
# It's nice to be consistent. The trailing comma also allows easy reordering,
|
165
|
-
# and doesn't cause a diff in Git when you add a line to the bottom.
|
166
|
-
Style/TrailingCommaInArrayLiteral:
|
167
|
-
EnforcedStyleForMultiline: consistent_comma
|
168
|
-
Style/TrailingCommaInHashLiteral:
|
169
|
-
EnforcedStyleForMultiline: consistent_comma
|
170
|
-
|
171
|
-
Style/TrivialAccessors:
|
172
|
-
# IgnoreClassMethods because I want to be able to define class-level accessors
|
173
|
-
# that sets an instance variable on the metaclass, such as:
|
174
|
-
#
|
175
|
-
# def self.default=(value)
|
176
|
-
# @default = value
|
177
|
-
# end
|
178
|
-
#
|
179
|
-
IgnoreClassMethods: true
|
data/.ruby-gemset
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
-global
|