morpher 0.2.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of morpher might be problematic. Click here for more details.

Files changed (106) hide show
  1. checksums.yaml +7 -0
  2. data/.circle.yml +6 -0
  3. data/.gitignore +5 -0
  4. data/.rspec +4 -0
  5. data/.rubocop.yml +8 -0
  6. data/Changelog.md +60 -0
  7. data/Gemfile +3 -0
  8. data/LICENSE +20 -0
  9. data/README.md +56 -0
  10. data/Rakefile +95 -0
  11. data/circle.yml +7 -0
  12. data/config/devtools.yml +2 -0
  13. data/config/flay.yml +3 -0
  14. data/config/flog.yml +2 -0
  15. data/config/heckle.yml +3 -0
  16. data/config/mutant.yml +8 -0
  17. data/config/reek.yml +109 -0
  18. data/config/rubocop.yml +138 -0
  19. data/config/yardstick.yml +2 -0
  20. data/examples/README.md +13 -0
  21. data/examples/a.rb +25 -0
  22. data/examples/b.rb +35 -0
  23. data/lib/morpher.rb +111 -0
  24. data/lib/morpher/compiler.rb +17 -0
  25. data/lib/morpher/compiler/emitter.rb +82 -0
  26. data/lib/morpher/compiler/error.rb +84 -0
  27. data/lib/morpher/compiler/evaluator.rb +63 -0
  28. data/lib/morpher/compiler/evaluator/emitter.rb +224 -0
  29. data/lib/morpher/compiler/preprocessor.rb +29 -0
  30. data/lib/morpher/compiler/preprocessor/emitter.rb +54 -0
  31. data/lib/morpher/compiler/preprocessor/emitter/anima.rb +69 -0
  32. data/lib/morpher/compiler/preprocessor/emitter/boolean.rb +31 -0
  33. data/lib/morpher/compiler/preprocessor/emitter/key.rb +87 -0
  34. data/lib/morpher/compiler/preprocessor/emitter/noop.rb +45 -0
  35. data/lib/morpher/compiler/preprocessor/emitter/param.rb +50 -0
  36. data/lib/morpher/evaluation.rb +118 -0
  37. data/lib/morpher/evaluator.rb +40 -0
  38. data/lib/morpher/evaluator/binary.rb +46 -0
  39. data/lib/morpher/evaluator/nary.rb +97 -0
  40. data/lib/morpher/evaluator/nullary.rb +92 -0
  41. data/lib/morpher/evaluator/nullary/parameterized.rb +48 -0
  42. data/lib/morpher/evaluator/predicate.rb +22 -0
  43. data/lib/morpher/evaluator/predicate/boolean.rb +76 -0
  44. data/lib/morpher/evaluator/predicate/contradiction.rb +36 -0
  45. data/lib/morpher/evaluator/predicate/eql.rb +50 -0
  46. data/lib/morpher/evaluator/predicate/negation.rb +52 -0
  47. data/lib/morpher/evaluator/predicate/primitive.rb +49 -0
  48. data/lib/morpher/evaluator/predicate/tautology.rb +36 -0
  49. data/lib/morpher/evaluator/transformer.rb +75 -0
  50. data/lib/morpher/evaluator/transformer/attribute.rb +25 -0
  51. data/lib/morpher/evaluator/transformer/block.rb +81 -0
  52. data/lib/morpher/evaluator/transformer/coerce.rb +166 -0
  53. data/lib/morpher/evaluator/transformer/custom.rb +34 -0
  54. data/lib/morpher/evaluator/transformer/domain.rb +86 -0
  55. data/lib/morpher/evaluator/transformer/domain/attribute_accessors.rb +60 -0
  56. data/lib/morpher/evaluator/transformer/domain/attribute_hash.rb +52 -0
  57. data/lib/morpher/evaluator/transformer/domain/instance_variables.rb +60 -0
  58. data/lib/morpher/evaluator/transformer/domain/param.rb +54 -0
  59. data/lib/morpher/evaluator/transformer/guard.rb +62 -0
  60. data/lib/morpher/evaluator/transformer/hash_transform.rb +149 -0
  61. data/lib/morpher/evaluator/transformer/input.rb +37 -0
  62. data/lib/morpher/evaluator/transformer/key.rb +86 -0
  63. data/lib/morpher/evaluator/transformer/map.rb +100 -0
  64. data/lib/morpher/evaluator/transformer/merge.rb +25 -0
  65. data/lib/morpher/evaluator/transformer/static.rb +27 -0
  66. data/lib/morpher/evaluator/unary.rb +79 -0
  67. data/lib/morpher/node_helpers.rb +19 -0
  68. data/lib/morpher/printer.rb +233 -0
  69. data/lib/morpher/printer/mixin.rb +58 -0
  70. data/lib/morpher/registry.rb +51 -0
  71. data/lib/morpher/type_lookup.rb +51 -0
  72. data/morpher.gemspec +29 -0
  73. data/spec/integration_spec.rb +184 -0
  74. data/spec/rcov.opts +7 -0
  75. data/spec/shared/evaluator_behavior.rb +155 -0
  76. data/spec/spec_helper.rb +36 -0
  77. data/spec/support/ice_nine_config.rb +8 -0
  78. data/spec/support/let_mock_helper.rb +8 -0
  79. data/spec/support/strip_helper.rb +12 -0
  80. data/spec/unit/morpher/compiler/preprocessor_spec.rb +46 -0
  81. data/spec/unit/morpher/evaluator/nullary/parameterized_spec.rb +25 -0
  82. data/spec/unit/morpher/evaluator/predicate/boolean/and_spec.rb +11 -0
  83. data/spec/unit/morpher/evaluator/predicate/boolean/or_spec.rb +26 -0
  84. data/spec/unit/morpher/evaluator/predicate/boolean/xor_spec.rb +26 -0
  85. data/spec/unit/morpher/evaluator/predicate/contrandiction_spec.rb +7 -0
  86. data/spec/unit/morpher/evaluator/predicate/eql_spec.rb +11 -0
  87. data/spec/unit/morpher/evaluator/predicate/negation_spec.rb +10 -0
  88. data/spec/unit/morpher/evaluator/predicate/primitive_spec.rb +17 -0
  89. data/spec/unit/morpher/evaluator/predicate/tautology_spec.rb +7 -0
  90. data/spec/unit/morpher/evaluator/transformer/attribute_spec.rb +9 -0
  91. data/spec/unit/morpher/evaluator/transformer/block_spec.rb +92 -0
  92. data/spec/unit/morpher/evaluator/transformer/coerce/parse_int_spec.rb +23 -0
  93. data/spec/unit/morpher/evaluator/transformer/custom_spec.rb +13 -0
  94. data/spec/unit/morpher/evaluator/transformer/domain/attribute_accessors_spec.rb +48 -0
  95. data/spec/unit/morpher/evaluator/transformer/domain/attribute_hash_spec.rb +40 -0
  96. data/spec/unit/morpher/evaluator/transformer/domain/instance_variables_spec.rb +47 -0
  97. data/spec/unit/morpher/evaluator/transformer/guard_spec.rb +12 -0
  98. data/spec/unit/morpher/evaluator/transformer/hash_transform_spec.rb +47 -0
  99. data/spec/unit/morpher/evaluator/transformer/input_spec.rb +11 -0
  100. data/spec/unit/morpher/evaluator/transformer/map_spec.rb +25 -0
  101. data/spec/unit/morpher/evaluator/transformer/static_spec.rb +10 -0
  102. data/spec/unit/morpher/evaluator_spec.rb +15 -0
  103. data/spec/unit/morpher/printer_spec.rb +21 -0
  104. data/spec/unit/morpher/registry_spec.rb +11 -0
  105. data/spec/unit/morpher_spec.rb +53 -0
  106. metadata +302 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5f18711608608d54da053a0a3e46e984d3b1457e
