twitter_retry 0.1.0.beta1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ed93ef8cf4df3d3f46fc904281375a4014720079
4
- data.tar.gz: c79fe3a5e74c11848973023d3fa3d782fadb1df2
2
+ SHA256:
3
+ metadata.gz: 386fb889b0bf74e88dc135e4612050b703d3ec0ae63de0273394b61d952fd419
4
+ data.tar.gz: 270a69da6c1df4752c5620fba98354f25cbd3f2727986fa1119fd179894b2326
5
5
  SHA512:
6
- metadata.gz: adfcd397d9f16c5b410d7a0a39f0e4c645185178b5d2cb93aab77c5ba6d1bb55974508a01c6b78329029a2640b775c6c2aae4437e8d3691fee89f6f1529c9c28
7
- data.tar.gz: 2ec0bc05dc73a9943e0a88165b4b0c7fbb9de6db8740b6077add07147717417e5998c84688c0f30c99383dbea57e4b20525990d3c3bb5f0870bc7d4fcb61b41e
6
+ metadata.gz: 2db280505bc8bb91da339f4c1fa1be506f746a4e3966d97d657fffd7b270ff349063d1b39925adc2e416cfba674a6f58844594030aa619cd71b003746e18416b
7
+ data.tar.gz: 70b473bd211861c596d80366b17222038536383cfc08d7e8b4f36f9a00d336254282aa170d2d2d1249356fbb4e9bac38423f04d1ca22488a3daebf2887f4a938
@@ -0,0 +1,95 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ types:
9
+ - opened
10
+ - synchronize
11
+ - reopened
12
+ schedule:
13
+ - cron: "0 10 * * 5" # JST 19:00 (Fri)
14
+
15
+ env:
16
+ CI: "true"
17
+
18
+ jobs:
19
+ test:
20
+ runs-on: ubuntu-latest
21
+
22
+ container: ${{ matrix.ruby }}
23
+
24
+ strategy:
25
+ fail-fast: false
26
+
27
+ matrix:
28
+ ruby:
29
+ - ruby:2.2
30
+ - ruby:2.3
31
+ - ruby:2.4
32
+ - ruby:2.5
33
+ - ruby:2.6
34
+ - ruby:2.7
35
+ - ruby:3.0
36
+ - rubylang/ruby:master-nightly-bionic
37
+ include:
38
+ - ruby: rubylang/ruby:master-nightly-bionic
39
+ allow_failures: "true"
40
+
41
+ steps:
42
+ - uses: actions/checkout@v2
43
+
44
+
45
+ - name: Cache vendor/bundle
46
+ uses: actions/cache@v1
47
+ id: cache_gem
48
+ with:
49
+ path: vendor/bundle
50
+ key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ github.sha }}
51
+ restore-keys: |
52
+ v1-gem-${{ runner.os }}-${{ matrix.ruby }}-
53
+ continue-on-error: ${{ matrix.allow_failures == 'true' }}
54
+
55
+ - name: bundle update
56
+ run: |
57
+ set -xe
58
+ bundle config path vendor/bundle
59
+ bundle update --jobs $(nproc) --retry 3
60
+ continue-on-error: ${{ matrix.allow_failures == 'true' }}
61
+
62
+ - name: Run test
63
+ run: |
64
+ set -xe
65
+ bundle exec rspec
66
+ continue-on-error: ${{ matrix.allow_failures == 'true' }}
67
+
68
+ - name: Slack Notification (not success)
69
+ uses: lazy-actions/slatify@master
70
+ if: "! success()"
71
+ continue-on-error: true
72
+ with:
73
+ job_name: ${{ format('*build* ({0})', matrix.ruby) }}
74
+ type: ${{ job.status }}
75
+ icon_emoji: ":octocat:"
76
+ url: ${{ secrets.SLACK_WEBHOOK }}
77
+ token: ${{ secrets.GITHUB_TOKEN }}
78
+
79
+ notify:
80
+ needs:
81
+ - test
82
+
83
+ runs-on: ubuntu-latest
84
+
85
+ steps:
86
+ - name: Slack Notification (success)
87
+ uses: lazy-actions/slatify@master
88
+ if: always()
89
+ continue-on-error: true
90
+ with:
91
+ job_name: '*build*'
92
+ type: ${{ job.status }}
93
+ icon_emoji: ":octocat:"
94
+ url: ${{ secrets.SLACK_WEBHOOK }}
95
+ token: ${{ secrets.GITHUB_TOKEN }}
data/CHANGELOG.md ADDED
@@ -0,0 +1,25 @@
1
+ ## Unreleased
2
+ [full changelog](https://github.com/sue445/twitter_retry/compare/v0.2.2...master)
3
+
4
+ ## v0.2.2
5
+ [full changelog](https://github.com/sue445/twitter_retry/compare/v0.2.1...v0.2.2)
6
+
7
+ * Enable MFA requirement for gem releasing
8
+ * https://github.com/sue445/twitter_retry/pull/31
9
+
10
+ ## v0.2.1
11
+ [full changelog](https://github.com/sue445/twitter_retry/compare/v0.2.0...v0.2.1)
12
+
13
+ * Remove activesupport from dependency
14
+ * https://github.com/sue445/twitter_retry/pull/30
15
+
16
+ ## v0.2.0
17
+ [full changelog](https://github.com/sue445/twitter_retry/compare/v0.1.0...v0.2.0)
18
+
19
+ * Support regexp pattern on `retryable_errors?` and `ignorable_errors?`
20
+ * https://github.com/sue445/twitter_retry/pull/9
21
+ * Support: check only error class
22
+ * https://github.com/sue445/twitter_retry/pull/11
23
+
24
+ ## v0.1.0
25
+ * first release
data/Gemfile CHANGED
@@ -2,3 +2,13 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in twitter_retry.gemspec
4
4
  gemspec
5
+
6
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.2")
7
+ # NOTE: activesupport 5.x supports only ruby 2.2.2+
8
+ gem "activesupport", "< 5.0.0"
9
+ end
10
+
11
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.5.0")
12
+ # NOTE: unparser v0.3.0+ requires Ruby 2.5+
13
+ gem "unparser", "< 0.3.0"
14
+ end
data/README.md CHANGED
@@ -2,10 +2,13 @@
2
2
 
3
3
  Twitter api awesome handling with retry
4
4
 
5
- [![Build Status](https://travis-ci.org/sue445/twitter_retry.svg?branch=master)](https://travis-ci.org/sue445/twitter_retry)
5
+ [![Gem Version](https://badge.fury.io/rb/twitter_retry.svg)](http://badge.fury.io/rb/twitter_retry)
6
+ [![Build Status](https://github.com/sue445/twitter_retry/workflows/test/badge.svg?branch=master)](https://github.com/sue445/twitter_retry/actions?query=workflow%3Atest)
6
7
  [![Code Climate](https://codeclimate.com/github/sue445/twitter_retry/badges/gpa.svg)](https://codeclimate.com/github/sue445/twitter_retry)
7
8
  [![Coverage Status](https://coveralls.io/repos/sue445/twitter_retry/badge.svg?branch=master&service=github)](https://coveralls.io/github/sue445/twitter_retry?branch=master)
8
- [![Dependency Status](https://gemnasium.com/sue445/twitter_retry.svg)](https://gemnasium.com/sue445/twitter_retry)
9
+
10
+ ## Requirements
11
+ * Ruby 2.1+
9
12
 
10
13
  ## Installation
11
14
 
@@ -52,9 +55,17 @@ TwitterRetry.configure do |config|
52
55
  config.max_retry_count = 3
53
56
  config.retryable_errors << [Twitter::Error, "some error message"]
54
57
  config.ignorable_errors << [Twitter::Error, "some error message"]
58
+
59
+ # Check whether error message matched with regexp
60
+ config.retryable_errors << [Twitter::Error::ServiceUnavailable, /something/]
61
+
62
+ # Check whether only error class matches (error message can be anything)
63
+ config.ignorable_errors << [Twitter::Error::ServiceUnavailable]
55
64
  end
56
65
  ```
57
66
 
67
+ See [TwitterRetry::Config](lib/twitter_retry/config.rb)
68
+
58
69
  ## Development
59
70
 
60
71
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,6 +1,4 @@
1
1
  module TwitterRetry
2
- require "active_support/configurable"
3
-
4
2
  DEFAULT_RETRYABLE_ERRORS = [
5
3
  [Twitter::Error::ServiceUnavailable, "Over capacity"],
6
4
  [Twitter::Error::InternalServerError, "Internal error"],
@@ -14,16 +12,27 @@ module TwitterRetry
14
12
  ]
15
13
 
16
14
  class Config
17
- include ActiveSupport::Configurable
15
+ # @!attribute max_retry_count
16
+ # @return [Integer]
17
+ attr_accessor :max_retry_count
18
+
19
+ # @!attribute sleep_second
20
+ # @return [Integer]
21
+ attr_accessor :sleep_second
22
+
23
+ # @!attribute retryable_errors
24
+ # @return [Array<String>]
25
+ attr_accessor :retryable_errors
18
26
 
19
- config_accessor :max_retry_count, :sleep_second
20
- config_accessor :retryable_errors, :ignorable_errors
27
+ # @!attribute ignorable_errors
28
+ # @return [Array<String>]
29
+ attr_accessor :ignorable_errors
21
30
 
22
- configure do |config|
23
- config.max_retry_count = 3
24
- config.sleep_second = 1
25
- config.retryable_errors = DEFAULT_RETRYABLE_ERRORS
26
- config.ignorable_errors = DEFAULT_IGNORABLE_ERRORS
31
+ def initialize
32
+ @max_retry_count = 3
33
+ @sleep_second = 1
34
+ @retryable_errors = DEFAULT_RETRYABLE_ERRORS
35
+ @ignorable_errors = DEFAULT_IGNORABLE_ERRORS
27
36
  end
28
37
  end
29
38
  end
@@ -30,17 +30,13 @@ module TwitterRetry
30
30
  # whether retryable error
31
31
  # @param error [Exception]
32
32
  def retryable?(error)
33
- TwitterRetry.config.retryable_errors.any? do |error_class, message|
34
- error.is_a?(error_class) && error.message.include?(message)
35
- end
33
+ match_any_error?(error, TwitterRetry.config.retryable_errors)
36
34
  end
37
35
 
38
36
  # whether ignorable error
39
37
  # @param error [Exception]
40
38
  def ignorable?(error)
41
- TwitterRetry.config.ignorable_errors.any? do |error_class, message|
42
- error.is_a?(error_class) && error.message.include?(message)
43
- end
39
+ match_any_error?(error, TwitterRetry.config.ignorable_errors)
44
40
  end
45
41
 
46
42
  # whether suspended user error
@@ -48,5 +44,26 @@ module TwitterRetry
48
44
  error.is_a?(Twitter::Error::Forbidden) &&
49
45
  error.message.include?("Your account is suspended and is not permitted to access this feature.")
50
46
  end
47
+
48
+ private
49
+
50
+ def match_any_error?(source_error, check_errors)
51
+ check_errors.any? do |error_class, message|
52
+ match_error?(source_error, error_class, message)
53
+ end
54
+ end
55
+
56
+ def match_error?(source_error, error_class, message)
57
+ return false unless source_error.is_a?(error_class)
58
+
59
+ # Check only error class
60
+ return true unless message
61
+
62
+ if message.is_a?(Regexp)
63
+ source_error.message =~ message
64
+ else
65
+ source_error.message.include?(message)
66
+ end
67
+ end
51
68
  end
52
69
  end
@@ -1,3 +1,3 @@
1
1
  module TwitterRetry
2
- VERSION = "0.1.0.beta1"
2
+ VERSION = "0.2.2"
3
3
  end
data/lib/twitter_retry.rb CHANGED
@@ -6,10 +6,12 @@ require "twitter_retry/retryable"
6
6
  module TwitterRetry
7
7
  extend Retryable
8
8
 
9
+ # @return [TwitterRetry::Config]
9
10
  def self.config
10
11
  @config ||= Config.new
11
12
  end
12
13
 
14
+ # @yieldparam [TwitterRetry::Config]
13
15
  def self.configure
14
16
  yield config if block_given?
15
17
  end
@@ -14,19 +14,24 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = "https://github.com/sue445/twitter_retry"
15
15
  spec.license = "MIT"
16
16
 
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
20
+ spec.metadata["rubygems_mfa_required"] = "true"
21
+
17
22
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
23
  spec.bindir = "exe"
19
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
25
  spec.require_paths = ["lib"]
21
26
 
22
- spec.add_dependency "activesupport"
23
27
  spec.add_dependency "twitter"
24
28
 
25
- spec.add_development_dependency "bundler", "~> 1.10"
29
+ spec.add_development_dependency "bundler", ">= 1.10"
26
30
  spec.add_development_dependency "coveralls"
27
- spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "rake", ">= 10.0"
28
32
  spec.add_development_dependency "rspec"
33
+ spec.add_development_dependency "rspec-its"
29
34
  spec.add_development_dependency "rspec-parameterized"
30
- spec.add_development_dependency "rubocop", "0.31.0"
35
+ spec.add_development_dependency "unparser", ">= 0.4.5"
31
36
  spec.add_development_dependency "yard"
32
37
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter_retry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.beta1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-19 00:00:00.000000000 Z
11
+ date: 2021-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: activesupport
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: twitter
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -42,14 +28,14 @@ dependencies:
42
28
  name: bundler
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - "~>"
31
+ - - ">="
46
32
  - !ruby/object:Gem::Version
47
33
  version: '1.10'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - "~>"
38
+ - - ">="
53
39
  - !ruby/object:Gem::Version
54
40
  version: '1.10'
55
41
  - !ruby/object:Gem::Dependency
@@ -70,14 +56,14 @@ dependencies:
70
56
  name: rake
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - "~>"
59
+ - - ">="
74
60
  - !ruby/object:Gem::Version
75
61
  version: '10.0'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - "~>"
66
+ - - ">="
81
67
  - !ruby/object:Gem::Version
82
68
  version: '10.0'
83
69
  - !ruby/object:Gem::Dependency
@@ -94,6 +80,20 @@ dependencies:
94
80
  - - ">="
95
81
  - !ruby/object:Gem::Version
96
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-its
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec-parameterized
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -109,19 +109,19 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rubocop
112
+ name: unparser
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 0.31.0
117
+ version: 0.4.5
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 0.31.0
124
+ version: 0.4.5
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: yard
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -144,13 +144,11 @@ extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
146
  - ".coveralls.yml"
147
+ - ".github/workflows/test.yml"
147
148
  - ".gitignore"
148
- - ".hound.yml"
149
149
  - ".rspec"
150
- - ".rubocop.yml"
151
- - ".rubocop_standard.yml"
152
- - ".travis.yml"
153
150
  - ".yardopts"
151
+ - CHANGELOG.md
154
152
  - Gemfile
155
153
  - LICENSE.txt
156
154
  - README.md
@@ -165,8 +163,12 @@ files:
165
163
  homepage: https://github.com/sue445/twitter_retry
166
164
  licenses:
167
165
  - MIT
168
- metadata: {}
169
- post_install_message:
166
+ metadata:
167
+ homepage_uri: https://github.com/sue445/twitter_retry
168
+ source_code_uri: https://github.com/sue445/twitter_retry
169
+ changelog_uri: https://github.com/sue445/twitter_retry/blob/master/CHANGELOG.md
170
+ rubygems_mfa_required: 'true'
171
+ post_install_message:
170
172
  rdoc_options: []
171
173
  require_paths:
172
174
  - lib
@@ -177,14 +179,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
179
  version: '0'
178
180
  required_rubygems_version: !ruby/object:Gem::Requirement
179
181
  requirements:
180
- - - ">"
182
+ - - ">="
181
183
  - !ruby/object:Gem::Version
182
- version: 1.3.1
184
+ version: '0'
183
185
  requirements: []
184
- rubyforge_project:
185
- rubygems_version: 2.4.5
186
- signing_key:
186
+ rubygems_version: 3.2.22
187
+ signing_key:
187
188
  specification_version: 4
188
189
  summary: Twitter api awesome handling with retry
189
190
  test_files: []
190
- has_rdoc:
data/.hound.yml DELETED
@@ -1,3 +0,0 @@
1
- ruby:
2
- enabled: true
3
- config_file: .rubocop.yml
data/.rubocop.yml DELETED
@@ -1 +0,0 @@
1
- inherit_from: .rubocop_standard.yml
@@ -1,196 +0,0 @@
1
- # via. https://gist.github.com/onk/38bfbd78899d892e0e83
2
-
3
- # target_version:
4
- # rubocop v0.31.0
5
-
6
- # 自動生成されるものはチェック対象から除外する
7
- AllCops:
8
- Exclude:
9
- - "vendor/**/*" # rubocop config/default.yml
10
- - "db/schema.rb"
11
- DisplayCopNames: true
12
-
13
- ##################### Style ##################################
14
-
15
- # redirect_to xxx and return のイディオムを維持したい
16
- Style/AndOr:
17
- EnforcedStyle: conditionals
18
-
19
- # 日本語のコメントを許可する
20
- Style/AsciiComments:
21
- Enabled: false
22
-
23
- # option 等、明示的にハッシュにした方が分かりやすい場合もある
24
- Style/BracesAroundHashParameters:
25
- Enabled: false
26
-
27
- # Style/CollectionMethods 自体は無効になっているのだが、
28
- # https://github.com/bbatsov/rubocop/issues/1084
29
- # https://github.com/bbatsov/rubocop/issues/1334
30
- # Performance/Detect がこの設定値を見るので PreferredMethods だけ変更しておく。
31
- #
32
- # デフォルト値から変えたのは
33
- # find -> detect
34
- # ActiveRecord の find と間違えやすいため
35
- # reduce -> inject
36
- # detect, reject, select と並べたときに韻を踏んでいるため。
37
- # collect -> map を維持しているのは文字数が圧倒的に少ないため。
38
- Style/CollectionMethods:
39
- PreferredMethods:
40
- detect: "detect"
41
- find: "detect"
42
- inject: "inject"
43
- reduce: "inject"
44
-
45
- # Hash#has_key? は許可したい
46
- Style/DeprecatedHashMethods:
47
- Enabled: false
48
-
49
- # ドキュメントの無い public class を許可する
50
- Style/Documentation:
51
- Enabled: false
52
-
53
- # !! のイディオムは積極的に使う
54
- Style/DoubleNegation:
55
- Enabled: false
56
-
57
- # メソッドチェーンの改行は末尾に . を入れる
58
- # REPL に貼り付けた際の暴発を防ぐため
59
- Style/DotPosition:
60
- EnforcedStyle: trailing
61
-
62
- # 明示的に else で nil を返すのは分かりやすいので許可する
63
- Style/EmptyElse:
64
- EnforcedStyle: empty
65
-
66
- # いずれかに揃えるのならば `sprintf` や `format` より String#% が好きです
67
- Style/FormatString:
68
- EnforcedStyle: percent
69
-
70
- # if 文の中に 3 行程度のブロックを書くぐらいは許容した方が現実的
71
- Style/GuardClause:
72
- MinBodyLength: 5
73
-
74
- # 同じ hash 内で記法を混ぜない
75
- # rake タスクの順序の hash は rocket を許可する
76
- Style/HashSyntax:
77
- EnforcedStyle: ruby19_no_mixed_keys
78
- Exclude:
79
- - "**/*.rake"
80
- - "Rakefile"
81
-
82
- # 条件式の方を意識させたい場合には後置の if/unless を使わない方が分かりやすい
83
- Style/IfUnlessModifier:
84
- Enabled: false
85
-
86
- # ({ と hash を開始した場合に ( の位置にインデントさせる
87
- # そもそも {} が必要ない可能性が高いが Style/BracesAroundHashParameters はチェックしないことにしたので
88
- Style/IndentHash:
89
- EnforcedStyle: consistent
90
-
91
- # private/protected は一段深くインデントする
92
- Style/IndentationConsistency:
93
- EnforcedStyle: rails
94
-
95
- # scope 等は複数行でも lambda ではなく ->{} で揃えた方が見た目が綺麗
96
- Style/Lambda:
97
- Enabled: false
98
-
99
- # 1_000_000 と区切り文字が 2 個以上必要になる場合のみ _ 区切りを必須にする
100
- Style/NumericLiterals:
101
- MinDigits: 7
102
-
103
- # has_ から始まるメソッドは許可する
104
- Style/PredicateName:
105
- NamePrefixBlacklist:
106
- - "is_"
107
- - "have_"
108
- NamePrefix:
109
- - "is_"
110
- - "have_"
111
-
112
- # 特に model 内において、ローカル変数とメソッド呼び出しの区別をつけた方が分かりやすい場合が多い
113
- Style/RedundantSelf:
114
- Enabled: false
115
-
116
- # 受け取り側で multiple assignment しろというのを明示
117
- Style/RedundantReturn:
118
- AllowMultipleReturnValues: true
119
-
120
- # fail と使い分ける必要ナシ
121
- Style/SignalException:
122
- EnforcedStyle: only_raise
123
-
124
- # `||` も align に使うことがあるので追加する
125
- Style/SpaceAroundOperators:
126
- MultiSpaceAllowedForOperators:
127
- - "="
128
- - "=>"
129
- - "||"
130
-
131
- # * 式展開したい場合に書き換えるのが面倒
132
- # * 文章ではダブルクォートよりもシングルクォートの方が頻出する
133
- # ことから EnforcedStyle: double_quotes 推奨
134
- Style/StringLiterals:
135
- EnforcedStyle: double_quotes
136
-
137
- # auto-correct 時に Style/StringLiterals とカニバって無限ループになる (v0.28.0)
138
- Style/StringLiteralsInInterpolation:
139
- Enabled: false
140
-
141
- # いくらなんでも inject { |a, e| } は短すぎるので分かりやすい名前をつけたい
142
- Style/SingleLineBlockParams:
143
- Enabled: false
144
-
145
- # * migrate
146
- # * jbuilder
147
- # * model の association
148
- # * controller の callback
149
- # 辺りの桁揃えで引っかかるので全体的にチェックしない
150
- Style/SingleSpaceBeforeFirstArg:
151
- Enabled: false
152
-
153
- # 複数行の場合はケツカンマを入れる
154
- Style/TrailingComma:
155
- EnforcedStyleForMultiline: comma
156
-
157
- ##################### Lint ##################################
158
-
159
- # * 同名のメソッドがある場合にローカル変数に `_` を付ける
160
- # * 一時変数として `_` を付ける
161
- # というテクニックは頻出する
162
- Lint/UnderscorePrefixedVariableName:
163
- Enabled: false
164
-
165
- # 子クラスで実装させるつもりのメソッドで引っかかるので
166
- Lint/UnusedMethodArgument:
167
- Enabled: false
168
-
169
- ##################### Metrics ##################################
170
-
171
- # 30 まではギリギリ許せる範囲だった
172
- Metrics/AbcSize:
173
- Max: 30
174
-
175
- # 6 は強すぎるので緩める
176
- Metrics/CyclomaticComplexity:
177
- Max: 10
178
-
179
- # * 警告 120文字
180
- # * 禁止 160文字
181
- # のイメージ
182
- Metrics/LineLength:
183
- Max: 160
184
- Exclude:
185
- - "db/migrate/*.rb"
186
-
187
- # 20 行超えるのは migration ファイル以外滅多に無い
188
- Metrics/MethodLength:
189
- Max: 20
190
- Exclude:
191
- - "db/migrate/*.rb"
192
-
193
- # 分岐の数。ガード句を多用しているとデフォルト 7 だと厳しい
194
- Metrics/PerceivedComplexity:
195
- Max: 8
196
-
data/.travis.yml DELETED
@@ -1,20 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.1
4
- - 2.2
5
- - ruby-head
6
- before_install: gem install bundler -v 1.10.5
7
- before_script:
8
- - export CI=true
9
- script: bundle exec rspec
10
- branches:
11
- only:
12
- - master
13
- notifications:
14
- slack:
15
- secure: auD2UNPVzPfJ9jKMQ89sK6aXYv5ekXSsuuqn8aiZ2+w96lb/B/lRVzOPgzmDe1/qIvYevYO3AcfgG373ARV0Ft/SEzlwiIOAhu47nyprM641AFiGQovCNe+vpWo6k3YD+J+WNG8NiD+6vDfmkmBSnE6/+VL5HUiVtW8FeFQ0lRBgcu789MWyXkZVtzvWvMTlPk3N94JgARUcT4F2bukTu1Ff95D4fZfnArJLfpv9uzxuCYUB9Ut33OdXb8k9xG+0OJeosV7oTYLKY3I+oK8mkweIzzy9flhpmLw6xCzARX2zQcsoEXeiDoUVKmldTLApBQMF96xCG6yxn1SaapsqKovVbudBuafjhpJklb1zG21UmYuNr7SmZqrLYcBb2sMLD41wyeBfJ/mO7SNWZlwJAvMrL5O538qpMfvbT3EQWGWdWnhYR79nKO5zLDqgUeJC847/QiS43MvnPlwObpO68bXdRq+C4Z6DfL96tjGfFprijKHJtZqG1kFHMELrDx6lzUi03Kt5FaHV2czz/5B7oqPsXvTWWa0yaLopxuSZqcD2zrSaso8bNFFqkt2X4CKTx2Jqq4IuGrrzqqr1NMSX2tbT06tJAKYCUQfa5mJqs2uRtzYR3jivukb+EwNOCFThrRBi69AYa2XAKjzCJ7DoFn3uQvXlmCu/3bbPQTs0LT4=
16
- matrix:
17
- allow_failures:
18
- - rvm: ruby-head
19
- sudo: false
20
- cache: bundler