reek 2.1.0 → 2.2.0

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.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -21
  3. data/.travis.yml +1 -0
  4. data/.yardopts +3 -6
  5. data/CHANGELOG +6 -0
  6. data/CONTRIBUTING.md +8 -3
  7. data/README.md +94 -42
  8. data/config/defaults.reek +0 -1
  9. data/docs/API.md +50 -0
  10. data/docs/Attribute.md +43 -0
  11. data/docs/Basic-Smell-Options.md +44 -0
  12. data/docs/Boolean-Parameter.md +52 -0
  13. data/docs/Class-Variable.md +40 -0
  14. data/docs/Code-Smells.md +34 -0
  15. data/docs/Command-Line-Options.md +84 -0
  16. data/docs/Configuration-Files.md +38 -0
  17. data/docs/Control-Couple.md +22 -0
  18. data/docs/Control-Parameter.md +29 -0
  19. data/docs/Data-Clump.md +44 -0
  20. data/docs/Duplicate-Method-Call.md +49 -0
  21. data/docs/Feature-Envy.md +29 -0
  22. data/docs/How-reek-works-internally.md +44 -0
  23. data/docs/Irresponsible-Module.md +39 -0
  24. data/docs/Large-Class.md +20 -0
  25. data/docs/Long-Parameter-List.md +38 -0
  26. data/docs/Long-Yield-List.md +36 -0
  27. data/docs/Module-Initialize.md +62 -0
  28. data/docs/Nested-Iterators.md +38 -0
  29. data/docs/Nil-Check.md +39 -0
  30. data/docs/Prima-Donna-Method.md +53 -0
  31. data/docs/RSpec-matchers.md +133 -0
  32. data/docs/Rake-Task.md +58 -0
  33. data/docs/Reek-Driven-Development.md +45 -0
  34. data/docs/Repeated-Conditional.md +44 -0
  35. data/docs/Simulated-Polymorphism.md +16 -0
  36. data/docs/Smell-Suppression.md +32 -0
  37. data/docs/Too-Many-Instance-Variables.md +43 -0
  38. data/docs/Too-Many-Methods.md +55 -0
  39. data/docs/Too-Many-Statements.md +50 -0
  40. data/docs/Uncommunicative-Method-Name.md +24 -0
  41. data/docs/Uncommunicative-Module-Name.md +23 -0
  42. data/docs/Uncommunicative-Name.md +16 -0
  43. data/docs/Uncommunicative-Parameter-Name.md +24 -0
  44. data/docs/Uncommunicative-Variable-Name.md +24 -0
  45. data/docs/Unused-Parameters.md +27 -0
  46. data/docs/Utility-Function.md +46 -0
  47. data/docs/Versioning-Policy.md +7 -0
  48. data/docs/YAML-Reports.md +111 -0
  49. data/docs/yard_plugin.rb +14 -0
  50. data/features/command_line_interface/options.feature +1 -0
  51. data/features/programmatic_access.feature +1 -1
  52. data/features/samples.feature +3 -3
  53. data/lib/reek.rb +2 -2
  54. data/lib/reek/cli/input.rb +2 -2
  55. data/lib/reek/cli/option_interpreter.rb +2 -0
  56. data/lib/reek/cli/options.rb +10 -4
  57. data/lib/reek/cli/reek_command.rb +2 -2
  58. data/lib/reek/cli/report/report.rb +60 -0
  59. data/lib/reek/cli/silencer.rb +13 -0
  60. data/lib/reek/{source → core}/ast_node.rb +1 -1
  61. data/lib/reek/{source → core}/ast_node_class_map.rb +10 -11
  62. data/lib/reek/{source → core}/code_comment.rb +1 -1
  63. data/lib/reek/core/code_context.rb +1 -1
  64. data/lib/reek/core/examiner.rb +85 -0
  65. data/lib/reek/core/method_context.rb +1 -1
  66. data/lib/reek/core/module_context.rb +2 -2
  67. data/lib/reek/core/reference_collector.rb +31 -0
  68. data/lib/reek/core/singleton_method_context.rb +0 -4
  69. data/lib/reek/core/smell_repository.rb +4 -2
  70. data/lib/reek/{source → core}/tree_dresser.rb +1 -1
  71. data/lib/reek/{source → sexp}/sexp_extensions.rb +5 -5
  72. data/lib/reek/sexp/sexp_formatter.rb +29 -0
  73. data/lib/reek/sexp/sexp_node.rb +91 -0
  74. data/lib/reek/smells.rb +4 -2
  75. data/lib/reek/smells/attribute.rb +35 -7
  76. data/lib/reek/smells/boolean_parameter.rb +1 -1
  77. data/lib/reek/smells/class_variable.rb +1 -1
  78. data/lib/reek/smells/control_parameter.rb +1 -1
  79. data/lib/reek/smells/data_clump.rb +1 -1
  80. data/lib/reek/smells/duplicate_method_call.rb +12 -4
  81. data/lib/reek/smells/feature_envy.rb +1 -1
  82. data/lib/reek/smells/irresponsible_module.rb +3 -3
  83. data/lib/reek/smells/long_parameter_list.rb +1 -1
  84. data/lib/reek/smells/long_yield_list.rb +1 -1
  85. data/lib/reek/smells/module_initialize.rb +1 -1
  86. data/lib/reek/smells/nested_iterators.rb +1 -1
  87. data/lib/reek/smells/nil_check.rb +3 -2
  88. data/lib/reek/smells/prima_donna_method.rb +18 -11
  89. data/lib/reek/smells/repeated_conditional.rb +3 -3
  90. data/lib/reek/smells/smell_detector.rb +5 -1
  91. data/lib/reek/smells/smell_warning.rb +99 -0
  92. data/lib/reek/smells/too_many_instance_variables.rb +1 -1
  93. data/lib/reek/smells/too_many_methods.rb +1 -1
  94. data/lib/reek/smells/too_many_statements.rb +1 -1
  95. data/lib/reek/smells/uncommunicative_method_name.rb +1 -1
  96. data/lib/reek/smells/uncommunicative_module_name.rb +1 -1
  97. data/lib/reek/smells/uncommunicative_parameter_name.rb +1 -1
  98. data/lib/reek/smells/uncommunicative_variable_name.rb +1 -1
  99. data/lib/reek/smells/unused_parameters.rb +1 -1
  100. data/lib/reek/smells/utility_function.rb +3 -16
  101. data/lib/reek/source/source_code.rb +31 -13
  102. data/lib/reek/source/source_locator.rb +16 -17
  103. data/lib/reek/source/source_repository.rb +10 -11
  104. data/lib/reek/spec/should_reek.rb +2 -2
  105. data/lib/reek/spec/should_reek_of.rb +2 -2
  106. data/lib/reek/spec/should_reek_only_of.rb +2 -2
  107. data/lib/reek/version.rb +1 -1
  108. data/reek.gemspec +3 -4
  109. data/spec/factories/factories.rb +1 -1
  110. data/spec/gem/yard_spec.rb +1 -1
  111. data/spec/quality/reek_source_spec.rb +2 -2
  112. data/spec/reek/cli/html_report_spec.rb +3 -3
  113. data/spec/reek/cli/json_report_spec.rb +3 -3
  114. data/spec/reek/cli/{option_interperter_spec.rb → option_interpreter_spec.rb} +1 -1
  115. data/spec/reek/cli/options_spec.rb +19 -0
  116. data/spec/reek/cli/text_report_spec.rb +7 -7
  117. data/spec/reek/cli/xml_report_spec.rb +34 -0
  118. data/spec/reek/cli/yaml_report_spec.rb +3 -3
  119. data/spec/reek/configuration/app_configuration_spec.rb +1 -1
  120. data/spec/reek/configuration/configuration_file_finder_spec.rb +22 -1
  121. data/spec/reek/{source → core}/code_comment_spec.rb +14 -14
  122. data/spec/reek/core/code_context_spec.rb +1 -1
  123. data/spec/reek/{examiner_spec.rb → core/examiner_spec.rb} +12 -12
  124. data/spec/reek/core/method_context_spec.rb +27 -22
  125. data/spec/reek/core/module_context_spec.rb +2 -2
  126. data/spec/reek/core/object_refs_spec.rb +1 -1
  127. data/spec/reek/{source → core}/object_source_spec.rb +1 -1
  128. data/spec/reek/{source → core}/reference_collector_spec.rb +25 -16
  129. data/spec/reek/core/singleton_method_context_spec.rb +12 -2
  130. data/spec/reek/core/smell_configuration_spec.rb +1 -1
  131. data/spec/reek/core/smell_repository_spec.rb +12 -1
  132. data/spec/reek/core/stop_context_spec.rb +1 -1
  133. data/spec/reek/core/tree_dresser_spec.rb +16 -0
  134. data/spec/reek/core/tree_walker_spec.rb +3 -3
  135. data/spec/reek/core/warning_collector_spec.rb +6 -6
  136. data/spec/reek/{source → sexp}/sexp_extensions_spec.rb +8 -8
  137. data/spec/reek/{source → sexp}/sexp_formatter_spec.rb +11 -5
  138. data/spec/reek/{source → sexp}/sexp_node_spec.rb +3 -3
  139. data/spec/reek/smells/attribute_spec.rb +89 -85
  140. data/spec/reek/smells/behaves_like_variable_detector.rb +1 -1
  141. data/spec/reek/smells/boolean_parameter_spec.rb +1 -1
  142. data/spec/reek/smells/class_variable_spec.rb +1 -1
  143. data/spec/reek/smells/control_parameter_spec.rb +1 -1
  144. data/spec/reek/smells/data_clump_spec.rb +2 -2
  145. data/spec/reek/smells/duplicate_method_call_spec.rb +1 -1
  146. data/spec/reek/smells/feature_envy_spec.rb +2 -2
  147. data/spec/reek/smells/irresponsible_module_spec.rb +1 -1
  148. data/spec/reek/smells/long_parameter_list_spec.rb +2 -2
  149. data/spec/reek/smells/long_yield_list_spec.rb +1 -1
  150. data/spec/reek/smells/module_initialize_spec.rb +1 -1
  151. data/spec/reek/smells/nested_iterators_spec.rb +2 -2
  152. data/spec/reek/smells/nil_check_spec.rb +1 -1
  153. data/spec/reek/smells/prima_donna_method_spec.rb +1 -1
  154. data/spec/reek/smells/repeated_conditional_spec.rb +1 -1
  155. data/spec/reek/smells/smell_detector_shared.rb +2 -2
  156. data/spec/reek/{smell_warning_spec.rb → smells/smell_warning_spec.rb} +7 -7
  157. data/spec/reek/smells/too_many_instance_variables_spec.rb +1 -1
  158. data/spec/reek/smells/too_many_methods_spec.rb +1 -1
  159. data/spec/reek/smells/too_many_statements_spec.rb +4 -4
  160. data/spec/reek/smells/uncommunicative_method_name_spec.rb +1 -1
  161. data/spec/reek/smells/uncommunicative_module_name_spec.rb +1 -1
  162. data/spec/reek/smells/uncommunicative_parameter_name_spec.rb +1 -1
  163. data/spec/reek/smells/uncommunicative_variable_name_spec.rb +1 -1
  164. data/spec/reek/smells/unused_parameters_spec.rb +1 -1
  165. data/spec/reek/smells/utility_function_spec.rb +1 -1
  166. data/spec/reek/source/source_code_spec.rb +1 -1
  167. data/spec/reek/spec/should_reek_of_spec.rb +1 -1
  168. data/spec/reek/spec/should_reek_only_of_spec.rb +1 -1
  169. data/spec/reek/spec/should_reek_spec.rb +1 -1
  170. data/spec/samples/checkstyle.xml +2 -0
  171. data/spec/spec_helper.rb +15 -3
  172. metadata +68 -38
  173. data/.ruby-gemset +0 -1
  174. data/lib/reek/examiner.rb +0 -79
  175. data/lib/reek/smell_warning.rb +0 -87
  176. data/lib/reek/source/reference_collector.rb +0 -27
  177. data/lib/reek/source/sexp_formatter.rb +0 -22
  178. data/lib/reek/source/sexp_node.rb +0 -79
  179. data/spec/reek/source/tree_dresser_spec.rb +0 -16
