equalizer 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +5 -0
  3. data/.ruby-gemset +1 -0
  4. data/.travis.yml +20 -13
  5. data/CONTRIBUTING.md +11 -0
  6. data/Gemfile +3 -62
  7. data/Gemfile.devtools +55 -0
  8. data/Guardfile +22 -8
  9. data/LICENSE +1 -1
  10. data/README.md +17 -58
  11. data/Rakefile +2 -9
  12. data/config/devtools.yml +2 -0
  13. data/config/flay.yml +1 -1
  14. data/config/flog.yml +1 -1
  15. data/config/mutant.yml +3 -0
  16. data/config/{site.reek → reek.yml} +63 -48
  17. data/config/rubocop.yml +57 -0
  18. data/equalizer.gemspec +6 -10
  19. data/lib/equalizer.rb +1 -3
  20. data/lib/equalizer/version.rb +1 -1
  21. data/spec/spec_helper.rb +29 -5
  22. data/spec/unit/equalizer/methods/{eql_spec.rb → eql_predicate_spec.rb} +1 -1
  23. data/spec/unit/equalizer/methods/{equal_value_spec.rb → equality_operator_spec.rb} +0 -0
  24. data/spec/unit/equalizer/{class_method/new_spec.rb → universal_spec.rb} +43 -27
  25. metadata +33 -106
  26. data/.rvmrc +0 -1
  27. data/spec/rcov.opts +0 -7
  28. data/spec/shared/command_method_behavior.rb +0 -7
  29. data/spec/shared/each_method_behaviour.rb +0 -15
  30. data/spec/shared/hash_method_behavior.rb +0 -17
  31. data/spec/shared/idempotent_method_behavior.rb +0 -7
  32. data/spec/shared/invertible_method_behaviour.rb +0 -9
  33. data/spec/spec.opts +0 -3
  34. data/tasks/metrics/ci.rake +0 -9
  35. data/tasks/metrics/flay.rake +0 -45
  36. data/tasks/metrics/flog.rake +0 -49
  37. data/tasks/metrics/heckle.rake +0 -208
  38. data/tasks/metrics/metric_fu.rake +0 -31
  39. data/tasks/metrics/roodi.rake +0 -19
  40. data/tasks/metrics/yardstick.rake +0 -25
  41. data/tasks/spec.rake +0 -60
  42. data/tasks/yard.rake +0 -11
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f081b71232d8ecf91f28b2dd4710cf36b5cd2936
4
+ data.tar.gz: 49a8eb253f2c6168a3ef15a0d96a150abc30cfab
5
+ SHA512:
6
+ metadata.gz: a96e4b95601585fcb934831c4825bfd8394d8e1d146f1ab5b89290ba3667a32a4d16b732f58c16d728dfbb33fd31d44383b406ed985e01996e30a6a62bd36295
7
+ data.tar.gz: 474ae8729aa767e617328fe05be9205f3fc72470f9ab5c79fb88aa2a894c3eea2029fecee7f36dad7a2bee526308690319aa5ce55cf31a471dc9beb6cd6c9457
data/.rspec ADDED
@@ -0,0 +1,5 @@
1
+ --color
2
+ --format progress
3
+ --profile
4
+ --warnings
5
+ --order random
@@ -0,0 +1 @@
1
+ equalizer
@@ -1,19 +1,26 @@
1
1
  language: ruby
2
2
  before_install: gem install bundler
3
- bundler_args: --without yard guard metrics
4
- script: "bundle exec rake spec"
3
+ bundler_args: --without yard guard benchmarks
4
+ script: "bundle exec rake ci"
5
5
  rvm:
6
- - 1.8.7
7
- - 1.9.2
8
6
  - 1.9.3
9
- - jruby-18mode
10
- - jruby-19mode
11
- - rbx-18mode
12
- - rbx-19mode
13
- - ree
7
+ - 2.0.0
14
8
  - ruby-head
15
- - jruby-head
9
+ - rbx-19mode
10
+ matrix:
11
+ include:
12
+ - rvm: jruby-19mode
13
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug"
14
+ - rvm: jruby-head
15
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug"
16
+ allow_failures:
17
+ - rvm: 1.9.3 # mutant fails
18
+ - rvm: 2.0.0 # mutant fails
19
+ - rvm: ruby-head # travis broken
20
+ - rvm: rbx-19mode # mutant fails
16
21
  notifications:
