teksymmetry-reek 1.1.3.1 → 1.1.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,41 @@
1
+ h3. Reek
2
+
3
+ Code smell detection for Ruby.
4
+
5
+ The documentation is at http://wiki.github.com/kevinrutherford/reek
6
+ The code lives at http://github.com/kevinrutherford/reek/tree
7
+
8
+
9
+ h3. How to use Uncommunicative name verifier extension ?
10
+
11
+ # Create your configuration reek file under your source base (RAILS_ROOT/app/app.reek)
12
+
13
+ # Add the following configurations -
14
+ <pre>
15
+ UncommunicativeName:
16
+ verifierExtention:
17
+ - <path to your ruby script file>
18
+ </pre>
19
+ example - .
20
+ <pre>
21
+ UncommunicativeName:
22
+ verifierExtention:
23
+ - config/smells/strict_uncommunicative_variable_name_verifier
24
+ </pre>
25
+
26
+ # Remember ruby class name and file name must be similar,
27
+ Use "_" for separating different words. ie SimpleVerifier => simple_verifier.rb
28
+
29
+ # Write following class -
30
+ <pre>
31
+ class StrictUncommunicativeVariableNameVerifier
32
+ def accepted?(p_context, p_variable_name)
33
+ # do stuffs with variable name
34
+ # if it match your requirement
35
+ # return true, nil
36
+ # otherwise
37
+ # return false, "error message"
38
+ end
39
+ end
40
+ </pre>
41
+
@@ -0,0 +1,53 @@
1
+ require 'rubygems'
2
+ require 'activesupport'
3
+
4
+ module Reek
5
+ #
6
+ # Manage verifier extention
7
+ # Load new verifier extention and keep the instance, so later when we need
8
+ # the same extention we can recall from cache.
9
+ #
10
+ class VerifierExtensionManager
11
+ @@verifier_extensions = {}
12
+
13
+ def self.accepted?(p_extension_scripts, p_context, p_variable)
14
+ p_extension_scripts.each do |extension_script|
15
+ extension = find_or_initiate_extension(extension_script)
16
+ if extension
17
+ accepted, message = extension.accepted?(p_context, p_variable)
18
+ if !accepted
19
+ return false, message
20
+ end
21
+ end
22
+ end
23
+
24
+ return true, nil
25
+ end
26
+
27
+ def self.find_or_initiate_extension(p_extension_script)
28
+ if !exists?(p_extension_script)
29
+ initiate_extension!(p_extension_script)
30
+ end
31
+
32
+ return find(p_extension_script)
33
+ end
34
+
35
+ def self.find(p_extension_script)
36
+ @@verifier_extensions[p_extension_script]
37
+ end
38
+
39
+ def self.exists?(p_extension_script)
40
+ @@verifier_extensions.include?(p_extension_script)
41
+ end
42
+
43
+ def self.initiate_extension!(p_extension_script)
44
+ require p_extension_script
45
+
46
+ # detect class name
47
+ extension_class = p_extension_script.split(File::SEPARATOR).
48
+ last.split(".").first.camelize.constantize
49
+ @@verifier_extensions[p_extension_script] = extension_class.new
50
+ end
51
+ end
52
+
53
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{reek}
5
- s.version = "1.1.3.1"
5
+ s.version = "1.1.3.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Kevin Rutherford"]
@@ -12,7 +12,31 @@ Gem::Specification.new do |s|
12
12
  s.email = ["kevin@rutherford-software.com"]
13
13
  s.executables = ["reek"]
14
14
  s.extra_rdoc_files = ["History.txt", "README.txt"]