@@ -1,5 +1,4 @@
1
1
  require_relative 'smell_detector'
2
- require_relative '../smell_warning'
3
2
 
4
3
  module Reek
5
4
  module Smells
@@ -10,6 +9,7 @@ module Reek
10
9
  # +TooManyInstanceVariables' reports classes having more than a
11
10
  # configurable number of instance variables.
12
11
  #
12
+ # See docs/Too-Many-Instance-Variables for details.
13
13
  class TooManyInstanceVariables < SmellDetector
14
14
  # The name of the config field that sets the maximum number of instance
15
15
  # variables permitted in a class.
@@ -1,5 +1,4 @@
1
1
  require_relative 'smell_detector'
2
- require_relative '../smell_warning'
3
2
 
4
3
  module Reek
5
4
  module Smells
@@ -12,6 +11,7 @@ module Reek
12
11
  # methods, and excludes methods inherited from superclasses or included
13
12
  # modules.
14
13
  #
14
+ # See docs/Too-Many-Methods for details.
15
15
  class TooManyMethods < SmellDetector
16
16
  # The name of the config field that sets the maximum number of methods
17
17
  # permitted in a class.
@@ -1,5 +1,4 @@
1
1
  require_relative 'smell_detector'
2
- require_relative '../smell_warning'
3
2
 