4
+ data.tar.gz: 35dfed724e836a5f8e96136f27431a338f57e91d
5
+ SHA512:
6
+ metadata.gz: bb8c65764c79b61e2add0c8cec9d05091bf83bca90d7796f3673b330a66c5f34bb4e781537561c47570a4e9441e0cd9cb4d604fcf760b1dd2b6fd50311fccb76
7
+ data.tar.gz: d76d2ec266797bf33ad5b9bf9440e872ee9ed5245c36b765849f2c8d8c9eb6ebc78ec48b218b89d49a7aba58a5cdc429a7983ba577d4e3ca1c8448245c4524ae
data/.circle.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ ruby:
3
+ version: 1.9.3-p429
4
+ test:
5
+ override:
6
+ - bundle exec rake ci
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ /.rbx
2
+ /Gemfile.lock
3
+ /tmp
4
+ /.bundle
5
+ /vendor
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --warnings
3
+ --order random
4
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ AllCops:
2
+ Include:
3
+ - 'Gemfile'
4
+ Exclude:
5
+ - 'Gemfile.devtools'
6
+ - 'vendor/**/*'
7
+ - 'examples/**/*'
8
+ - 'benchmarks/**/*'
data/Changelog.md ADDED
@@ -0,0 +1,60 @@
1
+ # v0.2.3 2014-04-22
2
+
3
+ [Compare v0.2.2..v0.2.3](https://github.com/mbj/morpher/compare/v0.2.2...v0.2.3)
4
+
5
+ Changes:
6
+
7
+ * Dependency updates.
8
+
9
+ # v0.2.2 2014-04-10
10
+
11
+ [Compare v0.2.1..v0.2.2](https://github.com/mbj/morpher/compare/v0.2.1...v0.2.2)
12
+
13
+ Changes:
14
+
15
+ * Add Mutant.sexp returning a morpher AST node via evaluating a block with sexp node API available.
16
+ * Add Mutant.build returning a morpher evaluator via evaluating a block with sexp node API available.
17
+ * Fix evaluation errors on Transformer::Map node.
18
+ * Ensure mutant coverage scores on CI
19
+
20
+ # v0.2.1 2014-03-29
21
+
22
+ [Compare v0.2.0..v0.2.1](https://github.com/mbj/morpher/compare/v0.2.0...v0.2.1)
23
+
24
+ Changes:
25
+
26
+ * Fix warnings on multiple method definition
27
+
28
+ # v0.2.0 2014-03-09
29
+
30
+ [Compare v0.1.0..v0.2.0](https://github.com/mbj/morpher/compare/v0.1.0...v0.2.0)
31
+
32
+ Changes:
33
+
34
+ * Add param node s(:param, Model, :some, :attributes) to build Transformer::Domain::Param
35
+
36
+ Breaking-Changes:
37
+
38
+ * Rename {load,dump}_attributes_hash to {load,dump}_attribute_hash
39
+ * Require {load,dump}_attribute_hash param to be an instance of Transformer::Domain::Param
40
+
41
+ # v0.1.0 2014-03-08
42
+
43
+ [Compare v0.0.1..v0.1.0](https://github.com/mbj/morpher/compare/v0.0.1...v0.1.0)
44
+
45
+ Breaking-Changes:
46
+
47
+ * Renamed `Morpher.evaluator(node)` to `Morpher.compile(node)`
48
+ * Rename node: `symbolize_key` to `key_symbolize`
49
+ * Rename node: `anima_load` to `load_attributes_hash`
50
+ * Rename node: `anima_dump` to `dump_attributes_hash`
51
+ * The ability to rescue/report anima specific exceptions has been dropped
52
+
53
+ Changes:
54
+
55
+ * Add {dump,load}_{attribute_accessors,instance_variables} as additional strategies to
56
+ transform from / to domain objects.
57
+
58
+ # v0.0.1 2014-03-02
59
+
60
+ First public release.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Markus Schirp
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,56 @@
1
+ morpher
2
+ =======
3
+
4
+ [![Build Status](https://secure.travis-ci.org/mbj/morpher.png?branch=master)](http://travis-ci.org/mbj/morpher)
5
+ [![Dependency Status](https://gemnasium.com/mbj/morpher.png)](https://gemnasium.com/mbj/morpher)
6
+ [![Code Climate](https://codeclimate.com/github/mbj/morpher.png)](https://codeclimate.com/github/mbj/morpher)
7
+
8
+ Morpher is a data transformation algebra with optional tracked evaluation.
9
+
10
+ It can be used at various places:
11
+
12
+ * Domain to JSON and vice versa, for building rest style APIS
13
+ * Domain to document db and vice versa, for building mappers
14
+ * Form processing
15
+ * ...
16
+
17
+ Status
18
+ ------
19
+
20
+ This library is in "moving to MDD from spike mode".
21
+
22
+ ### Mutation coverage
23
+
24
+ I use so called "implicit coverage". A term that was invented by the [rom](https://github.com/rom-rb)-team
25
+ during mutation testing. Later when this library is not under steady flux anymore I'll switch to explicit coverage.
26
+
27
+ Installation
28
+ ------------
29
+
30
+ Install the gem `morpher` via your preferred method.
31
+
32
+ Examples
33
+ --------
34
+
35
+ See specs, Public Evaluator API is stable and there are ongoing 0.x.y releases for early adopters.
36
+
37
+ Credits
38
+ -------
39
+
40
+ * [mbj](https://github.com/mbj)
41
+
42
+ Contributing
43
+ ------------
44
+
45
+ * Fork the project.
46
+ * Make your feature addition or bug fix.
47
+ * Add tests for it. This is important so I don't break it in a
48
+ future version unintentionally.
49
+ * Commit, do not mess with Rakefile or version
50
+ (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)
51
+ * Send me a pull request. Bonus points for topic branches.
52
+
53
+ License
54
+ -------
55
+
56
+ See LICENSE file.
data/Rakefile ADDED
@@ -0,0 +1,95 @@
1
+ require 'devtools'
2
+ Devtools.init_rake_tasks
3
+
4
+ Rake.application.load_imports
5
+ task('metrics:mutant').clear
6
+ namespace :metrics do
7
+ task mutant: :coverage do
8
+ success = Kernel.system(*%w[
9
+ bundle exec mutant
10
+ --zombie
11
+ --use rspec
12
+ --include lib
13
+ --require morpher
14
+ --since HEAD~1
15
+ --
16
+ Morpher*
17
+ ]) or fail 'Mutant task is not successful'
18
+ end
19
+ end
20
+
21
+ # NOTICE: This uses private interface of morpher that can change at any time.
22
+ # Its just a placeholder for a better reflection technique!!!
23
+ namespace :morpher do
24
+ desc 'List morpher nodes'
25
+ task :list do
26
+
27
+ class Presenter
28
+
29
+ class Evaluator < self
30
+ include Concord::Public.new(:name, :evaluator)
31
+
32
+ def arity
33
+ emitter = Morpher::Compiler::Evaluator::DEFAULT.send(:emitter, evaluator)
34
+ emitter_ns = Morpher::Compiler::Evaluator::Emitter
35
+
36
+ {
37
+ emitter_ns::Nullary => :nullary,
38
+ emitter_ns::Nullary::Parameterized => :nullary_param,
39
+ emitter_ns::Unary => :unary,
40
+ emitter_ns::Binary => :binary,
41
+ emitter_ns::Nary => :nary
42
+ }.fetch(emitter)
43
+ end
44
+
45
+ def transitivity
46
+ ancestors = evaluator.ancestors
47
+ if ancestors.include?(Morpher::Evaluator::Transformer::Transitive)
48
+ :yes
49
+ elsif ancestors.include?(Morpher::Evaluator::Transformer::Intransitive)
50
+ :no
51
+ else
52
+ :dynamic
53
+ end
54
+ end
55
+
56
+ def role
57
+ if evaluator.ancestors.include?(Morpher::Evaluator::Transformer)
58
+ :transforming
59
+ else
60
+ :predicate
61
+ end
62
+ end
63
+
64
+ end
65
+
66
+ class Preprocessor
67
+ include Concord::Public.new(:name, :emitter)
68
+
69
+ def children_nodes
70
+ emitter.allocate.send(:named_children).join(', ')
71
+ end
72
+ end
73
+
74
+ end
75
+
76
+ puts 'Evaluators:'
77
+ EVALUATOR_FIELDS = [:name, :arity, :transitivity, :role]
78
+ EVALUATOR_FORMAT = '%-24s - %-15s - %-15s - %-20s'.freeze
79
+
80
+ puts EVALUATOR_FORMAT % EVALUATOR_FIELDS
81
+ Morpher::Evaluator::REGISTRY.each do |name, evaluator|
82
+ presenter = Presenter::Evaluator.new(name, evaluator)
83
+ puts EVALUATOR_FORMAT % EVALUATOR_FIELDS.map(&presenter.method(:public_send))
84
+ end
85
+
86
+ puts 'Preprocessors:'
87
+ PREPROCESSOR_FORMAT = '%-20s - %-20s'
88
+ PREPROCESSOR_FIELDS = [:name, :children_nodes]
89
+ puts PREPROCESSOR_FORMAT % PREPROCESSOR_FIELDS
90
+ Morpher::Compiler::Preprocessor::Emitter::REGISTRY.each do |name, emitter|
91
+ presenter = Presenter::Preprocessor.new(name, emitter)
92
+ puts PREPROCESSOR_FORMAT % PREPROCESSOR_FIELDS.map(&presenter.method(:public_send))
93
+ end
94
+ end
95
+ end
data/circle.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ machine:
3
+ ruby:
4
+ version: 2.2.3
5
+ test:
6
+ override:
7
+ - bundle exec rake ci
@@ -0,0 +1,2 @@
1
+ ---
2
+ unit_test_timeout: 1.0
data/config/flay.yml ADDED
@@ -0,0 +1,3 @@
1
+ ---
2
+ threshold: 23
3
+ total_score: 427
data/config/flog.yml ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ threshold: 27.0 # TODO: decrease to ~ 10
data/config/heckle.yml ADDED
@@ -0,0 +1,3 @@
1
+ ---
2
+ library: adamantium
3
+ namespace: Adamantium
data/config/mutant.yml ADDED
@@ -0,0 +1,8 @@
1
+ name: morpher
2
+ namespace: Morpher
3
+ zombie: true
4
+ expect_coverage: 71.21
5
+ ignore_subjects:
6
+ # Infinite runtime mutations here
7
+ - Morpher::TypeLookup
8
+ - Morpher::Compiler::Preprocessor
data/config/reek.yml ADDED
@@ -0,0 +1,109 @@
1
+ ---
2
+ UncommunicativeParameterName:
3
+ accept: []
4
+ exclude: []
5
+ enabled: true
6
+ reject:
7
+ - !ruby/regexp /^.$/
8
+ - !ruby/regexp /[0-9]$/
9
+ - !ruby/regexp /[A-Z]/
10
+ TooManyMethods:
11
+ max_methods: 10
12
+ exclude:
13
+ - Morpher::Printer # 16 methods
14
+ enabled: true
15
+ max_instance_variables: 2
16
+ UncommunicativeMethodName:
17
+ accept: ['s']
18
+ exclude: []
19
+ enabled: true
20
+ reject:
21
+ - !ruby/regexp /^[a-z]$/
22
+ - !ruby/regexp /[0-9]$/
23
+ - !ruby/regexp /[A-Z]/
24
+ LongParameterList:
25
+ max_params: 3 # TODO: decrease max_params to 2
26
+ exclude: []
27
+ enabled: true
28
+ overrides: {}
29
+ FeatureEnvy:
30
+ exclude:
31
+ # False positives:
32
+ - Morpher::Printer::Mixin::InstanceMethods#description
33
+ - Morpher::Evaluator::Transformer::Domain::AttributeHash::Dump#call
34
+ - Morpher::Evaluator::Transformer::Domain::AttributeAccessors::Load#call
35
+ - Morpher::Evaluator::Transformer::Domain::InstanceVariables::Load#call
36
+ - Morpher::Evaluator::Transformer::Domain::InstanceVariables::Dump#call
37
+ enabled: true
38
+ ClassVariable:
39
+ exclude: []
40
+ enabled: true
41
+ BooleanParameter:
42
+ exclude: []
43
+ enabled: true
44
+ IrresponsibleModule:
45
+ exclude:
46
+ # False positives
47
+ - Morpher::Compiler
48
+ - Morpher::Compiler::Preprocessor
49
+ - Morpher::Compiler::Evaluator
50
+ enabled: true
51
+ UncommunicativeModuleName:
52
+ accept: []
53
+ exclude: []
54
+ enabled: true
55
+ reject:
56
+ - !ruby/regexp /^.$/
57
+ - !ruby/regexp /[0-9]$/
58
+ NestedIterators:
59
+ ignore_iterators: []
60
+ exclude: []
61
+ enabled: true
62
+ max_allowed_nesting: 2
63
+ TooManyStatements:
64
+ max_statements: 7 # TODO: decrease max_statements to 5 or less
65
+ exclude:
66
+ - Morpher::Compiler::Emitter#self.children
67
+ enabled: true
68
+ DuplicateMethodCall:
69
+ allow_calls: []
70
+ exclude: []
71
+ enabled: false # TOOD enable
72
+ max_calls: 1
73
+ UtilityFunction:
74
+ max_helper_calls: 1
75
+ exclude:
76
+ - Morpher::Evaluator::Predicate::Contradiction#inverse
77
+ - Morpher::Evaluator::Predicate::Tautology#inverse
78
+ - Morpher::Evaluator::Transformer::Coerce::ParseIso8601DateTime#invoke
79
+ - Morpher::Evaluator::Transformer::Domain::AttributeHash::Dump#call
80
+ enabled: true
81
+ Attribute:
82
+ exclude: []
83
+ enabled: false
84
+ UncommunicativeVariableName:
85
+ accept: ['_']
86
+ exclude: []
87
+ enabled: true
88
+ reject:
89
+ - !ruby/regexp /^.$/
90
+ - !ruby/regexp /[0-9]$/
91
+ - !ruby/regexp /[A-Z]/
92
+ RepeatedConditional:
93
+ exclude: []
94
+ enabled: true
95
+ max_ifs: 2
96
+ DataClump:
97
+ exclude: []
98
+ enabled: true
99
+ max_copies: 1
100
+ min_clump_size: 3
101
+ ControlParameter:
102
+ exclude: []
103
+ enabled: true
104
+ LongYieldList:
105
+ max_params: 1
106
+ exclude: []
107
+ enabled: true
108
+ NilCheck:
109
+ exclude: []
@@ -0,0 +1,138 @@
1
+ inherit_from: ../.rubocop.yml
2
+
3
+ # Avoid parameter lists longer than five parameters.
4
+ ParameterLists:
5
+ Max: 3
6
+ CountKeywordArgs: true
7
+
8
+ # Avoid more than `Max` levels of nesting.
9
+ BlockNesting:
10
+ Max: 3
11
+
12
+ # Align with the style guide.
13
+ CollectionMethods:
14
+ PreferredMethods:
15
+ collect: 'map'
16
+ inject: 'reduce'
17
+ find: 'detect'
18
+ find_all: 'select'
19
+
20
+ # Do not force public/protected/private keyword to be indented at the same
21
+ # level as the def keyword. My personal preference is to outdent these keywords
22
+ # because I think when scanning code it makes it easier to identify the
23
+ # sections of code and visually separate them. When the keyword is at the same
24
+ # level I think it sort of blends in with the def keywords and makes it harder
25
+ # to scan the code and see where the sections are.
26
+ AccessModifierIndentation:
27
+ Enabled: false
28
+
29
+ # Limit line length
30
+ LineLength:
31
+ Max: 120
32
+
33
+ # Disable documentation checking until a class needs to be documented once
34
+ Documentation:
35
+ Enabled: false
36
+
37
+ # Do not always use &&/|| instead of and/or.
38
+ AndOr:
39
+ Enabled: false
40
+
41
+ # Do not favor modifier if/unless usage when you have a single-line body
42
+ IfUnlessModifier:
43
+ Enabled: false
44
+
45
+ # Allow case equality operator (in limited use within the specs)
46
+ CaseEquality:
47
+ Enabled: false
48
+
49
+ # Constants do not always have to use SCREAMING_SNAKE_CASE
50
+ ConstantName:
51
+ Enabled: false
52
+
53
+ # Not all trivial readers/writers can be defined with attr_* methods
54
+ TrivialAccessors:
55
+ Enabled: false
56
+
57
+ # Allow empty lines around class body
58
+ EmptyLinesAroundClassBody:
59
+ Enabled: false
60
+
61
+ # Allow empty lines around module body
62
+ EmptyLinesAroundModuleBody:
63
+ Enabled: false
64
+
65
+ # Allow empty lines around block body
66
+ EmptyLinesAroundBlockBody:
67
+ Enabled: false
68
+
69
+ # Allow multiple line operations to not require indentation
70
+ MultilineOperationIndentation:
71
+ Enabled: false
72
+
73
+ # Prefer String#% over Kernel#sprintf
74
+ FormatString:
75
+ Enabled: false
76
+
77
+ # Use square brackets for literal Array objects
78
+ PercentLiteralDelimiters:
79
+ PreferredDelimiters:
80
+ '%': '{}'
81
+ '%i': '[]'
82
+ '%q': ()
83
+ '%Q': ()
84
+ '%r': '{}'
85
+ '%s': ()
86
+ '%w': '[]'
87
+ '%W': '[]'
88
+ '%x': ()
89
+
90
+ # Use %i[...] for arrays of symbols
91
+ SymbolArray:
92
+ Enabled: true
93
+
94
+ # Align if/else blocks with the variable assignment
95
+ EndAlignment:
96
+ AlignWith: variable
97
+
98
+ # Do not always align parameters when it is easier to read
99
+ AlignParameters:
100
+ Exclude:
101
+ - spec/**/*_spec.rb
102
+
103
+ # Prefer #kind_of? over #is_a?
104
+ ClassCheck:
105
+ EnforcedStyle: kind_of?
106
+
107
+ # Do not prefer double quotes to be used when %q or %Q is more appropriate
108
+ UnneededPercentQ:
109
+ Enabled: false
110
+
111
+ # Allow a maximum ABC score
112
+ Metrics/AbcSize:
113
+ Max: 21.02
114
+
115
+ # Do not prefer lambda.call(...) over lambda.(...)
116
+ LambdaCall:
117
+ Enabled: false
118
+
119
+ # Buggy cop, returns false positive for our code base
120
+ NonLocalExitFromIterator:
121
+ Enabled: false
122
+
123
+ # To allow alignment of similar expressions we want to allow more than one
124
+ # space around operators:
125
+ #
126
+ # let(:a) { bar + something }
127
+ # let(:b) { foobar + something }
128
+ #
129
+ SpaceAroundOperators:
130
+ Enabled: false
131
+
132
+ # We use parallel assignments with great success
133
+ ParallelAssignment:
134
+ Enabled: false
135
+
136
+ # Allow additional specs
137
+ ExtraSpacing:
138
+ Enabled: false