ruby-watchr 0.1.5.2 → 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.
@@ -1,5 +1,5 @@
1
1
  require 'watchr/paths'
2
- require 'watchr/flay_metric/report'
2
+ require 'watchr/metrics/flay/report'
3
3
  require 'watchr/file_analyse'
4
4
 
5
5
  module Watchr
@@ -0,0 +1,23 @@
1
+ require 'watchr/smell'
2
+
3
+ module Watchr
4
+ module Analysers
5
+ module Reek
6
+ include SmellTypes
7
+
8
+ def analyse_reek(report)
9
+ report.smells.each do |smell|
10
+ location = Location.new(
11
+ smell.location['source'],
12
+ smell.location['lines'].first
13
+ )
14
+
15
+ add_smell(Watchr::Smell.new(
16
+ smell.smell['subclass'],
17
+ smell.location['context'], smell.smell['message'], location, {}
18
+ ))
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,7 +1,9 @@
1
- require 'watchr/flog_metric/report'
1
+ require 'watchr/metrics/flog/report'
2
+ require 'watchr/metrics/reek/report'
2
3
  require 'watchr/smell'
3
4
  require 'watchr/smells_collector'
4
5
  require 'watchr/analysers/flog'
6
+ require 'watchr/analysers/reek'
5
7
  require 'watchr/rating'
6
8
 
7
9
  module Watchr
@@ -12,6 +14,7 @@ module Watchr
12
14
  #
13
15
  class FileAnalyse
14
16
  include Analysers::Flog
17
+ include Analysers::Reek
15
18
  include Rating
16
19
 
17
20
  attr_reader :path
@@ -24,8 +27,9 @@ module Watchr
24
27
  def initialize(path)
25
28
  @path = path
26
29
  @smells = SmellsCollector.new
27
-
30
+
28
31
  analyse_flog(FlogMetric::Report.new([path]))
32
+ analyse_reek(ReekMetric::Report.new([path]))
29
33
  end
30
34
 
31
35
  def smelly?
File without changes
@@ -1,5 +1,5 @@
1
1
  require 'flay'
2
- require 'watchr/flay_metric/diff'
2
+ require 'watchr/metrics/flay/diff'
3
3
  require 'watchr/location'
4
4
 
5
5
  module Watchr
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  require 'flog'
2
- require 'watchr/flog_metric/class'
3
- require 'watchr/flog_metric/method'
2
+ require 'watchr/metrics/flog/class'
3
+ require 'watchr/metrics/flog/method'
4
4
  require 'watchr/location'
5
5
 
6
6
  module Watchr
@@ -0,0 +1,15 @@
1
+ require 'reek'
2
+
3
+ module Watchr
4
+ module ReekMetric
5
+ class Report
6
+ def initialize(path)
7
+ @warnings = Reek::Examiner.new(path).all_active_smells
8
+ end
9
+
10
+ def smells
11
+ @warnings
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Watchr
2
- VERSION = "0.1.5.2"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -19,6 +19,8 @@ describe Watchr::FileAnalyse do
19
19
  subject { file_analyse.smelly? }
20
20
 
21
21
  context 'with no smells' do
22
+ before { file_analyse.stubs(:smells).returns([]) }
23
+
22
24
  it { should be_false }
23
25
  end
24
26
 
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'watchr/flay_metric/report'
2
+ require 'watchr/metrics/flay/report'
3
3
 
4
4
  describe Watchr::FlayMetric::Report do
5
5
  let(:report) {
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'watchr/flog_metric/report'
2
+ require 'watchr/metrics/flog/report'
3
3
 
4
4
  describe Watchr::FlogMetric::Report do
5
5
  let(:flog_report) {
metadata CHANGED
@@ -5,9 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 5
9
- - 2
10
- version: 0.1.5.2
8
+ - 6
9
+ version: 0.1.6
11
10
  platform: ruby
12
11
  authors:
13
12
  - Petr Janda
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2012-07-09 00:00:00 +02:00
17
+ date: 2012-07-13 00:00:00 +02:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -75,13 +74,15 @@ files:
75
74
  - lib/watchr.rb
76
75
  - lib/watchr/analyse.rb
77
76
  - lib/watchr/analysers/flog.rb
77
+ - lib/watchr/analysers/reek.rb
78
78
  - lib/watchr/file_analyse.rb
79
- - lib/watchr/flay_metric/diff.rb
80
- - lib/watchr/flay_metric/report.rb
81
- - lib/watchr/flog_metric/class.rb
82
- - lib/watchr/flog_metric/method.rb
83
- - lib/watchr/flog_metric/report.rb
84
79
  - lib/watchr/location.rb
80
+ - lib/watchr/metrics/flay/diff.rb
81
+ - lib/watchr/metrics/flay/report.rb
82
+ - lib/watchr/metrics/flog/class.rb
83
+ - lib/watchr/metrics/flog/method.rb
84
+ - lib/watchr/metrics/flog/report.rb
85
+ - lib/watchr/metrics/reek/report.rb
85
86
  - lib/watchr/paths.rb
86
87
  - lib/watchr/rating.rb
87
88
  - lib/watchr/smell.rb