4
3
  module Reek
5
4
  module Smells
@@ -8,6 +7,7 @@ module Reek
8
7
  #
9
8
  # +TooManyStatements+ reports any method with more than 5 statements.
10
9
  #
10
+ # See docs/Too-Many-Statements for details.
11
11
  class TooManyStatements < SmellDetector
12
12
  # The name of the config field that sets the maximum number of
13
13
  # statements permitted in any method.
@@ -1,5 +1,4 @@
1
1
  require_relative 'smell_detector'
2
- require_relative '../smell_warning'
3
2
 
4
3
  module Reek
5
4
  module Smells
@@ -16,6 +15,7 @@ module Reek
16
15
  # * 1-character names
17
16
  # * names ending with a number
18
17
  #
18
+ # See docs/Uncommunicative-Method-Name for details.
19
19
  class UncommunicativeMethodName < SmellDetector
20
20
  # The name of the config field that lists the regexps of
21
21
  # smelly names to be reported.
@@ -1,5 +1,4 @@
1
1
  require_relative 'smell_detector'
2
- require_relative '../smell_warning'
3
2
 
4
3
  module Reek
5
4
  module Smells
@@ -16,6 +15,7 @@ module Reek
16
15
  # * 1-character names
17
16
  # * names ending with a number
18
17
  #
