reek 4.0.1 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/Gemfile +3 -3
  4. data/README.md +1 -1
  5. data/docs/Attribute.md +1 -1
  6. data/docs/Boolean-Parameter.md +8 -6
  7. data/docs/Class-Variable.md +1 -1
  8. data/docs/Command-Line-Options.md +26 -1
  9. data/docs/Control-Couple.md +13 -9
  10. data/docs/Control-Parameter.md +8 -5
  11. data/docs/Data-Clump.md +9 -7
  12. data/docs/Duplicate-Method-Call.md +1 -1
  13. data/docs/Irresponsible-Module.md +4 -3
  14. data/docs/Large-Class.md +7 -12
  15. data/docs/Long-Parameter-List.md +7 -6
  16. data/docs/Long-Yield-List.md +7 -6
  17. data/docs/Nested-Iterators.md +7 -7
  18. data/docs/Nil-Check.md +8 -4
  19. data/docs/Prima-Donna-Method.md +19 -9
  20. data/docs/Reek-Driven-Development.md +3 -1
  21. data/docs/Repeated-Conditional.md +5 -2
  22. data/docs/Too-Many-Instance-Variables.md +7 -7
  23. data/docs/Too-Many-Methods.md +10 -9
  24. data/docs/Too-Many-Statements.md +8 -4
  25. data/docs/Uncommunicative-Method-Name.md +8 -7
  26. data/docs/Uncommunicative-Module-Name.md +8 -8
  27. data/docs/Uncommunicative-Name.md +5 -3
  28. data/docs/Uncommunicative-Parameter-Name.md +9 -9
  29. data/docs/Uncommunicative-Variable-Name.md +8 -7
  30. data/docs/Unused-Parameters.md +5 -4
  31. data/docs/Unused-Private-Method.md +3 -3
  32. data/docs/Utility-Function.md +3 -3
  33. data/lib/reek/ast/object_refs.rb +4 -4
  34. data/lib/reek/cli/application.rb +40 -4
  35. data/lib/reek/cli/command/base_command.rb +3 -2
  36. data/lib/reek/cli/command/report_command.rb +35 -5
  37. data/lib/reek/cli/command/todo_list_command.rb +4 -4
  38. data/lib/reek/configuration/app_configuration.rb +15 -15
  39. data/lib/reek/configuration/default_directive.rb +2 -1
  40. data/lib/reek/context/code_context.rb +1 -1
  41. data/lib/reek/context/module_context.rb +5 -6
  42. data/lib/reek/spec.rb +6 -4
  43. data/lib/reek/spec/should_reek_of.rb +11 -3
  44. data/lib/reek/version.rb +1 -1
  45. data/spec/factories/factories.rb +0 -11
  46. data/spec/reek/cli/application_spec.rb +83 -9
  47. data/spec/reek/cli/command/report_command_spec.rb +17 -14
  48. data/spec/reek/cli/command/todo_list_command_spec.rb +12 -10
  49. data/spec/reek/smells/duplicate_method_call_spec.rb +8 -14
  50. data/spec/reek/smells/nested_iterators_spec.rb +12 -16
  51. data/spec/reek/smells/uncommunicative_method_name_spec.rb +2 -4
  52. data/spec/reek/smells/uncommunicative_module_name_spec.rb +2 -4
  53. data/spec/reek/smells/uncommunicative_parameter_name_spec.rb +2 -4
  54. data/spec/reek/smells/unused_private_method_spec.rb +47 -48
  55. data/spec/reek/smells/utility_function_spec.rb +5 -10
  56. data/spec/reek/spec/should_reek_of_spec.rb +27 -0
  57. metadata +2 -6
  58. data/lib/reek/cli/input.rb +0 -49
  59. data/lib/reek/cli/option_interpreter.rb +0 -58
  60. data/spec/reek/cli/input_spec.rb +0 -71
  61. data/spec/reek/cli/option_interpreter_spec.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d43b7fe788a2ad7e920eb34098cd2ac8eb9d399
4
- data.tar.gz: fbccb8b4b7020ca6e86a823f8da449560d417dd7
3
+ metadata.gz: 72d27c8901d22ffc65492d565e6c037d71f9f1e0
4
+ data.tar.gz: e358a34395daae66652468724f1794f4a8719d0a
5
5
  SHA512:
6
- metadata.gz: 1da698aa80dde3b094eb7d1a0d63090438b0fc0f4792f4f460e0949428c9c91397d7caf39ea20773a1cc44541794f66d2d8e57428a9cb0e74a4aead8d17719b5
7
- data.tar.gz: 9a5a2b29af8b5e69c31f04910a35f8109cda43195bd18a87bb00df6f674266c9f2bab86c348bf0b3fdbab6ee11d16680d412cec46a4c5fb55624306efa257dad
6
+ metadata.gz: d6ef752ab64fb5db0d0038e4a41405c261c1f9e6b9174e3b9b2b50062892fe78bcd5d1467ca0d392590e00a63ca33b25e1c6376cb59a2d37f989e12284e79951
7
+ data.tar.gz: 7daf1e81235a889917a06a737bab16996f0e2c51fbd3ab278869c7405c985821088e8d6071a0c79f573f725dd84bebd49b358327ea825314eee5769aca618a1d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change log
2
2
 
3
+ ## 4.0.2 (2016-04-23)
4
+
5
+ * (mvz) Stop UnusedPrivateMethod getting confused by nested classes
6
+ * (mvz) Implement and use ShouldReekOf#with_config
7
+ * (mvz) Automatically enable smell in reek_of matcher
8
+
3
9
  ## 4.0.1 (2016-04-10)
4
10
 
5
11
  * (thepry) Fix excluded paths for custom config formats.
data/Gemfile CHANGED
@@ -3,13 +3,13 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :development do
6
- gem 'aruba', '~> 0.12.0'
6
+ gem 'aruba', '~> 0.14.0'
7
7
  gem 'ataru', '~> 0.2.0'
8
8
  gem 'cucumber', '~> 2.0'
9
9
  gem 'factory_girl', '~> 4.0'
10
- gem 'rake', '~> 10.0'
10
+ gem 'rake', '~> 11.1'
11
11
  gem 'rspec', '~> 3.0'
12
- gem 'rubocop', '~> 0.37.0'
12
+ gem 'rubocop', '~> 0.39.0'
13
13
  gem 'yard', '~> 0.8.7'
14
14
  gem 'simplecov', '~> 0.11.1'
15
15
  gem 'mutant-rspec', '~> 0.8.8'
data/README.md CHANGED
@@ -19,7 +19,7 @@ Reek is a tool that examines Ruby classes, modules and methods and reports any
19
19
 
20
20
  For an excellent introduction to