17
- email:
18
- - dan.kubb@gmail.com
19
- - mbj@seonic.net
22
+ irc:
23
+ channels:
24
+ - irc.freenode.org#rom-rb
25
+ on_success: never
26
+ on_failure: change
@@ -0,0 +1,11 @@
1
+ Contributing
2
+ ------------
3
+
4
+ * If you want your code merged into the mainline, please discuss the proposed changes with me before doing any work on it. This library is still in early development, and the direction it is going may not always be clear. Some features may not be appropriate yet, may need to be deferred until later when the foundation for them is laid, or may be more applicable in a plugin.
5
+ * Fork the project.
6
+ * Make your feature addition or bug fix.
7
+ * Follow this [style guide](https://github.com/dkubb/styleguide).
8
+ * Add specs for it. This is important so I don't break it in a future version unintentionally. Tests must cover all branches within the code, and code must be fully covered.
9
+ * Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
10
+ * Run "rake ci". This must pass and not show any regressions in the metrics for the code to be merged.
11
+ * Send me a pull request. Bonus points for topic branches.
data/Gemfile CHANGED
@@ -4,67 +4,8 @@ source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'adamantium', '~> 0.0.7', :git => 'https://github.com/dkubb/adamantium.git'
8
-
9
- group :yard do
10
- gem 'redcarpet', '~> 2.2.2', :platforms => [ :mri, :rbx ]
11
- end
12
-
13
- group :guard do
14
- gem 'guard', '~> 1.6.2'
15
- gem 'guard-bundler', '~> 1.0.0'
16
- gem 'guard-rspec', '~> 1.2.1'
17
-
18
- # file system change event handling
19
- gem 'rb-fchange', '~> 0.0.6', :require => false
20
- gem 'rb-fsevent', '~> 0.9.3', :require => false
21
- gem 'rb-inotify', '~> 0.9.0', :require => false
22
-
23
- # notification handling
24
- gem 'libnotify', '~> 0.8.0', :require => false
25
- gem 'rb-notifu', '~> 0.0.4', :require => false
26
- gem 'terminal-notifier-guard', '~> 1.5.3', :require => false
27
- end
28
-
29
- group :metrics do
30
- gem 'flay', '~> 1.4.3'
31
- gem 'flog', '~> 2.5.3'
32
- gem 'roodi', '~> 2.2.0'
33
- gem 'yardstick', '~> 0.9.3', :git => 'https://github.com/dkubb/yardstick.git'
34
-
35
- platforms :ruby_18, :ruby_19 do
36
- # this indirectly depends on ffi which does not build on ruby-head
37
- gem 'yard-spellcheck', '~> 0.1.5'
38
- end
39
-
40
- platforms :mri_18 do
41
- gem 'arrayfields', '~> 4.7.4' # for metric_fu
42
- gem 'fattr', '~> 2.2.0' # for metric_fu
43
- gem 'heckle', '~> 1.4.3'
44
- gem 'json', '~> 1.7.7' # for metric_fu rake task
45
- gem 'map', '~> 6.3.0' # for metric_fu
46
- gem 'metric_fu', '~> 2.1.1'
47
- gem 'mspec', '~> 1.5.17'
48
- gem 'rails_best_practices', '= 1.13.3' # for metric_fu
49
- gem 'rcov', '~> 1.0.0'
50
- gem 'ruby2ruby', '= 1.2.2' # for heckle
51
- end
52
-
53
- platforms :mri_19 do
54
- gem 'simplecov', '~> 0.7.1'
55
- end
56
-
57
- platforms :rbx do
58
- gem 'pelusa', '~> 0.2.2'
59
- end
7
+ group :development, :test do
8
+ gem 'devtools', git: 'https://github.com/rom-rb/devtools.git'
60
9
  end
61
10
 
62
- group :benchmarks do
63
- gem 'rbench', '~> 0.2.3'
64
- end
65
-
66
- platform :jruby do
67
- group :jruby do
68
- gem 'jruby-openssl', '~> 0.8.2'
69
- end
70
- end
11
+ eval_gemfile 'Gemfile.devtools'
@@ -0,0 +1,55 @@
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
+ end
8
+
9
+ group :yard do
10
+ gem 'kramdown', '~> 1.1.0'
11
+ end
12
+
13
+ group :guard do
14
+ gem 'guard', '~> 1.8.1'
15
+ gem 'guard-bundler', '~> 1.0.0'
16
+ gem 'guard-rspec', '~> 3.0.2'
17
+ gem 'guard-rubocop', '~> 0.2.0'
18
+ # gem 'guard-mutant', '~> 0.0.1'
19
+
20
+ # file system change event handling
21
+ gem 'listen', '~> 1.3.0'
22
+ gem 'rb-fchange', '~> 0.0.6', require: false
23
+ gem 'rb-fsevent', '~> 0.9.3', require: false
24
+ gem 'rb-inotify', '~> 0.9.0', require: false
25
+
26
+ # notification handling
27
+ gem 'libnotify', '~> 0.8.0', require: false
28
+ gem 'rb-notifu', '~> 0.0.4', require: false
29
+ gem 'terminal-notifier-guard', '~> 1.5.3', require: false
30
+ end
31
+
32
+ group :metrics do
33
+ gem 'coveralls', '~> 0.6.7'
34
+ gem 'flay', '~> 2.4.0'
35
+ gem 'flog', '~> 4.1.1'
36
+ gem 'reek', '~> 1.3.2'
37
+ gem 'rubocop', '~> 0.11.0'
38
+ gem 'simplecov', '~> 0.7.1'
39
+ gem 'yardstick', '~> 0.9.7', git: 'https://github.com/dkubb/yardstick.git'
40
+
41
+ platforms :ruby_19, :ruby_20 do
42
+ # gem 'mutant', git: 'https://github.com/mbj/mutant.git'
43
+ gem 'yard-spellcheck', '~> 0.1.5'
44
+ end
45
+ end
46
+
47
+ group :benchmarks do
48
+ gem 'rbench', '~> 0.2.3'
49
+ end
50
+
51
+ platform :jruby do
52
+ group :jruby do
53
+ gem 'jruby-openssl', '~> 0.8.5'
54
+ end
55
+ end
data/Guardfile CHANGED
@@ -2,17 +2,31 @@
2
2
 
3
3
  guard :bundler do
4
4
  watch('Gemfile')
5
+ watch('Gemfile.lock')
6
+ watch(%w{.+.gemspec\z})
5
7
  end
6
8
 
7
- guard :rspec do
8
- # run all specs if the spec_helper or supporting files files are modified
9
- watch('spec/spec_helper.rb') { 'spec' }
10
- watch(%r{\Aspec/(?:lib|support|shared)/.+\.rb\z}) { 'spec' }
9
+ guard :rspec, cli: File.read('.rspec').split.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' }
11
15
 
12
- # run unit specs if associated lib code is modified
13
- watch(%r{\Alib/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}"] }
14
- watch("lib/#{File.basename(File.expand_path('../', __FILE__))}.rb") { 'spec' }
16
+ # Run all specs if supporting files are modified
17
+ watch(%r{\Aspec/(?:fixtures|lib|support|shared)/.+\.rb\z}) { 'spec' }
15
18
 
16
- # run a spec if it is modified
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
17
25
  watch(%r{\Aspec/(?:unit|integration)/.+_spec\.rb\z})
18
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 CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009-2012 Dan Kubb
1
+ Copyright (c) 2009-2013 Dan Kubb
2
2
  Copyright (c) 2012 Markus Schirp (packaging)
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining
data/README.md CHANGED
@@ -1,34 +1,19 @@
1
1
  equalizer
2
2
  =========
3
3
 
4
- [![Build Status](https://secure.travis-ci.org/dkubb/equalizer.png?branch=master)](http://travis-ci.org/dkubb/equalizer)
5
- [![Dependency Status](https://gemnasium.com/dkubb/equalizer.png)](https://gemnasium.com/dkubb/equalizer)
6
- [![Code Climate](https://codeclimate.com/github/dkubb/equalizer.png)](https://codeclimate.com/github/dkubb/equalizer)
7
-
8
4
  Module to define equality, equivalence and inspection methods
9
5
 
10
- Installation
11
- ------------
12
-
13
- With Rubygems:
6
+ [![Gem Version](https://badge.fury.io/rb/equalizer.png)][gem]
7
+ [![Build Status](https://secure.travis-ci.org/dkubb/equalizer.png?branch=master)][travis]
8
+ [![Dependency Status](https://gemnasium.com/dkubb/equalizer.png)][gemnasium]
9
+ [![Code Climate](https://codeclimate.com/github/dkubb/equalizer.png)][codeclimate]
10
+ [![Coverage Status](https://coveralls.io/repos/dkubb/equalizer/badge.png?branch=master)][coveralls]
14
11
 
15
- ```bash
16
- $ gem install equalizer
17
- $ irb -rubygems
18
- >> require 'equalizer'
19
- => true
20
- ```
21
-
22
- With git and local working copy:
23
-
24
- ```bash
25
- $ git clone git://github.com/dkubb/equalizer.git
26
- $ cd equalizer
27
- $ rake install
28
- $ irb -rubygems
29
- >> require 'equalizer'
30
- => true
31
- ```
12
+ [gem]: https://rubygems.org/gems/equalizer
13
+ [travis]: https://travis-ci.org/dkubb/equalizer
14
+ [gemnasium]: https://gemnasium.com/dkubb/equalizer
15
+ [codeclimate]: https://codeclimate.com/github/dkubb/equalizer
16
+ [coveralls]: https://coveralls.io/r/dkubb/equalizer
32
17
 
33
18
  Examples
34
19
  --------
@@ -69,37 +54,11 @@ Credits
69
54
  * Markus Schirp ([mbj](https://github.com/mbj))
70
55
 
71
56
  Contributing
72
- ------------
73
-
74
- * If you want your code merged into the mainline, please discuss the proposed changes with me before doing any work on it. This library is still in early development, and the direction it is going may not always be clear. Some features may not be appropriate yet, may need to be deferred until later when the foundation for them is laid, or may be more applicable in a plugin.
75
- * Fork the project.
76
- * Make your feature addition or bug fix.
77
- * Follow this [style guide](https://github.com/dkubb/styleguide).
78
- * Add specs for it. This is important so I don't break it in a future version unintentionally. Tests must cover all branches within the code, and code must be fully covered.
79
- * Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
80
- * Run "rake ci". This must pass and not show any regressions in the metrics for the code to be merged.
81
- * Send me a pull request. Bonus points for topic branc
82
-
83
- License
84
- -------
57
+ -------------
58
+
59
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
60
+
61
+ Copyright
62
+ ---------
85
63
 
86
- Copyright (c) 2011-2012 Dan Kubb
87
-
88
- Permission is hereby granted, free of charge, to any person obtaining
89
- a copy of this software and associated documentation files (the
90
- "Software"), to deal in the Software without restriction, including
91
- without limitation the rights to use, copy, modify, merge, publish,
92
- distribute, sublicense, and/or sell copies of the Software, and to
93
- permit persons to whom the Software is furnished to do so, subject to
94
- the following conditions:
95
-
96
- The above copyright notice and this permission notice shall be
97
- included in all copies or substantial portions of the Software.
98
-
99
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
100
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
101
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
102
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
103
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
104
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
105
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
64
+ Copyright © 2009-2013 Dan Kubb. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,9 +1,2 @@
1
- # encoding: utf-8
2
-
3
- require 'rake'
4
-
5
- require File.expand_path('../lib/equalizer/version', __FILE__)
6
-
7
- FileList['tasks/**/*.rake'].each { |task| import task }
8
-
9
- task :default => :spec
1
+ require 'devtools'
2
+ Devtools.init_rake_tasks
@@ -0,0 +1,2 @@
1
+ ---
2
+ unit_test_timeout: 0.1
@@ -1,3 +1,3 @@
1
1
  ---
2
2
  threshold: 6
3
- total_score: 41
3
+ total_score: 25
@@ -1,2 +1,2 @@
1
1
  ---
2
- threshold: 25
2
+ threshold: 20.9
@@ -0,0 +1,3 @@
1
+ ---
2
+ name: equalizer
3
+ namespace: Equalizer
@@ -1,91 +1,106 @@
1
1
  ---
2
- UncommunicativeParameterName:
3
- accept: []
4
- exclude: []
2
+ Attribute:
5
3
  enabled: true
6
- reject:
7
- - !ruby/regexp /^.$/
8
- - !ruby/regexp /[0-9]$/
9
- - !ruby/regexp /[A-Z]/
10
- LargeClass:
11
- max_methods: 10
12
4
  exclude: []
5
+ BooleanParameter:
13
6
  enabled: true
14
- max_instance_variables: 2
15
- UncommunicativeMethodName:
16
- accept: []
17
7
  exclude: []
8
+ ClassVariable:
18
9
  enabled: true
19
- reject:
20
- - !ruby/regexp /^[a-z]$/
21
- - !ruby/regexp /[0-9]$/
22
- - !ruby/regexp /[A-Z]/
23
- LongParameterList:
24
- max_params: 2 # TODO: decrease max_params to 2
25
10
  exclude: []
11
+ ControlParameter:
26
12
  enabled: true
27
- overrides: {}
28
- FeatureEnvy:
29
13
  exclude: []
14
+ DataClump:
30
15
  enabled: true
31
- ClassVariable:
32
16
  exclude: []
17
+ max_copies: 2
18
+ min_clump_size: 2
19
+ DuplicateMethodCall:
33
20
  enabled: true
34
- BooleanParameter:
35
21
  exclude: []
22
+ max_calls: 1
23
+ allow_calls: []
24
+ FeatureEnvy:
36
25
  enabled: true
26
+ exclude: []
37
27
  IrresponsibleModule:
28
+ enabled: true
38
29
  exclude: []
30
+ LongParameterList:
39
31
  enabled: true
40
- UncommunicativeModuleName:
41
- accept: []
42
32
  exclude: []
33
+ max_params: 2
34
+ overrides:
35
+ initialize:
36
+ max_params: 3
37
+ LongYieldList:
43
38
  enabled: true
44
- reject:
45
- - !ruby/regexp /^.$/
46
- - !ruby/regexp /[0-9]$/
39
+ exclude: []
40
+ max_params: 2
47
41
  NestedIterators:
42
+ enabled: true
43
+ exclude:
44
+ - Equalizer#define_cmp_method
45
+ - Equalizer#define_hash_method
46
+ - Equalizer#define_inspect_method
47
+ max_allowed_nesting: 1
48
48
  ignore_iterators: []
49
+ NilCheck:
50
+ enabled: true
49
51
  exclude: []
52
+ RepeatedConditional:
50
53
  enabled: true
51
- max_allowed_nesting: 2
52
- LongMethod:
53
- max_statements: 7 # TODO: decrease max_statements to 5 or less
54
54
  exclude: []
55
+ max_ifs: 1
56
+ TooManyInstanceVariables:
55
57
  enabled: true
56
- Duplication:
57
- allow_calls: []
58
58
  exclude: []
59
+ max_instance_variables: 3
60
+ TooManyMethods:
59
61
  enabled: true
60
- max_calls: 1
61
- UtilityFunction:
62
- max_helper_calls: 1
63
62
  exclude: []
63
+ max_methods: 10
64
+ TooManyStatements:
65
+ enabled: true
66
+ exclude:
67
+ - each
68
+ max_statements: 5
69
+ UncommunicativeMethodName:
64
70
  enabled: true
65
- Attribute:
66
71
  exclude: []
67
- enabled: false
68
- UncommunicativeVariableName:
72
+ reject:
73
+ - !ruby/regexp /^[a-z]$/
74
+ - !ruby/regexp /[0-9]$/
75
+ - !ruby/regexp /[A-Z]/
69
76
  accept: []
77
+ UncommunicativeModuleName:
78
+ enabled: true
70
79
  exclude: []
80
+ reject:
81
+ - !ruby/regexp /^.$/
82
+ - !ruby/regexp /[0-9]$/
83
+ accept: []
84
+ UncommunicativeParameterName:
71
85
  enabled: true
86
+ exclude: []
72
87
  reject:
73
88
  - !ruby/regexp /^.$/
74
89
  - !ruby/regexp /[0-9]$/
75
90
  - !ruby/regexp /[A-Z]/
76
- SimulatedPolymorphism:
77
- exclude: []
91
+ accept: []
92
+ UncommunicativeVariableName:
78
93
  enabled: true
79
- max_ifs: 1
80
- DataClump:
81
94
  exclude: []
95
+ reject:
96
+ - !ruby/regexp /^.$/
97
+ - !ruby/regexp /[0-9]$/
98
+ - !ruby/regexp /[A-Z]/
99
+ accept: []
100
+ UnusedParameters:
82
101
  enabled: true
83
- max_copies: 1
84
- min_clump_size: 3
85
- ControlCouple:
86
102
  exclude: []
103
+ UtilityFunction:
87
104
  enabled: true
88
- LongYieldList:
89
- max_params: 1
90
105
  exclude: []
91
- enabled: true
106
+ max_helper_calls: 0