18
+ # See docs/Uncommunicative-Module-Name for details.
19
19
  class UncommunicativeModuleName < SmellDetector
20
20
  # The name of the config field that lists the regexps of
21
21
  # smelly names to be reported.
@@ -1,5 +1,4 @@
1
1
  require_relative 'smell_detector'
2
- require_relative '../smell_warning'
3
2
 
4
3
  module Reek
5
4
  module Smells
@@ -16,6 +15,7 @@ module Reek
16
15
  # * 1-character names
17
16
  # * names ending with a number
18
17
  #
18
+ # See docs/Uncommunicative-Parameter-Name for details.
19
19
  class UncommunicativeParameterName < SmellDetector
20
20
  # The name of the config field that lists the regexps of
21
21
  # smelly names to be reported.
@@ -1,5 +1,4 @@
1
1
  require_relative 'smell_detector'
2
- require_relative '../smell_warning'
3
2
 
4
3
  module Reek
5
4
  module Smells
@@ -16,6 +15,7 @@ module Reek
16
15
  # * 1-character names
17
16
  # * names ending with a number
18
17
  #
18
+ # See docs/Uncommunicative-Variable-Name for details.
19
19
  class UncommunicativeVariableName < SmellDetector
20
20
  # The name of the config field that lists the regexps of
21
21
  # smelly names to be reported.
@@ -1,11 +1,11 @@
1
1
  require_relative 'smell_detector'
2
- require_relative '../smell_warning'
3
2
 
4
3
  module Reek
5
4
  module Smells
6
5
  #
7
6
  # Methods should use their parameters.
8
7
  #
8
+ # See docs/Unused-Parameters for details.
9
9
  class UnusedParameters < SmellDetector
10
10
  def self.smell_category
11
11
  'UnusedCode'
@@ -1,6 +1,5 @@
1
1
  require_relative 'smell_detector'
