goodcheck 3.0.0 → 3.0.1
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/goodcheck/buffer.rb +2 -7
- data/lib/goodcheck/import_loader.rb +35 -9
- data/lib/goodcheck/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ccb42f8ae06c1c3f78fc6361de1e3074a3ea1ebf8ec1fc6216d4f076531e4fe
|
4
|
+
data.tar.gz: f46bde84176b92dffa679e50536221f52d1efe54a2bf6a583533a14fd8404bfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 717e2a137f03c9b436e7ef9f88ad6c5f9d8ec33989a929cb69e327aabf09e83fdfe1565607c669928d7e3b3306cde434ab59c64ff741840c840263980856d8cd
|
7
|
+
data.tar.gz: c7041cb4c9d9c4b1926776a98a8c55ec59496169fdeedd8ac4277c37950d579cdb6cfa50cc9dd6215c31baa2c85cd3b9a513495ec2f82dc705696a05ef13af4b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -42,7 +42,7 @@ To release a new version, follows the steps below:
|
|
42
42
|
3. Update the documentation via `bundle exec rake docs:update_version`.
|
43
43
|
4. Commit the above changes like `git commit -m 'Version 1.2.3'`.
|
44
44
|
5. Run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
45
|
-
6. Publish the updated documentation like `GIT_USER=some_user USE_SSH=true bundle exec rake docs:publish`.
|
45
|
+
6. Publish the updated documentation like `GIT_USER=some_user [USE_SSH=true] bundle exec rake docs:publish`.
|
46
46
|
|
47
47
|
## Contributing
|
48
48
|
|
data/lib/goodcheck/buffer.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
module Goodcheck
|
2
2
|
class Buffer
|
3
|
-
attr_reader :path
|
4
|
-
attr_reader :content
|
5
|
-
|
6
3
|
DISABLE_LINE_PATTERNS = [
|
7
4
|
/\/\/ goodcheck-disable-line$/, #JS, Java, C, ...
|
8
5
|
/# goodcheck-disable-line$/, # Ruby, Python, PHP, ...
|
@@ -25,10 +22,8 @@ module Goodcheck
|
|
25
22
|
/' goodcheck-disable-next-line$/, # VB
|
26
23
|
].freeze
|
27
24
|
|
28
|
-
|
29
|
-
|
30
|
-
attr_accessor :DISABLE_NEXT_LINE_PATTERNS
|
31
|
-
end
|
25
|
+
attr_reader :path
|
26
|
+
attr_reader :content
|
32
27
|
|
33
28
|
def initialize(path:, content:)
|
34
29
|
@path = path
|
@@ -18,6 +18,19 @@ module Goodcheck
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
class HTTPGetError < Error
|
22
|
+
attr_reader :response
|
23
|
+
|
24
|
+
def initialize(res)
|
25
|
+
super("HTTP GET #{res.uri} => #{res.code} #{res.message}")
|
26
|
+
@response = res
|
27
|
+
end
|
28
|
+
|
29
|
+
def error_response?
|
30
|
+
response.is_a?(Net::HTTPClientError) || response.is_a?(Net::HTTPServerError)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
21
34
|
attr_reader :cache_path
|
22
35
|
attr_reader :expires_in
|
23
36
|
attr_reader :force_download
|
@@ -122,15 +135,28 @@ module Goodcheck
|
|
122
135
|
def http_get(uri, limit = 10)
|
123
136
|
raise ArgumentError, "Too many HTTP redirects" if limit == 0
|
124
137
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
res.
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
138
|
+
max_retry_count = 2
|
139
|
+
retry_count = 0
|
140
|
+
begin
|
141
|
+
res = Net::HTTP.get_response URI(uri)
|
142
|
+
case res
|
143
|
+
when Net::HTTPSuccess
|
144
|
+
res.body
|
145
|
+
when Net::HTTPRedirection
|
146
|
+
location = res['Location']
|
147
|
+
http_get location, limit - 1
|
148
|
+
else
|
149
|
+
raise HTTPGetError.new(res)
|
150
|
+
end
|
151
|
+
rescue HTTPGetError => exn
|
152
|
+
if retry_count < max_retry_count && exn.error_response?
|
153
|
+
retry_count += 1
|
154
|
+
Goodcheck.logger.info "#{retry_count} retry HTTP GET #{exn.response.uri} due to '#{exn.response.code} #{exn.response.message}'..."
|
155
|
+
sleep 1
|
156
|
+
retry
|
157
|
+
else
|
158
|
+
raise
|
159
|
+
end
|
134
160
|
end
|
135
161
|
end
|
136
162
|
|
data/lib/goodcheck/version.rb
CHANGED