15
- s.files = ["History.txt", "README.txt", "Rakefile", "bin/reek", "config/defaults.reek", "lib/reek.rb", "lib/reek/block_context.rb", "lib/reek/class_context.rb", "lib/reek/code_context.rb", "lib/reek/code_parser.rb", "lib/reek/exceptions.reek", "lib/reek/if_context.rb", "lib/reek/method_context.rb", "lib/reek/module_context.rb", "lib/reek/name.rb", "lib/reek/object_refs.rb", "lib/reek/object_source.rb", "lib/reek/options.rb", "lib/reek/rake_task.rb", "lib/reek/report.rb", "lib/reek/sexp_formatter.rb", "lib/reek/singleton_method_context.rb", "lib/reek/smell_warning.rb", "lib/reek/smells/control_couple.rb", "lib/reek/smells/duplication.rb", "lib/reek/smells/feature_envy.rb", "lib/reek/smells/large_class.rb", "lib/reek/smells/long_method.rb", "lib/reek/smells/long_parameter_list.rb", "lib/reek/smells/long_yield_list.rb", "lib/reek/smells/nested_iterators.rb", "lib/reek/smells/smell_detector.rb", "lib/reek/smells/smells.rb", "lib/reek/smells/uncommunicative_name.rb", "lib/reek/smells/utility_function.rb", "lib/reek/source.rb", "lib/reek/spec.rb", "lib/reek/stop_context.rb", "lib/reek/yield_call_context.rb", "reek.gemspec", "spec/reek/block_context_spec.rb", "spec/reek/class_context_spec.rb", "spec/reek/code_context_spec.rb", "spec/reek/code_parser_spec.rb", "spec/reek/config_spec.rb", "spec/reek/if_context_spec.rb", "spec/reek/method_context_spec.rb", "spec/reek/module_context_spec.rb", "spec/reek/name_spec.rb", "spec/reek/object_refs_spec.rb", "spec/reek/options_spec.rb", "spec/reek/report_spec.rb", "spec/reek/singleton_method_context_spec.rb", "spec/reek/smells/control_couple_spec.rb", "spec/reek/smells/duplication_spec.rb", "spec/reek/smells/feature_envy_spec.rb", "spec/reek/smells/large_class_spec.rb", "spec/reek/smells/long_method_spec.rb", "spec/reek/smells/long_parameter_list_spec.rb", "spec/reek/smells/nested_iterators_spec.rb", "spec/reek/smells/smell_spec.rb", "spec/reek/smells/uncommunicative_name_spec.rb", "spec/reek/smells/utility_function_spec.rb", "spec/slow/inline_spec.rb", "spec/slow/optparse_spec.rb", "spec/slow/redcloth_spec.rb", "spec/slow/reek_source_spec.rb", "spec/slow/samples/inline.rb", "spec/slow/samples/optparse.rb", "spec/slow/samples/redcloth.rb", "spec/slow/script_spec.rb", "spec/slow/source_list_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/reek.rake", "tasks/rspec.rake"]
15
+ s.files = ["History.txt",
16
+ "README.txt", "README.textile", "Rakefile",
17
+ "bin/reek", "config/defaults.reek",
18
+ "lib/reek.rb", "lib/reek/block_context.rb",
19
+ "lib/reek/class_context.rb", "lib/reek/code_context.rb",
20
+ "lib/reek/code_parser.rb", "lib/reek/exceptions.reek",
21
+ "lib/reek/if_context.rb", "lib/reek/method_context.rb",
22
+ "lib/reek/module_context.rb", "lib/reek/name.rb",
23
+ "lib/reek/object_refs.rb", "lib/reek/object_source.rb",
24
+ "lib/reek/options.rb", "lib/reek/rake_task.rb",
25
+ "lib/reek/report.rb", "lib/reek/sexp_formatter.rb",
26
+ "lib/reek/singleton_method_context.rb",
27
+ "lib/reek/smell_warning.rb", "lib/reek/smells/control_couple.rb",
28
+ "lib/reek/smells/duplication.rb", "lib/reek/smells/feature_envy.rb",
29
+ "lib/reek/smells/large_class.rb", "lib/reek/smells/long_method.rb",
30
+ "lib/reek/smells/long_parameter_list.rb",
31
+ "lib/reek/smells/long_yield_list.rb",
32
+ "lib/reek/smells/nested_iterators.rb",
33
+ "lib/reek/smells/smell_detector.rb", "lib/reek/smells/smells.rb",
34
+ "lib/reek/smells/uncommunicative_name.rb",
35
+ "lib/reek/smells/utility_function.rb", "lib/reek/source.rb",
36
+ "lib/reek/spec.rb", "lib/reek/stop_context.rb",
37
+ "lib/reek/verifier_extension_manager.rb",
38
+ "lib/reek/yield_call_context.rb", "reek.gemspec",
39
+ "spec/reek/block_context_spec.rb", "spec/reek/class_context_spec.rb", "spec/reek/code_context_spec.rb", "spec/reek/code_parser_spec.rb", "spec/reek/config_spec.rb", "spec/reek/if_context_spec.rb", "spec/reek/method_context_spec.rb", "spec/reek/module_context_spec.rb", "spec/reek/name_spec.rb", "spec/reek/object_refs_spec.rb", "spec/reek/options_spec.rb", "spec/reek/report_spec.rb", "spec/reek/singleton_method_context_spec.rb", "spec/reek/smells/control_couple_spec.rb", "spec/reek/smells/duplication_spec.rb", "spec/reek/smells/feature_envy_spec.rb", "spec/reek/smells/large_class_spec.rb", "spec/reek/smells/long_method_spec.rb", "spec/reek/smells/long_parameter_list_spec.rb", "spec/reek/smells/nested_iterators_spec.rb", "spec/reek/smells/smell_spec.rb", "spec/reek/smells/uncommunicative_name_spec.rb", "spec/reek/smells/utility_function_spec.rb", "spec/slow/inline_spec.rb", "spec/slow/optparse_spec.rb", "spec/slow/redcloth_spec.rb", "spec/slow/reek_source_spec.rb", "spec/slow/samples/inline.rb", "spec/slow/samples/optparse.rb", "spec/slow/samples/redcloth.rb", "spec/slow/script_spec.rb", "spec/slow/source_list_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/reek.rake", "tasks/rspec.rake"]
16
40
  s.homepage = %q{http://wiki.github.com/kevinrutherford/reek}
17
41
  s.post_install_message = %q{
18
42
  For more information on reek, see http://wiki.github.com/kevinrutherford/reek
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teksymmetry-reek
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3.1
4
+ version: 1.1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Rutherford
@@ -55,6 +55,7 @@ extra_rdoc_files:
55
55
  files:
56
56
  - History.txt
57
57
  - README.txt
58
+ - README.textile
58
59
  - Rakefile
59
60
  - bin/reek
60
61
  - config/defaults.reek
@@ -91,6 +92,7 @@ files:
91
92
  - lib/reek/source.rb
92
93
  - lib/reek/spec.rb
93
94
  - lib/reek/stop_context.rb
95
+ - lib/reek/verifier_extension_manager.rb
94
96
  - lib/reek/yield_call_context.rb
95
97
  - reek.gemspec
96
98
  - spec/reek/block_context_spec.rb