2
- require_relative '../smell_warning'
3
- require_relative '../source/reference_collector'
2
+ require_relative '../core/reference_collector'
4
3
 
5
4
  module Reek
6
5
  module Smells
@@ -35,14 +34,8 @@ module Reek
35
34
  # If the method does refer to self, but refers to some other object more,
36
35
  # +FeatureEnvy+ is reported instead.
37
36
  #
37
+ # See docs/Utility-Function for details.
38
38
  class UtilityFunction < SmellDetector
39
- # The name of the config field that sets the maximum number of
40
- # calls permitted within a helper method. Any method with more than
41
- # this number of method calls on other objects will be considered a
42
- # candidate Utility Function.
43
- HELPER_CALLS_LIMIT_KEY = 'max_helper_calls'
44
- DEFAULT_HELPER_CALLS_LIMIT = 0
45
-
46
39
  def self.smell_category
47
40
  'LowCohesion'
48
41
  end
@@ -51,10 +44,6 @@ module Reek
51
44
  def contexts # :nodoc:
52
45
  [:def]
53
46
  end
54
-
55
- def default_config
56
- super.merge(HELPER_CALLS_LIMIT_KEY => DEFAULT_HELPER_CALLS_LIMIT)
57
- end
58
47
  end
59
48
 
60
49
  #
@@ -65,9 +54,7 @@ module Reek
65
54
  def examine_context(method_ctx)
66
55
  return [] if method_ctx.num_statements == 0
67
56
  return [] if method_ctx.references_self?
68
- return [] if num_helper_methods(method_ctx) <= value(HELPER_CALLS_LIMIT_KEY,
69
- method_ctx,
70
- DEFAULT_HELPER_CALLS_LIMIT)
57
+ return [] if num_helper_methods(method_ctx).zero?
71
58
 