21
21
  [Code Smells](docs/Code-Smells.md) and Reek check out [this blog post](https://blog.codeship.com/how-to-find-ruby-code-smells-with-reek/)
22
- or [that one](https://troessner.wordpress.com/2016/01/01/the-latest-and-greatest-additions-to-reek/). There is also [this talk](https://www.youtube.com/watch?v=ZzqOuHI5MkA) from the RUBYCONF Porto.
22
+ or [that one](https://troessner.wordpress.com/2016/01/01/the-latest-and-greatest-additions-to-reek/). There is also [this talk](https://www.youtube.com/watch?v=ZzqOuHI5MkA) from the [RubyConf Portugal](http://rubyconf.pt/).
23
23
 
24
24
  Install it via rubygems:
25
25
 
data/docs/Attribute.md CHANGED
@@ -36,4 +36,4 @@ Reek does not raise warnings for read-only attributes.
36
36
 
37
37
  ## Configuration
38
38
 
39
- `Attribute` supports only the [Basic Smell Options](Basic-Smell-Options.md).
39
+ _Attribute_ supports only the [Basic Smell Options](Basic-Smell-Options.md).
@@ -2,9 +2,11 @@
2
2
 
3
3
  ## Introduction
4
4
 
5
- `Boolean Parameter` is a special case of [Control Couple](Control-Couple.md), where a method parameter is defaulted
6
- to true or false. A _Boolean Parameter_ effectively permits a method's caller
7
- to decide which execution path to take. This is a case of bad cohesion. You're creating a dependency between methods that is not really necessary, thus increasing coupling.
5
+ _Boolean Parameter_ is a case of [Control Couple](Control-Couple.md), where a
6
+ method parameter is defaulted to true or false. A _Boolean Parameter_
7
+ effectively permits a method's caller to decide which execution path to take.
8
+ This is a case of bad cohesion. You're creating a dependency between methods
9
+ that is not really necessary, thus increasing coupling.
8
10
 
9
11
  ## Example
10
12
 
@@ -32,7 +34,7 @@ test.rb -- 3 warnings:
32
34
  [2]:Dummy#hit_the_switch is controlled by argument switch (ControlParameter)
33
35
  ```
34
36
 
35
- Note that both smells are reported, `Boolean Parameter` and `Control Parameter`.
37
+ Note that both smells are reported, _Boolean Parameter_ and _Control Parameter_.
36
38
 
37
39
  ## Getting rid of the smell
38
40
 
@@ -45,8 +47,8 @@ This is highly dependant on your exact architecture, but looking at the example
45
47
 
46
48
  ## Current support in Reek
47
49
 
48
- Reek can only detect a Boolean parameter when it has a default initializer like in the example above.
50
+ Reek can only detect a _Boolean Parameter_ when it has a default initializer like in the example above.
49
51
 
50
52
  ## Configuration
51
53
 
52
- `Boolean Parameter` supports the [Basic Smell Options](Basic-Smell-Options.md).
54
+ _Boolean Parameter_ supports the [Basic Smell Options](Basic-Smell-Options.md).
@@ -37,4 +37,4 @@ end
37
37
 
38
38
  ## Configuration
39
39
 
40
- `Class Variable` supports the [Basic Smell Options](Basic-Smell-Options.md).
40
+ _Class Variable_ supports the [Basic Smell Options](Basic-Smell-Options.md).
@@ -26,7 +26,7 @@ In general, if any command-line argument is a directory, Reek searches that dire
26
26
  reek lib
27
27
  ```
28
28
 
29
- would be equivalent to
29
+ would be equivalent to
30
30
 
31
31
  ```Bash
32
32
  reek lib/**/*.rb
@@ -38,6 +38,31 @@ Occasionally you may want to quickly check a code snippet without going to the t
38
38
  echo "def x() true end" | reek
39
39
  ```
40
40
 
41
+ To just check all Ruby files in the current directory, you can simply run it
42
+ with no parameters:
43
+
44
+ ```Bash
45
+ reek
46
+ ```
47
+
48
+ ## Telling Reek Which Smells to Detect
49
+
50
+ You can tell Reek to only check particular smells by using the `--smell`
51
+ option and passing in the smell name.
52
+
53
+ For example, to only check for [Utility Function](Utility-Function.md), you
54
+ would use:
55
+
56
+ ```Bash
57
+ reek --smell UtilityFunction
58
+ ```
59
+
60
+ You can select several smells by repeating the `--smell` option like so:
61
+
62
+ ```Bash
63
+ reek --smell UtilityFunction --smell UncommunicativeMethodName
64
+ ```
65
+
41
66
  ## Output options
42
67
 
43
68
  ### Output smell's line number
@@ -2,21 +2,25 @@
2
2
 
3
3
  ## Introduction
4
4
 
5
- Control coupling occurs when a method or block checks the value of a parameter in order to decide which execution path to take. The offending parameter is often called a `Control Couple`.
5
+ Control coupling occurs when a method or block checks the value of a parameter
6
+ in order to decide which execution path to take. The offending parameter is
7
+ often called a _Control Couple_.
6
8
 
7
9
  Control Coupling is a kind of duplication, because the calling method already knows which path should be taken.
8
10
 
9
- Control Coupling reduces the code's flexibility by creating a dependency between the caller and callee: any change to the possible values of the controlling parameter must be reflected on both sides of the call. A `Control Couple` also reveals a loss of simplicity: the called method probably has more than one responsibility, because it includes at least two different code paths.
11
+ Control Coupling reduces the code's flexibility by creating a dependency
12
+ between the caller and callee: any change to the possible values of the
13
+ controlling parameter must be reflected on both sides of the call. A _Control
14
+ Couple_ also reveals a loss of simplicity: the called method probably has more
15
+ than one responsibility, because it includes at least two different code paths.
10
16
 
11
17
  You can find a good write-up regarding this problem [here](http://solnic.eu/2012/04/11/get-rid-of-that-code-smell-control-couple.html).
12
18
 
13
19
  ## Current Support in Reek
14
20
 
15
- Reek warns about control coupling when:
21
+ Reek performs the following checks that fall in this category:
16
22
 
17
- * [Control-Parameter](Control-Parameter.md) - a method parameter or block parameter is the tested value in a conditional statement (as in the example below); or
18
- * [Boolean-Parameter](Boolean-Parameter.md) - a method parameter is defaulted to `true` or `false`.
19
-
20
- ## Configuration
21
-
22
- Control Couple supports the [Basic Smell Options](Basic-Smell-Options.md).
23
+ * [Control-Parameter](Control-Parameter.md) - a method parameter or block
24
+ parameter is the tested value in a conditional statement
25
+ * [Boolean-Parameter](Boolean-Parameter.md) - a method parameter is defaulted
26
+ to `true` or `false`.
@@ -2,11 +2,11 @@
2
2
 
3
3
  ## Introduction
4
4
 
5
- `Control Parameter` is a special case of [Control Couple](Control-Couple.md)
5
+ _Control Parameter_ is a case of [Control Couple](Control-Couple.md)
6
6
 
7
7
  ## Example
8
8
 
9
- A simple example would be the "quoted" parameter in the following method:
9
+ A simple example would be the `quoted` parameter in the following method:
10
10
 
11
11
  ```Ruby
12
12
  def write(quoted)
@@ -18,12 +18,15 @@ def write(quoted)
18
18
  end
19
19
  ```
20
20
 
21
- Fixing those problems is out of the scope of this document but an easy solution could be to remove the "write" method alltogether and to move the calls to "write_quoted" / "write_unquoted" in the initial caller of "write".
21
+ Fixing those problems is out of the scope of this document but an easy solution
22
+ could be to remove the `write` method altogether and to move the calls to
23
+ `write_quoted` and `write_unquoted` to the caller of `write`.
22
24
 
23
25
  ## Current Support in Reek
24
26
 
25
- Reek warns about control coupling when a method parameter or block parameter is the tested value in a conditional statement.
27
+ Reek warns about _Control Parameter_ when a method parameter or block parameter is
28
+ the tested value in a conditional statement.
26
29
 
27
30
  ## Configuration
28
31
 
29
- Control Couple supports the [Basic Smell Options](Basic-Smell-Options.md).
32
+ _Control Parameter_ supports the [Basic Smell Options](Basic-Smell-Options.md).
data/docs/Data-Clump.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  ## Introduction
4
4
 
5
- In general, a `Data Clump` occurs when the same two or three items frequently appear together in classes and parameter lists, or when a group of instance variable names start or end with similar substrings.
5
+ In general, a _Data Clump_ occurs when the same two or three items frequently
6
+ appear together in classes and parameter lists, or when a group of instance
7
+ variable names start or end with similar substrings.
6
8
 
7
9
  The recurrence of the items often means there is duplicate code spread around to handle them. There may be an abstraction missing from the code, making the system harder to understand.
8
10
 
@@ -27,7 +29,7 @@ test.rb -- 1 warning:
27
29
 
28
30
  A possible way to fix this problem (quoting from [Martin Fowler](http://martinfowler.com/bliki/DataClump.html)):
29
31
 
30
- >> The first step is to replace data clumps with objects and use the objects whenever you see them. An immediate benefit is that you'll shrink some parameter lists. The interesting stuff happens as you begin to look for behavior to move into the new objects.
32
+ > The first step is to replace data clumps with objects and use the objects whenever you see them. An immediate benefit is that you'll shrink some parameter lists. The interesting stuff happens as you begin to look for behavior to move into the new objects.
31
33
 
32
34
  ## Current Support in Reek
33
35
 
@@ -35,10 +37,10 @@ Reek looks for a group of two or more parameters with the same names that are ex
35
37
 
36
38
  ## Configuration
37
39
 
38
- Reek's Data Clump detector offers the [Basic Smell Options](Basic-Smell-Options.md), plus:
40
+ Reek's _Data Clump_ detector offers the [Basic Smell Options](Basic-Smell-Options.md), plus:
39
41
 
40
- | Option | Value | Effect |
41
- | ---------------|-------------|---------|
42
- | max_copies | integer | The maximum number of methods that are permitted to take the same group of parameters. Defaults to 2 |
43
- | min_clump_size | integer | The smallest number of parameters that can be reported as a clump. Defaults to 2 |
42
+ | Option | Value | Effect |
43
+ | -----------------|-------------|---------|
44
+ | `max_copies` | integer | The maximum number of methods that are permitted to take the same group of parameters. Defaults to 2. |
45
+ | `min_clump_size` | integer | The smallest number of parameters that can be reported as a clump. Defaults to 2. |
44
46
 
@@ -42,7 +42,7 @@ Reek's Duplicate Method Call detector checks for repeated identical method calls
42
42
 
43
43
  ## Configuration
44
44
 
45
- Reek's Duplication detector currently offers the [Basic Smell Options](Basic-Smell-Options.md), plus:
45
+ Reek's Duplicate Method Call detector currently offers the [Basic Smell Options](Basic-Smell-Options.md), plus:
46
46
 
47
47
  Option | Value | Effect
48
48
  -------|-------|-------
@@ -18,7 +18,7 @@ Reek would emit the following warning:
18
18
 
19
19
  ```
20
20
  test.rb -- 1 warning:
21
- [1]:Dummy has no descriptive comment (IrresponsibleModule)
21
+ [1]:IrresponsibleModule: Dummy has no descriptive comment
22
22
  ```
23
23
 
24
24
  Fixing this is simple - just an explaining comment:
@@ -32,8 +32,9 @@ end
32
32
 
33
33
  ## Current Support in Reek
34
34
 
35
- `Irresponsible Module` currently checks classes, but not modules.
35
+ _Irresponsible Module_ checks classes and modules, including those
36
+ created through `Struct.new` and `Class.new` and directly assigned to a constant.
36
37
 
37
38
  ## Configuration
38
39
 
39
- `Irresponsible Module` supports only the [Basic Smell Options](Basic-Smell-Options.md).
40
+ _Irresponsible Module_ supports only the [Basic Smell Options](Basic-Smell-Options.md).
data/docs/Large-Class.md CHANGED
@@ -2,19 +2,14 @@
2
2
 
3
3
  ## Introduction
4
4
 
5
- A `Large Class` is a class or module that has a large number of instance variables, methods or lines of code in any one piece of its specification. (That is, this smell relates to pieces of the class's specification, not to the size of the corresponding instance of `Class`.)
5
+ A _Large Class_ is a class or module that has a large number of instance
6
+ variables, methods or lines of code in any one piece of its specification.
7
+ (That is, this smell relates to pieces of the class's specification, not to the
8
+ size of the corresponding instance of `Class`.)
6
9
 
7
10
  ## Current Support in Reek
8
11
 
9
- `Large Class` reports classes having more than a configurable number of methods or instance variables. The method count includes public, protected and private methods, and excludes methods inherited from superclasses or included modules.
12
+ Reek offers two checks in this category.
10
13
 
11
- ## Configuration
12
-
13
- Reek's Large Class detector supports the [Basic Smell Options](Basic-Smell-Options.md), plus:
14
-
15
- | Option | Value | Effect |
16
- | ---------------|-------------|---------|
17
- | max_methods | integer | The maximum number of methods allowed in a class before a warning is issued. Defaults to 25. |
18
- | max_instance_variables | integer | The maximum number of instance variables allowed in a class before a warning is issued. Defaults to 9. |
19
-
20
- The `Large Class` detector is enabled whenever Reek is asked to check an instance of `Class` or `Module`.
14
+ * [Too Many Instance Variables](Too-Many-Instance-Variables.md)
15
+ * [Too Many Methods](Too-Many-Methods.md)
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Introduction
4
4
 
5
- A `Long Parameter List` occurs when a method has a lot of parameters.
5
+ A _Long Parameter List_ occurs when a method has a lot of parameters.
6
6
 
7
7
  ## Example
8
8
 
@@ -27,12 +27,13 @@ A common solution to this problem would be the introduction of parameter objects
27
27
 
28
28
  ## Current Support in Reek
29
29
 
30
- `Long Parameter List` reports any method or block with more than 3 parameters.
30
+ _Long Parameter List_ reports any method or block with more than 3 parameters.
31
31
 
32
32
  ## Configuration
33
33
 
34
- Reek's Long Parameter List detector supports the [Basic Smell Options](Basic-Smell-Options.md), plus:
34
+ Reek's _Long Parameter List_ detector supports the
35
+ [Basic Smell Options](Basic-Smell-Options.md), plus:
35
36
 
36
- | Option | Value | Effect |
37
- | ---------------|-------------|---------|
38
- | max_params | integer | The maximum number of parameters allowed in a method or block before a warning is issued. Defaults to 3. |
37
+ | Option | Value | Effect |
38
+ | -------------|---------|---------|
39
+ | `max_params` | integer | The maximum number of parameters allowed in a method or block before a warning is issued. Defaults to 3. |
@@ -2,7 +2,8 @@
2
2
 
3
3
  ## Introduction
4
4
 
5
- A _Long Yield List_ occurs when a method yields a lot of arguments to the block it gets passed.
5
+ A _Long Yield List_ occurs when a method yields a lot of arguments to the block
6
+ it gets passed. It is a special case of [Long Parameter List](Long-Parameter-List.md).
6
7
 
7
8
  ## Example
8
9
 
@@ -25,12 +26,12 @@ A common solution to this problem would be the introduction of parameter objects
25
26
 
26
27
  ## Current Support in Reek
27
28
 
28
- Currently Long Parameter List reports any method or block with more than 3 parameters.
29
+ Currently _Long Yield List_ reports any method or block with more than 3 parameters.
29
30
 
30
31
  ## Configuration
31
32
 
32
- Reek's Long Parameter List detector supports the [Basic Smell Options](Basic-Smell-Options.md), plus:
33
+ Reek's _Long Yield List_ detector supports the [Basic Smell Options](Basic-Smell-Options.md), plus:
33
34
 
34
- | Option | Value | Effect |
35
- | ---------------|-------------|---------|
36
- | max_params | integer | The maximum number of parameters allowed in a method or block before a warning is issued. Defaults to 3. |
35
+ | Option | Value | Effect |
36
+ | -------------|---------|---------|
37
+ | `max_params` | integer | The maximum number of parameters allowed in a method or block before a warning is issued. Defaults to 3. |
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Introduction
4
4
 
5
- A `Nested Iterator` occurs when a block contains another block.
5
+ A _Nested Iterator_ occurs when a block contains another block.
6
6
 
7
7
  ## Example
8
8
 
@@ -31,7 +31,7 @@ test.rb -- 1 warning:
31
31
 
32
32
  ## Current Support in Reek
33
33
 
34
- Nested Iterators reports failing methods only once.
34
+ _Nested Iterators_ reports failing methods only once.
35
35
  `Object#tap` is ignored by default and thus does not count as iterator.
36
36
  Furthermore iterators without block arguments are not counted, e.g.:
37
37
 
@@ -51,9 +51,9 @@ would not smell of NestedIterators (given a maximum allowed nesting of 1) since
51
51
 
52
52
  ## Configuration
53
53
 
54
- `Nested Iterators` offers the [Basic Smell Options](Basic-Smell-Options.md), plus:
54
+ _Nested Iterators_ offers the [Basic Smell Options](Basic-Smell-Options.md), plus:
55
55
 
56
- | Option | Value | Effect |
57
- | ---------------|-------------|---------|
58
- | max_allowed_nesting | integer | The maximum depth of nested iterators. Defaults to 1 |
59
- | ignore_iterators | Array | List of iterators to be excluded from the smell check. Includes only `tap` at the moment|
56
+ | Option | Value | Effect |
57
+ | ----------------------|---------|---------|
58
+ | `max_allowed_nesting` | integer | The maximum depth of nested iterators. Defaults to 1 |
59
+ | `ignore_iterators` | Array | List of iterators to be excluded from the smell check. Includes only `tap` at the moment|
data/docs/Nil-Check.md CHANGED
@@ -2,8 +2,12 @@
2
2
 
3
3
  ## Introduction
4
4
 
5
- A `NilCheck` is a type check. Failures of `NilCheck` violate the ["tell, don't ask"](http://robots.thoughtbot.com/tell-dont-ask) principle.
6
- Additionally to that, type checks often mask bigger problems in your source code like not using OOP and / or polymorphism when you should.
5
+ A _Nil Check_ is a type check. Failures of _Nil Check_ violate the
6
+ ["tell, don't ask"](http://robots.thoughtbot.com/tell-dont-ask) principle.
7
+ Additionally to that, type checks often mask bigger problems in your source
8
+ code like not using OOP and / or polymorphism when you should.
9
+
10
+ The _Nil Check_ code smell is a case of [Simulated Polymorphism](Simulated-Polymorphism.md).
7
11
 
8
12
  ## Example
9
13
 
@@ -28,7 +32,7 @@ test.rb -- 1 warning:
28
32
 
29
33
  ## Current Support in Reek
30
34
 
31
- `NilCheck` reports use of
35
+ _Nil Check_ reports use of
32
36
 
33
37
  * <code>.nil?</code> method
34
38
  * <code>==</code> and <code>===</code> operators when checking vs. <code>nil</code>
@@ -36,4 +40,4 @@ test.rb -- 1 warning:
36
40
 
37
41
  ## Configuration
38
42
 
39
- `Nil Check` offers the [Basic Smell Options](Basic-Smell-Options.md).
43
+ _Nil Check_ offers the [Basic Smell Options](Basic-Smell-Options.md).
@@ -2,15 +2,24 @@
2
2
 
3
3
  ## Introduction
4
4
 
5
- A candidate method for the `Prima Donna Method` smell are methods whose names end with an exclamation mark.
5
+ Candidate methods for the _Prima Donna Method_ smell are methods whose names
6
+ end with an exclamation mark.
6
7
 
7
- An exclamation mark in method names means (the explanation below is taken from [here](http://dablog.rubypal.com/2007/8/15/bang-methods-or-danger-will-rubyist) ):
8
+ An exclamation mark in method names means (the explanation below is taken from
9
+ [here](http://dablog.rubypal.com/2007/8/15/bang-methods-or-danger-will-rubyist)):
8
10
 
9
- >>
10
- The ! in method names that end with ! means, “This method is dangerous”—or, more precisely, this method is the “dangerous” version of an otherwise equivalent method, with the same name minus the !. “Danger” is relative; the ! doesn’t mean anything at all unless the method name it’s in corresponds to a similar but bang-less method name.
11
- So, for example, gsub! is the dangerous version of gsub. exit! is the dangerous version of exit. flatten! is the dangerous version of flatten. And so forth.
11
+ > The ! in method names that end with ! means, “This method is dangerous”—or,
12
+ > more precisely, this method is the “dangerous” version of an otherwise
13
+ > equivalent method, with the same name minus the !. “Danger” is relative; the
14
+ > ! doesn’t mean anything at all unless the method name it’s in corresponds to
15
+ > a similar but bang-less method name.
16
+ >
17
+ > So, for example, gsub! is the dangerous version of gsub. exit! is the
18
+ > dangerous version of exit. flatten! is the dangerous version of flatten. And
19
+ > so forth.
12
20
 
13
- Such a method is called `Prima Donna Method` if and only if her non-bang version does not exist and this method is reported as a smell.
21
+ Such a method is called _Prima Donna Method_ if and only if her non-bang
22
+ version does not exist and this method is reported as a smell.
14
23
 
15
24
  ## Example
16
25
 
@@ -24,7 +33,7 @@ class C
24
33
  end
25
34
  ```
26
35
 
27
- Reek would report `bar!` as `prima donna method` smell but not `foo!`.
36
+ Reek would report the _Prima Donna Method_ smell for `bar!`, but not for `foo!`.
28
37
 
29
38
  Reek reports this smell only in a class context, not in a module context in order to allow perfectly legit code like this:
30
39
 
@@ -46,8 +55,9 @@ class Daughter < Parent
46
55
  end
47
56
  ```
48
57
 
49
- In this example, Reek would not report the `prima donna method` smell for the method `foo` of the `Dangerous` module.
58
+ In this example, Reek would not report the _Prima Donna Method_ smell for the
59
+ method `foo` of the `Dangerous` module.
50
60
 
51
61
  ## Configuration
52
62
 
53
- `Prima Donna Method` offers the [Basic Smell Options](Basic-Smell-Options.md).
63
+ _Prima Donna Method_ offers the [Basic Smell Options](Basic-Smell-Options.md).