code_hunter 0.1.5 → 0.1.6
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.
- data/bin/code_hunter +1 -1
- data/lib/code_hunter.rb +1 -0
- data/lib/code_hunter/config.rb +13 -0
- data/lib/code_hunter/method_logger.rb +1 -1
- data/lib/code_hunter/runner.rb +7 -8
- data/lib/code_hunter/version.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- metadata +4 -2
data/bin/code_hunter
CHANGED
data/lib/code_hunter.rb
CHANGED
@@ -2,7 +2,7 @@ module CodeHunter
|
|
2
2
|
module MethodLogger
|
3
3
|
def log(method_name)
|
4
4
|
define_method("#{method_name}_with_log") do |*args, &block|
|
5
|
-
warn("#{Time.now} #{self.class}##{method_name}")
|
5
|
+
warn("#{Time.now} #{self.class}##{method_name}") if Config.enable_logger
|
6
6
|
__send__("#{method_name}_without_log", *args, &block)
|
7
7
|
end
|
8
8
|
alias_method_chain method_name, :log
|
data/lib/code_hunter/runner.rb
CHANGED
@@ -11,16 +11,15 @@ module CodeHunter
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def run
|
14
|
-
|
15
|
-
warnings = warnings.select(&:has_git_metadata?)
|
16
|
-
warnings = warnings.reject(&:ignore?)
|
17
|
-
puts Renderer.render(warnings.map(&:to_hash), :format => options[:format])
|
14
|
+
Renderer.render(result, :format => options[:format])
|
18
15
|
end
|
19
16
|
|
20
|
-
def
|
21
|
-
services.map(&:run).compact
|
22
|
-
|
23
|
-
|
17
|
+
def result
|
18
|
+
results = services.map(&:run).compact
|
19
|
+
warnings = results.inject([], :+).map {|attributes| Warning.new(attributes) }
|
20
|
+
warnings = warnings.select(&:has_git_metadata?)
|
21
|
+
warnings = warnings.reject(&:ignore?)
|
22
|
+
warnings.map(&:to_hash)
|
24
23
|
end
|
25
24
|
|
26
25
|
private
|
data/lib/code_hunter/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code_hunter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/code_hunter/brakeman.rb
|
143
143
|
- lib/code_hunter/brakeman/invoker.rb
|
144
144
|
- lib/code_hunter/brakeman/summarizer.rb
|
145
|
+
- lib/code_hunter/config.rb
|
145
146
|
- lib/code_hunter/git_blamer.rb
|
146
147
|
- lib/code_hunter/method_logger.rb
|
147
148
|
- lib/code_hunter/option_parser.rb
|
@@ -186,3 +187,4 @@ test_files:
|
|
186
187
|
- spec/code_hunter/renderer_spec.rb
|
187
188
|
- spec/code_hunter/runner_spec.rb
|
188
189
|
- spec/spec_helper.rb
|
190
|
+
has_rdoc:
|