72
59
  [SmellWarning.new(self,
73
60
  context: method_ctx.full_name,
@@ -1,8 +1,9 @@
1
- old_verbose, $VERBOSE = $VERBOSE, nil
2
- require 'parser/current'
3
- $VERBOSE = old_verbose
4
- require_relative 'tree_dresser'
5
- require_relative 'ast_node'
1
+ require_relative '../cli/silencer'
2
+ Reek::CLI::Silencer.silently do
3
+ require 'parser/current'
4
+ end
5
+ require_relative '../core/tree_dresser'
6
+ require_relative '../core/ast_node'
6
7
 
7
8
  module Reek
8
9
  module Source
@@ -10,14 +11,28 @@ module Reek
10
11
  # A +Source+ object represents a chunk of Ruby source code.
11
12
  #
12
13
  class SourceCode
13
- attr_reader :desc
14
+ attr_reader :description
14
15
 
15
- def initialize(code, desc, parser = Parser::Ruby21)
16
- @source = code
17
- @desc = desc
18
- @parser = parser
16
+ # Initializer.
17
+ #
18
+ # code - ruby code as String
19
+ # description - in case of STDIN this is "STDIN" otherwise it's a filepath as String
20
+ # parser - the parser to use for generating AST's out of the given source
21
+ def initialize(code, description, parser = Parser::Ruby21)
22
+ @source = code
23
+ @description = description
24
+ @parser = parser
19
25
  end
20
26
 
27
+ # Initializes an instance of SourceCode given a source.
28
+ # This source can come via 3 different ways:
29
+ # - from files a la `reek lib/reek/`
30
+ # - from IO (STDIN) a la `echo "class Foo; end" | reek`
31
+ # - from String via our rspec matchers a la `expect("class Foo; end").to reek`
32
+ #
33
+ # source - One of File|IO|String
34
+ #
35
+ # Returns an instance of SourceCode
21
36
  def self.from(source)
22
37
  case source
23
38
  when File then new(source.read, source.path)
@@ -26,17 +41,20 @@ module Reek
26
41
  end
27
42
  end
28
43
 
44
+ # Parses the given source into an AST.
45
+ #
46
+ # @return [Reek::Core::ASTNode] the AST presentation of the given source
29
47
  def syntax_tree
30
48
  @syntax_tree ||=
31
49
  begin
32
50
  begin
33
- ast, comments = @parser.parse_with_comments(@source, @desc)
51
+ ast, comments = @parser.parse_with_comments(@source, @description)
34
52
  rescue Racc::ParseError, Parser::SyntaxError => error
35
- $stderr.puts "#{desc}: #{error.class.name}: #{error}"
53
+ $stderr.puts "#{description}: #{error.class.name}: #{error}"
36
54
  end
37
55
 
38
56
  comment_map = Parser::Source::Comment.associate(ast, comments) if ast
39
- TreeDresser.new.dress(ast, comment_map)
57
+ Core::TreeDresser.new.dress(ast, comment_map)
40
58
  end
41
59
  end
42
60
  end
@@ -4,36 +4,35 @@ module Reek
4
4
  # Finds Ruby source files in a filesystem.
5
5
  #
6
6
  class SourceLocator
7
+ # Initialize with the paths we want to search.
8
+ #
9
+ # paths - a list of paths as Strings
7
10
  def initialize(paths)
8
11
  @paths = paths.map { |path| path.chomp('/') }
9
12
  end
10
13
 
11
- def all_sources
12
- valid_paths.map { |path| Source::SourceCode.from File.new(path) }
14
+ # Traverses all paths we initialized the SourceLocator with, finds
15
+ # all relevant ruby files and returns them as a list.
16
+ #
17
+ # Returns a list of Source::SourceCode.
18
+ def sources
19
+ find_sources.map { |pathname| Source::SourceCode.from File.new(pathname) }
13
20
  end
14
21
 
15
22
  private
16
23
 
17
- def all_ruby_source_files(paths)
24
+ def find_sources(paths = @paths)
18
25
  paths.map do |path|
19
- if test 'd', path
20
- all_ruby_source_files(Dir["#{path}/**/*.rb"])
26
+ pathname = Pathname.new(path)
27
+ if pathname.directory?
28
+ find_sources(Dir["#{pathname}/**/*.rb"])
21
29
  else
22
- path
30
+ next pathname if pathname.file?
31
+ $stderr.puts "Error: No such file - #{pathname}"
32
+ nil
23
33
  end
24
34
  end.flatten.sort
25
35
  end
26
-
27
- def valid_paths
28
- all_ruby_source_files(@paths).select do |path|
29
- if test 'f', path
30
- true
31
- else
32
- $stderr.puts "Error: No such file - #{path}"
33
- false
34
- end
35
- end
36
- end
37
36
  end
38
37
  end
39
38
  end
@@ -9,6 +9,13 @@ module Reek
9
9
  # single unit of Ruby source code.
10
10
  #
11
11
  class SourceRepository
12
+ attr_reader :description
13
+
14
+ def initialize(description, sources)
15
+ @description = description
16
+ @sources = sources
17
+ end
18
+
12
19
  # TODO: This method is a least partially broken.
13
20
  # Regardless of how you call reek, be it:
14
21
  # reek lib/
@@ -19,23 +26,15 @@ module Reek
19
26
  def self.parse(source)
20
27
  case source
21
28
  when Array
22
- new 'dir', Source::SourceLocator.new(source).all_sources
29
+ new 'dir', Source::SourceLocator.new(source).sources
23
30
  when Source::SourceCode
24
- new source.desc, [source]
31
+ new source.description, [source]
25
32
  else
26
33
  src = Source::SourceCode.from source
27
- new src.desc, [src]
34
+ new src.description, [src]
28
35
  end
29
36
  end
30
37
 
31
- include Enumerable
32
- attr_reader :description
33
-
34
- def initialize(description, sources)
35
- @description = description
36
- @sources = sources
37
- end
38
-
39
38
  def each(&block)
40
39
  @sources.each(&block)
41
40
  end
@@ -1,4 +1,4 @@
1
- require_relative '../examiner'
1
+ require_relative '../core/examiner'
2
2
  require_relative '../cli/report/formatter'
3
3
 
4
4
  module Reek
@@ -8,7 +8,7 @@ module Reek
8
8
  #
9
9
  class ShouldReek # :nodoc:
10
10
  def matches?(actual)
11
- @examiner = Examiner.new(actual)
11
+ @examiner = Core::Examiner.new(actual)
12
12
  @examiner.smelly?
13
13
  end
14
14
 
@@ -1,4 +1,4 @@
1
- require_relative '../examiner'
1
+ require_relative '../core/examiner'
2
2
 
3
3
  module Reek
4
4
  module Spec
@@ -13,7 +13,7 @@ module Reek
13
13
  end
14
14
 
15
15
  def matches?(actual)
16
- @examiner = Examiner.new(actual)
16
+ @examiner = Core::Examiner.new(actual)
17
17
  @all_smells = @examiner.smells
18
18
  @all_smells.any? { |warning| warning.matches?(@smell_category, @smell_details) }
19
19
  end
@@ -1,4 +1,4 @@
1
- require_relative '../examiner'
1
+ require_relative '../core/examiner'
2
2
  require_relative '../cli/report/formatter'
3
3
 
4
4
  module Reek
@@ -9,7 +9,7 @@ module Reek
9
9
  #
10
10
  class ShouldReekOnlyOf < ShouldReekOf
11
11
  def matches?(actual)
12
- matches_examiner?(Examiner.new(actual))
12
+ matches_examiner?(Core::Examiner.new(actual))
13
13
  end
14
14
 
15
15
  def matches_examiner?(examiner)
data/lib/reek/version.rb CHANGED
@@ -3,6 +3,6 @@ module Reek
3
3
  # This module holds the Reek version informations
4
4
  #
5
5
  module Version
6
- STRING = '2.1.0'
6
+ STRING = '2.2.0'
7
7
  end
8
8
  end
data/reek.gemspec CHANGED
@@ -22,10 +22,9 @@ Gem::Specification.new do |s|
22
22
  s.required_ruby_version = '>= 1.9.3'
23
23
  s.summary = 'Code smell detector for Ruby'
24
24
 
25
- s.add_runtime_dependency 'parser', '~> 2.2'
26
- s.add_runtime_dependency 'rainbow', '~> 2.0'
27
- s.add_runtime_dependency 'require_all', '~> 1.3'
28
- s.add_runtime_dependency 'unparser', '~> 0.2.2'
25
+ s.add_runtime_dependency 'parser', '~> 2.2'
26
+ s.add_runtime_dependency 'rainbow', '~> 2.0'
27
+ s.add_runtime_dependency 'unparser', '~> 0.2.2'
29
28
 
30
29
  s.add_development_dependency 'activesupport', '~> 4.2'
31
30
  s.add_development_dependency 'aruba', '~> 0.6.2'
@@ -13,7 +13,7 @@ FactoryGirl.define do
13
13
  end
14
14
  end
15
15
 
16
- factory :smell_warning, class: Reek::SmellWarning do
16
+ factory :smell_warning, class: Reek::Smells::SmellWarning do
17
17
  skip_create
18
18
  smell_detector
19
19
  context 'self'
@@ -1,7 +1,7 @@
1
1
  require_relative '../spec_helper'
2
2
  require 'tempfile'
3
3
 
4
- describe 'yardoc' do
4
+ RSpec.describe 'yardoc' do
5
5
  before :each do
6
6
  stderr_file = Tempfile.new('yardoc')
7
7
  stderr_file.close
@@ -1,7 +1,7 @@
1
1
  require_relative '../spec_helper'
2
2
 
3
- describe 'Reek source code' do
3
+ RSpec.describe 'Reek source code' do
4
4
  it 'has no smells' do
5
- Dir['lib/**/*.rb'].should_not reek
5
+ expect(Dir['lib/**/*.rb']).to_not reek
6
6
  end
7
7
  end
@@ -1,12 +1,12 @@
1
1
  require_relative '../../spec_helper'
2
- require_relative '../../../lib/reek/examiner'
2
+ require_relative '../../../lib/reek/core/examiner'
3
3
  require_relative '../../../lib/reek/cli/report/report'
4
4
 
5
- describe Reek::CLI::Report::HTMLReport do
5
+ RSpec.describe Reek::CLI::Report::HTMLReport do
6
6
  let(:instance) { Reek::CLI::Report::HTMLReport.new }
7
7
 
8
8
  context 'with an empty source' do
9
- let(:examiner) { Reek::Examiner.new('') }
9
+ let(:examiner) { Reek::Core::Examiner.new('') }
10
10
 
11
11
  before do
12
12
  instance.add_examiner examiner