instructure-active_model-better_errors 1.6.3.rails2.5 → 1.6.5.rails2.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 +15 -0
- data/.gitignore +37 -0
- data/.rspec +4 -1
- data/.ruby-gemset +1 -0
- data/.travis.yml +5 -1
- data/Gemfile +9 -11
- data/Gemfile.devtools +66 -0
- data/Guardfile +32 -0
- data/LICENSE.txt +2 -0
- data/README.md +12 -10
- data/Rakefile +20 -49
- data/config/devtools.yml +4 -0
- data/config/flay.yml +3 -0
- data/config/flog.yml +2 -0
- data/config/mutant.yml +3 -0
- data/config/reek.yml +103 -0
- data/config/rubocop.yml +62 -0
- data/config/yardstick.yml +2 -0
- data/instructure-active_model-better_errors.gemspec +25 -112
- data/lib/active_model/better_errors/array_reporter.rb +14 -0
- data/lib/active_model/{error_collecting → better_errors}/emulation.rb +13 -6
- data/lib/active_model/{error_collecting → better_errors}/error_collection.rb +14 -6
- data/lib/active_model/{error_collecting → better_errors}/error_message.rb +12 -5
- data/lib/active_model/{error_collecting → better_errors}/error_message_set.rb +7 -2
- data/lib/active_model/{error_collecting → better_errors}/errors.rb +10 -3
- data/lib/active_model/better_errors/formatter.rb +26 -0
- data/lib/active_model/better_errors/hash_reporter.rb +14 -0
- data/lib/active_model/{error_collecting → better_errors}/human_array_reporter.rb +6 -1
- data/lib/active_model/{error_collecting → better_errors}/human_hash_reporter.rb +8 -3
- data/lib/active_model/{error_collecting → better_errors}/human_message_formatter.rb +16 -20
- data/lib/active_model/{error_collecting → better_errors}/human_message_reporter.rb +19 -12
- data/lib/active_model/{error_collecting → better_errors}/machine_array_reporter.rb +10 -2
- data/lib/active_model/{error_collecting → better_errors}/machine_hash_reporter.rb +10 -3
- data/lib/active_model/{error_collecting → better_errors}/message_reporter.rb +10 -5
- data/lib/active_model/{error_collecting → better_errors}/reporter.rb +7 -2
- data/lib/active_model/better_errors/version.rb +10 -0
- data/lib/active_model/better_errors.rb +67 -3
- data/spec/spec_helper.rb +21 -14
- data/spec/support/string_ext.rb +14 -0
- data/spec/{lib/active_model/error_collecting → unit/lib/active_model/better_errors}/emulation_spec.rb +8 -6
- data/spec/{lib/active_model/error_collecting → unit/lib/active_model/better_errors}/error_collection_spec.rb +66 -62
- data/spec/{lib/active_model/error_collecting → unit/lib/active_model/better_errors}/error_message_set_spec.rb +27 -25
- data/spec/unit/lib/active_model/better_errors/error_message_spec.rb +315 -0
- data/spec/unit/lib/active_model/better_errors/errors_spec.rb +98 -0
- data/spec/unit/lib/active_model/better_errors/human_array_reporter_spec.rb +39 -0
- data/spec/unit/lib/active_model/better_errors/human_hash_reporter_spec.rb +37 -0
- data/spec/{lib/active_model/error_collecting → unit/lib/active_model/better_errors}/human_message_formatter_spec.rb +13 -7
- data/spec/unit/lib/active_model/better_errors/human_message_reporter_spec.rb +58 -0
- data/spec/unit/lib/active_model/better_errors/machine_array_reporter_spec.rb +45 -0
- data/spec/unit/lib/active_model/better_errors/machine_hash_reporter_spec.rb +45 -0
- data/spec/unit/lib/active_model/better_errors_spec.rb +37 -0
- metadata +79 -171
- data/.document +0 -5
- data/VERSION +0 -1
- data/lib/active_model/error_collecting/array_reporter.rb +0 -9
- data/lib/active_model/error_collecting/hash_reporter.rb +0 -9
- data/lib/active_model/error_collecting.rb +0 -47
- data/spec/lib/active_model/better_errors_spec.rb +0 -7
- data/spec/lib/active_model/error_collecting/error_message_spec.rb +0 -309
- data/spec/lib/active_model/error_collecting/errors_spec.rb +0 -95
- data/spec/lib/active_model/error_collecting/human_array_reporter_spec.rb +0 -33
- data/spec/lib/active_model/error_collecting/human_hash_reporter_spec.rb +0 -32
- data/spec/lib/active_model/error_collecting/human_message_reporter_spec.rb +0 -61
- data/spec/lib/active_model/error_collecting/machine_array_reporter_spec.rb +0 -40
- data/spec/lib/active_model/error_collecting/machine_hash_reporter_spec.rb +0 -40
- data/spec/lib/active_model/error_collecting_spec.rb +0 -22
- data/test/integration.rb +0 -10
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZmQ4MmYzYWNmOTJhYTE5NGVkZDBhMjkyYzBhYWMwZjBkMmNmNDkxZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZWMyM2E3ZmUxY2Q1OTg5MDA3NWE2MjVhZjI2MGU0OGE5ZjE0YTE5ZA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NTFjZjYyNzk3NzcwNWM2Y2Y4ODFkOThkYmZiNGRiNWE2ZTU2NTQ1ZjQ5ZTVh
|
10
|
+
M2E0MGZiYzEwYTk3N2I4NjU2ZGIxODY4ODkwYTA4NzM0YjJhZjQ0ZGVjOGJl
|
11
|
+
NDQ4ZmNiMDExZjQyY2M2ODc2NmNiNzVmODZlYzk3YWE4MDljYzc=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NWRkNDhjZjFkZTRhZWZjMzk3ZGEwOTNjM2EwYWM5YzFiYTUwNDIwMTkwN2My
|
14
|
+
Y2U0MTY1Njk5MTg2NzVkNjVhNmEzOTQ2NmEwOWRiZGYwZGYwOGVlNjE3NjYw
|
15
|
+
ZDJjYjRlNDdiZDgwZTRmNDgyYjRmYzAzYjEwMzJmMjA5NGY1OTU=
|
data/.gitignore
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
## MAC OS
|
2
|
+
.DS_Store
|
3
|
+
|
4
|
+
## TEXTMATE
|
5
|
+
*.tmproj
|
6
|
+
tmtags
|
7
|
+
|
8
|
+
## EMACS
|
9
|
+
*~
|
10
|
+
\#*
|
11
|
+
.\#*
|
12
|
+
|
13
|
+
## VIM
|
14
|
+
*.sw[op]
|
15
|
+
|
16
|
+
## Rubinius
|
17
|
+
*.rbc
|
18
|
+
.rbx
|
19
|
+
|
20
|
+
## PROJECT::GENERAL
|
21
|
+
*.gem
|
22
|
+
coverage
|
23
|
+
profiling
|
24
|
+
turbulence
|
25
|
+
rdoc
|
26
|
+
pkg
|
27
|
+
tmp
|
28
|
+
doc
|
29
|
+
log
|
30
|
+
.yardoc
|
31
|
+
measurements
|
32
|
+
|
33
|
+
## BUNDLER
|
34
|
+
.bundle
|
35
|
+
Gemfile.lock
|
36
|
+
|
37
|
+
## PROJECT::SPECIFIC
|
data/.rspec
CHANGED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
active_model-better_errors
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,18 +1,16 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
gem "activerecord", "~> 2.3.11"
|
4
6
|
|
7
|
+
gemspec
|
8
|
+
|
5
9
|
group :development, :test do
|
6
|
-
gem
|
7
|
-
gem
|
8
|
-
gem "pry"
|
9
|
-
gem "yard"
|
10
|
-
gem "rdoc"
|
11
|
-
gem "bundler"
|
12
|
-
gem "jeweler"
|
13
|
-
gem "simplecov"
|
14
|
-
gem 'bcrypt-ruby', '~> 3.0.0'
|
15
|
-
gem 'mocha', '>= 0.12.1'
|
10
|
+
gem 'devtools', git: 'https://github.com/rom-rb/devtools.git'
|
11
|
+
gem 'gem-release'
|
16
12
|
gem 'sqlite3'
|
17
|
-
gem 'debugger'
|
18
13
|
end
|
14
|
+
|
15
|
+
# Added by devtools
|
16
|
+
eval_gemfile 'Gemfile.devtools'
|
data/Gemfile.devtools
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
group :development do
|
4
|
+
gem 'rake', '~> 10.1.0'
|
5
|
+
gem 'rspec', '~> 2.14.1'
|
6
|
+
gem 'yard', '~> 0.8.7'
|
7
|
+
|
8
|
+
platform :rbx do
|
9
|
+
gem 'rubysl-singleton', '~> 2.0.0'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
group :yard do
|
14
|
+
gem 'kramdown', '~> 1.3.0'
|
15
|
+
end
|
16
|
+
|
17
|
+
group :guard do
|
18
|
+
gem 'guard', '~> 2.2.4'
|
19
|
+
gem 'guard-bundler', '~> 2.0.0'
|
20
|
+
gem 'guard-rspec', '~> 4.2.0'
|
21
|
+
gem 'guard-rubocop', '~> 1.0.0'
|
22
|
+
|
23
|
+
# file system change event handling
|
24
|
+
gem 'listen', '~> 2.4.0'
|
25
|
+
gem 'rb-fchange', '~> 0.0.6', require: false
|
26
|
+
gem 'rb-fsevent', '~> 0.9.3', require: false
|
27
|
+
gem 'rb-inotify', '~> 0.9.0', require: false
|
28
|
+
|
29
|
+
# notification handling
|
30
|
+
gem 'libnotify', '~> 0.8.0', require: false
|
31
|
+
gem 'rb-notifu', '~> 0.0.4', require: false
|
32
|
+
gem 'terminal-notifier-guard', '~> 1.5.3', require: false
|
33
|
+
end
|
34
|
+
|
35
|
+
group :metrics do
|
36
|
+
gem 'coveralls', '~> 0.7.0'
|
37
|
+
gem 'flay', '~> 2.4.0'
|
38
|
+
gem 'flog', '~> 4.2.0'
|
39
|
+
gem 'reek', '~> 1.3.2'
|
40
|
+
gem 'rubocop', '~> 0.16.0'
|
41
|
+
gem 'simplecov', '~> 0.8.2'
|
42
|
+
gem 'yardstick', '~> 0.9.7', git: 'https://github.com/dkubb/yardstick.git'
|
43
|
+
|
44
|
+
platforms :ruby_19, :ruby_20 do
|
45
|
+
gem 'mutant', '~> 0.3.4'
|
46
|
+
gem 'yard-spellcheck', '~> 0.1.5'
|
47
|
+
end
|
48
|
+
|
49
|
+
platform :rbx do
|
50
|
+
gem 'json', '~> 1.8.1'
|
51
|
+
gem 'racc', '~> 1.4.10'
|
52
|
+
gem 'rubysl-logger', '~> 2.0.0'
|
53
|
+
gem 'rubysl-open-uri', '~> 2.0.0'
|
54
|
+
gem 'rubysl-prettyprint', '~> 2.0.2'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
group :benchmarks do
|
59
|
+
gem 'rbench', '~> 0.2.3'
|
60
|
+
end
|
61
|
+
|
62
|
+
platform :jruby do
|
63
|
+
group :jruby do
|
64
|
+
gem 'jruby-openssl', '~> 0.8.5'
|
65
|
+
end
|
66
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
guard :bundler do
|
4
|
+
watch('Gemfile')
|
5
|
+
watch('Gemfile.lock')
|
6
|
+
watch(%w{.+.gemspec\z})
|
7
|
+
end
|
8
|
+
|
9
|
+
guard :rspec, cli: File.read('.rspec').split.push('--fail-fast').join(' '), keep_failed: false do
|
10
|
+
# Run all specs if configuration is modified
|
11
|
+
watch('.rspec') { 'spec' }
|
12
|
+
watch('Guardfile') { 'spec' }
|
13
|
+
watch('Gemfile.lock') { 'spec' }
|
14
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
15
|
+
|
16
|
+
# Run all specs if supporting files are modified
|
17
|
+
watch(%r{\Aspec/(?:fixtures|lib|support|shared)/.+\.rb\z}) { 'spec' }
|
18
|
+
|
19
|
+
# Run unit specs if associated lib code is modified
|
20
|
+
watch(%r{\Alib/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}*"] }
|
21
|
+
watch(%r{\Alib/(.+)/support/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}/#{m[2]}*"] }
|
22
|
+
watch("lib/#{File.basename(File.expand_path('../', __FILE__))}.rb") { 'spec' }
|
23
|
+
|
24
|
+
# Run a spec if it is modified
|
25
|
+
watch(%r{\Aspec/(?:unit|integration)/.+_spec\.rb\z})
|
26
|
+
end
|
27
|
+
|
28
|
+
guard :rubocop, cli: %w[--config config/rubocop.yml] do
|
29
|
+
watch(%r{.+\.(?:rb|rake)\z})
|
30
|
+
watch(%r{\Aconfig/rubocop\.yml\z}) { |m| File.dirname(m[0]) }
|
31
|
+
watch(%r{(?:.+/)?\.rubocop\.yml\z}) { |m| File.dirname(m[0]) }
|
32
|
+
end
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,9 @@
|
|
3
3
|
[](http://badge.fury.io/rb/active_model-better_errors)
|
4
4
|
[](https://travis-ci.org/aq1018/active_model-better_errors)
|
5
5
|
[](https://gemnasium.com/aq1018/active_model-better_errors)
|
6
|
-
[](https://coveralls.io/r/aq1018/active_model-better_errors?branch=master)
|
7
|
+
[](https://codeclimate.com/github/aq1018/active_model-better_errors)
|
8
|
+
[](http://opensource.org/licenses/MIT)
|
7
9
|
|
8
10
|
`active_model-better_errors` is a `ActiveModel::Errors` compatible library to help you
|
9
11
|
customize the presentation of your error messages.
|
@@ -54,17 +56,17 @@ By default, `active_model-better_errors` is a drop-in replacement for `ActiveMod
|
|
54
56
|
and will mostly function without modifications. This is because the default reporters are set like the following:
|
55
57
|
|
56
58
|
```ruby
|
57
|
-
ActiveModel::
|
58
|
-
ActiveModel::
|
59
|
-
ActiveModel::
|
59
|
+
ActiveModel::BetterErrors.set_reporter :message, :human
|
60
|
+
ActiveModel::BetterErrors.set_reporter :array, :human
|
61
|
+
ActiveModel::BetterErrors.set_reporter :hash, :human
|
60
62
|
```
|
61
63
|
|
62
64
|
If you want to output API friendly JSON / XML by default, you can use the following config.
|
63
65
|
|
64
66
|
```ruby
|
65
|
-
ActiveModel::
|
66
|
-
ActiveModel::
|
67
|
-
ActiveModel::
|
67
|
+
ActiveModel::BetterErrors.set_reporter :message, :human
|
68
|
+
ActiveModel::BetterErrors.set_reporter :array, :machine
|
69
|
+
ActiveModel::BetterErrors.set_reporter :hash, :machine
|
68
70
|
```
|
69
71
|
|
70
72
|
Note: The configurations above determines *default* reporters to use, you can always switch to
|
@@ -73,7 +75,7 @@ any reporters you want during runtime by invoking `errors.set_reporter`
|
|
73
75
|
## Usage
|
74
76
|
|
75
77
|
```ruby
|
76
|
-
user.errors # returns an instance of ActiveModel::
|
78
|
+
user.errors # returns an instance of ActiveModel::BetterErrors::Errors
|
77
79
|
|
78
80
|
# Use MachineArrayReporter to output API friendly error messages
|
79
81
|
user.errors.set_reporter(:array, :machine)
|
@@ -156,14 +158,14 @@ This library implements the following reporters of this type:
|
|
156
158
|
Creating a custom reporter is easy. Here is an example to create a hash reporter
|
157
159
|
|
158
160
|
```ruby
|
159
|
-
class MyHashReporter < ActiveModel::
|
161
|
+
class MyHashReporter < ActiveModel::BetterErrors::HashReporter
|
160
162
|
def to_hash
|
161
163
|
# you have access to #collection and #base
|
162
164
|
end
|
163
165
|
end
|
164
166
|
|
165
167
|
# set it to use it.
|
166
|
-
ActiveModel::
|
168
|
+
ActiveModel::BetterErrors.set_reporter :hash, MyHashReporter
|
167
169
|
```
|
168
170
|
|
169
171
|
## Contributing to active_model-better_errors
|
data/Rakefile
CHANGED
@@ -1,57 +1,28 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require
|
4
|
-
require 'bundler'
|
5
|
-
begin
|
6
|
-
Bundler.setup(:default, :development)
|
7
|
-
rescue Bundler::BundlerError => e
|
8
|
-
$stderr.puts e.message
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
-
exit e.status_code
|
11
|
-
end
|
12
|
-
require 'rake'
|
3
|
+
require "bundler/gem_tasks"
|
13
4
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
gem.name = "instructure-active_model-better_errors"
|
18
|
-
gem.homepage = "http://github.com/codekitchen/active_model-better_errors"
|
19
|
-
gem.license = "MIT"
|
20
|
-
gem.summary = %Q{API consumable error messages with ActiveModel::Errors drop-in compatibility.}
|
21
|
-
gem.description = %Q{ActiveModel::Errors class is not designed for API consumption. This gem allows for that while keeping compatibility with existing rails API.}
|
22
|
-
gem.email = ["aq1018@gmail.com", "byronanderson32@gmail.com", "brianp@instructure.com"]
|
23
|
-
gem.authors = ["Aaron Qian", "Byron Anderson", "Brian Palmer"]
|
24
|
-
# dependencies defined in Gemfile
|
25
|
-
end
|
26
|
-
Jeweler::RubygemsDotOrgTasks.new
|
5
|
+
# Added by devtools
|
6
|
+
require 'devtools'
|
7
|
+
Devtools.init_rake_tasks
|
27
8
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
-
end
|
9
|
+
task :default => [
|
10
|
+
# Make sure ruby style is good
|
11
|
+
'metrics:rubocop',
|
33
12
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
13
|
+
# Duplicate code detection.
|
14
|
+
# Currently a lot of dups that need to be worked on.
|
15
|
+
# Disabled so travis can pass test.
|
16
|
+
# 'metrics:flay',
|
38
17
|
|
39
|
-
|
18
|
+
# Check for code smells
|
19
|
+
# Currently very smelly
|
20
|
+
# Disabled so travis can pass test.
|
21
|
+
# 'metrics:reek',
|
40
22
|
|
41
|
-
|
23
|
+
# run spec and generate coverage
|
24
|
+
'metrics:coverage',
|
42
25
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
Rake::TestTask.new("test:integration") do |t|
|
48
|
-
t.libs << "vendor/rails/activemodel/test"
|
49
|
-
t.test_files = test_files
|
50
|
-
t.warning = true
|
51
|
-
end
|
52
|
-
|
53
|
-
|
54
|
-
task :default => [ :spec ]
|
55
|
-
|
56
|
-
require 'yard'
|
57
|
-
YARD::Rake::YardocTask.new
|
26
|
+
# We need to kill all mutants before enabling this for ci
|
27
|
+
# 'metrics:mutant'
|
28
|
+
]
|
data/config/devtools.yml
ADDED
data/config/flay.yml
ADDED
data/config/flog.yml
ADDED
data/config/mutant.yml
ADDED
data/config/reek.yml
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
---
|
2
|
+
Attribute:
|
3
|
+
enabled: true
|
4
|
+
exclude: []
|
5
|
+
BooleanParameter:
|
6
|
+
enabled: true
|
7
|
+
exclude: []
|
8
|
+
ClassVariable:
|
9
|
+
enabled: true
|
10
|
+
exclude: []
|
11
|
+
ControlParameter:
|
12
|
+
enabled: true
|
13
|
+
exclude: []
|
14
|
+
DataClump:
|
15
|
+
enabled: true
|
16
|
+
exclude: []
|
17
|
+
max_copies: 2
|
18
|
+
min_clump_size: 2
|
19
|
+
DuplicateMethodCall:
|
20
|
+
enabled: true
|
21
|
+
exclude: []
|
22
|
+
max_calls: 1
|
23
|
+
allow_calls: []
|
24
|
+
FeatureEnvy:
|
25
|
+
enabled: true
|
26
|
+
exclude: []
|
27
|
+
IrresponsibleModule:
|
28
|
+
enabled: true
|
29
|
+
exclude: []
|
30
|
+
LongParameterList:
|
31
|
+
enabled: true
|
32
|
+
exclude: []
|
33
|
+
max_params: 2
|
34
|
+
overrides:
|
35
|
+
initialize:
|
36
|
+
max_params: 3
|
37
|
+
LongYieldList:
|
38
|
+
enabled: true
|
39
|
+
exclude: []
|
40
|
+
max_params: 2
|
41
|
+
NestedIterators:
|
42
|
+
enabled: true
|
43
|
+
exclude: []
|
44
|
+
max_allowed_nesting: 1
|
45
|
+
ignore_iterators: []
|
46
|
+
NilCheck:
|
47
|
+
enabled: true
|
48
|
+
exclude: []
|
49
|
+
RepeatedConditional:
|
50
|
+
enabled: true
|
51
|
+
exclude: []
|
52
|
+
max_ifs: 1
|
53
|
+
TooManyInstanceVariables:
|
54
|
+
enabled: true
|
55
|
+
exclude: []
|
56
|
+
max_instance_variables: 3
|
57
|
+
TooManyMethods:
|
58
|
+
enabled: true
|
59
|
+
exclude: []
|
60
|
+
max_methods: 10
|
61
|
+
TooManyStatements:
|
62
|
+
enabled: true
|
63
|
+
exclude:
|
64
|
+
- each
|
65
|
+
max_statements: 2
|
66
|
+
UncommunicativeMethodName:
|
67
|
+
enabled: true
|
68
|
+
exclude: []
|
69
|
+
reject:
|
70
|
+
- !ruby/regexp /^[a-z]$/
|
71
|
+
- !ruby/regexp /[0-9]$/
|
72
|
+
- !ruby/regexp /[A-Z]/
|
73
|
+
accept: []
|
74
|
+
UncommunicativeModuleName:
|
75
|
+
enabled: true
|
76
|
+
exclude: []
|
77
|
+
reject:
|
78
|
+
- !ruby/regexp /^.$/
|
79
|
+
- !ruby/regexp /[0-9]$/
|
80
|
+
accept: []
|
81
|
+
UncommunicativeParameterName:
|
82
|
+
enabled: true
|
83
|
+
exclude: []
|
84
|
+
reject:
|
85
|
+
- !ruby/regexp /^.$/
|
86
|
+
- !ruby/regexp /[0-9]$/
|
87
|
+
- !ruby/regexp /[A-Z]/
|
88
|
+
accept: []
|
89
|
+
UncommunicativeVariableName:
|
90
|
+
enabled: true
|
91
|
+
exclude: []
|
92
|
+
reject:
|
93
|
+
- !ruby/regexp /^.$/
|
94
|
+
- !ruby/regexp /[0-9]$/
|
95
|
+
- !ruby/regexp /[A-Z]/
|
96
|
+
accept: []
|
97
|
+
UnusedParameters:
|
98
|
+
enabled: true
|
99
|
+
exclude: []
|
100
|
+
UtilityFunction:
|
101
|
+
enabled: true
|
102
|
+
exclude: []
|
103
|
+
max_helper_calls: 0
|
data/config/rubocop.yml
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
AllCops:
|
2
|
+
Includes:
|
3
|
+
- '**/*.rake'
|
4
|
+
- 'Gemfile'
|
5
|
+
- 'Gemfile.devtools'
|
6
|
+
Excludes:
|
7
|
+
- '**/vendor/**'
|
8
|
+
- '**/benchmarks/**'
|
9
|
+
|
10
|
+
# Avoid parameter lists longer than five parameters.
|
11
|
+
ParameterLists:
|
12
|
+
Max: 5
|
13
|
+
CountKeywordArgs: true
|
14
|
+
|
15
|
+
# Avoid more than `Max` levels of nesting.
|
16
|
+
BlockNesting:
|
17
|
+
Max: 3
|
18
|
+
|
19
|
+
# Align with the style guide.
|
20
|
+
CollectionMethods:
|
21
|
+
PreferredMethods:
|
22
|
+
collect: 'map'
|
23
|
+
inject: 'reduce'
|
24
|
+
find: 'detect'
|
25
|
+
find_all: 'select'
|
26
|
+
|
27
|
+
# Do not force public/protected/private keyword to be indented at the same
|
28
|
+
# level as the def keyword. My personal preference is to outdent these keywords
|
29
|
+
# because I think when scanning code it makes it easier to identify the
|
30
|
+
# sections of code and visually separate them. When the keyword is at the same
|
31
|
+
# level I think it sort of blends in with the def keywords and makes it harder
|
32
|
+
# to scan the code and see where the sections are.
|
33
|
+
AccessModifierIndentation:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
# Limit line length
|
37
|
+
LineLength:
|
38
|
+
Max: 79
|
39
|
+
|
40
|
+
# Disable documentation checking until a class needs to be documented once
|
41
|
+
Documentation:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
# Do not favor modifier if/unless usage when you have a single-line body
|
45
|
+
IfUnlessModifier:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
# Allow case equality operator (in limited use within the specs)
|
49
|
+
CaseEquality:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
# Constants do not always have to use SCREAMING_SNAKE_CASE
|
53
|
+
ConstantName:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
# Not all trivial readers/writers can be defined with attr_* methods
|
57
|
+
TrivialAccessors:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
# Allow empty lines around body
|
61
|
+
EmptyLinesAroundBody:
|
62
|
+
Enabled: false
|