rubycritic 2.7.0 → 2.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37aff404664ffd96d8f0d92284accb0053c9435a
4
- data.tar.gz: 8df0a27080dae7d2bd13372397a1712555cb4a99
3
+ metadata.gz: 278d628b028a0b49e460e040b155d7b0dea0cb1c
4
+ data.tar.gz: fdc48430d7343b5ae2f4429ed9586cd78061c311
5
5
  SHA512:
6
- metadata.gz: d6ae9e3b022d2d015b8d6301c5b657bb9a1e94eb9bde5ecd076a2c2222b2bea3f9855e74d4eaa2af134063496419909856914fcae84724ed264916c2c28f83ba
7
- data.tar.gz: 98cb0d06dc64fa6f29324524cca433101b5de689de99cb5698a96b98b17214a7b8299c2dc22a35cbd36a880d4e77b7e342ae5074fa65a6ce44a62e73f6aa662e
6
+ metadata.gz: 218bd9155097642d30f60a26887520d48c5ba4f33db26663a08d911e779e93cddbcf555db6f17411c65f9d86fd26746d952c90ed6e196c2b63c208bc59c1a4eb
7
+ data.tar.gz: d9a7cbc8d6089b490bc3b7fbb7bf772a5ce704fd75fd0a44b5bd3c4ec4717d260b900811f127b6dcc02b8cf23a98a5600090c77cd6b8da76dc212f643193647e
data/.gitignore CHANGED
@@ -16,3 +16,5 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  .idea/
19
+ .ruby-gemset
20
+ .ruby-version
data/CHANGELOG.md CHANGED
@@ -1,15 +1,20 @@
1
- # 2.7.0 / 2015-01-23
1
+ # 2.7.1 / 2016-02-09
2
+
3
+ * [CHANGE] Bump Reek to 3.10.1 (by Tomasz Pajor)
4
+ * [BUGFIX] Analyse only the files whose paths are specified in the CLI (by Nuno Silva)
5
+
6
+ # 2.7.0 / 2016-01-23
2
7
 
3
8
  * [FEATURE] Open html report with browser (by YingRui Lu)
4
9
  * [CHANGE] Bump Reek to 3.9.1
5
10
  * [CHANGE] Bump Rubocop to 0.36 and internal cleanup (preparing for Ruby 2.3)
6
11
 
7
- # 2.6.0 / 2015-01-21
12
+ # 2.6.0 / 2016-01-21
8
13
 
9
14
  * [FEATURE] Add a minimum score option to the command line interface (by Roberto Schneider)
10
15
  * [CHANGE] Display the class and module names when the file has no methods
11
16
 
12
- # 2.5.0 / 2015-01-16
17
+ # 2.5.0 / 2016-01-16
13
18
 
14
19
  * [FEATURE] Add a ConsoleReport format (by Josh Bodah)
15
20
 
@@ -9,7 +9,7 @@ module Rubycritic
9
9
  end
10
10
 
11
11
  def execute
12
- fail NotImplementedError
12
+ raise NotImplementedError
13
13
  end
14
14
  end
15
15
  end
@@ -28,13 +28,13 @@ module Rubycritic
28
28
  end
29
29
 
30
30
  def file_name
31
- fail NotImplementedError,
32
- "The #{self.class} class must implement the #{__method__} method."
31
+ raise NotImplementedError,
32
+ "The #{self.class} class must implement the #{__method__} method."
33
33
  end
34
34
 
35
35
  def render
36
- fail NotImplementedError,
37
- "The #{self.class} class must implement the #{__method__} method."
36
+ raise NotImplementedError,
37
+ "The #{self.class} class must implement the #{__method__} method."
38
38
  end
39
39
 
40
40
  private
@@ -31,13 +31,13 @@ module Rubycritic
31
31
  end
32
32
 
33
33
  def file_directory
34
- fail NotImplementedError,
35
- "The #{self.class} class must implement the #{__method__} method."
34
+ raise NotImplementedError,
35
+ "The #{self.class} class must implement the #{__method__} method."
36
36
  end
37
37
 
38
38
  def root_directory
39
- fail NotImplementedError,
40
- "The #{self.class} class must implement the #{__method__} method."
39
+ raise NotImplementedError,
40
+ "The #{self.class} class must implement the #{__method__} method."
41
41
  end
42
42
  end
43
43
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubycritic/serializer'
2
4
  require 'rubycritic/analysers_runner'
3
5
  require 'rubycritic/smells_status_setter'
@@ -14,28 +16,21 @@ module Rubycritic
14
16
 
15
17
  def set_statuses(analysed_modules_now)
16
18
  if Config.source_control_system.revision?
17
- SmellsStatusSetter.set(
18
- analysed_modules_before.flat_map(&:smells),
19
- analysed_modules_now.flat_map(&:smells)
20
- )
19
+ analysed_modules_before = load_cached_analysed_modules
20
+ if analysed_modules_before
21
+ SmellsStatusSetter.set(
22
+ analysed_modules_before.flat_map(&:smells),
23
+ analysed_modules_now.flat_map(&:smells)
24
+ )
25
+ end
21
26
  end
22
27
  analysed_modules_now
23
28
  end
24
29
 
25
30
  private
26
31
 
27
- def analysed_modules_before
28
- serializer = Serializer.new(revision_file)
29
- if File.file?(revision_file)
30
- serializer.load
31
- else
32
- analysed_modules = nil
33
- Config.source_control_system.travel_to_head do
34
- analysed_modules = AnalysersRunner.new(@paths).run
35
- end
36
- serializer.dump(analysed_modules)
37
- analysed_modules
38
- end
32
+ def load_cached_analysed_modules
33
+ Serializer.new(revision_file).load if File.file?(revision_file)
39
34
  end
40
35
 
41
36
  def revision_file
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
2
4
 
3
5
  module Rubycritic
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Rubycritic
2
- VERSION = '2.7.0'.freeze
4
+ VERSION = '2.7.1'.freeze
3
5
  end
data/rubycritic.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_runtime_dependency 'virtus', '~> 1.0'
24
24
  spec.add_runtime_dependency 'flay', '2.6.1'
25
25
  spec.add_runtime_dependency 'flog', '4.3.2'
26
- spec.add_runtime_dependency 'reek', '3.9.1'
26
+ spec.add_runtime_dependency 'reek', '3.10.1'
27
27
  spec.add_runtime_dependency 'parser', '~> 2.3'
28
28
  spec.add_runtime_dependency 'colorize'
29
29
  spec.add_runtime_dependency 'launchy', '2.4.3'
@@ -33,6 +33,6 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency 'cucumber'
34
34
  spec.add_development_dependency 'rake'
35
35
  spec.add_development_dependency 'minitest', '~> 5.3'
36
- spec.add_development_dependency 'mocha', '~> 1.0'
37
- spec.add_development_dependency 'rubocop', '0.36.0'
36
+ spec.add_development_dependency 'mocha', '~> 1.1'
37
+ spec.add_development_dependency 'rubocop', '0.37.0'
38
38
  end
@@ -15,7 +15,7 @@ describe Rubycritic::Generator::ConsoleReport do
15
15
  end
16
16
 
17
17
  it 'outputs the report to the stdout' do
18
- assert @output.size > 0, 'expected report to be output to stdout'
18
+ assert !@output.empty?, 'expected report to be output to stdout'
19
19
  end
20
20
 
21
21
  it "starts the report with the module's name" do
@@ -0,0 +1,64 @@
1
+ require 'test_helper'
2
+ require 'rubycritic/revision_comparator'
3
+
4
+ describe Rubycritic::RevisionComparator do
5
+ subject { Rubycritic::RevisionComparator.new([]) }
6
+
7
+ describe '#set_statuses' do
8
+ context 'in a SCS with :revision? == false' do
9
+ before do
10
+ Rubycritic::Config.expects(:source_control_system)
11
+ .at_least_once
12
+ .returns(stub(revision?: false))
13
+ end
14
+
15
+ it 'does not attempt to compare with previous results' do
16
+ subject.expects(:load_cached_analysed_modules).never
17
+ result = subject.set_statuses([])
18
+ result.must_equal([])
19
+ end
20
+ end
21
+
22
+ context 'in a SCS with :revision? == true' do
23
+ before do
24
+ Rubycritic::Config.expects(:source_control_system)
25
+ .at_least_once
26
+ .returns(stub(revision?: true))
27
+ end
28
+
29
+ context 'without previously cached results' do
30
+ before do
31
+ subject.expects(:revision_file).returns('foo')
32
+ File.expects(:file?).with('foo').returns(false)
33
+ end
34
+
35
+ it 'does not load them' do
36
+ Rubycritic::Serializer.expects(:new).never
37
+ subject.set_statuses([])
38
+ end
39
+
40
+ it 'does not invoke Rubycritic::SmellsStatusSetter' do
41
+ Rubycritic::SmellsStatusSetter.expects(:set).never
42
+ subject.set_statuses([])
43
+ end
44
+ end
45
+
46
+ context 'with previously cached results' do
47
+ before do
48
+ subject.expects(:revision_file).twice.returns('foo')
49
+ File.expects(:file?).with('foo').returns(true)
50
+ Rubycritic::Serializer.expects(:new).with('foo').returns(stub(load: []))
51
+ end
52
+
53
+ it 'loads them' do
54
+ subject.set_statuses([])
55
+ end
56
+
57
+ it 'invokes Rubycritic::SmellsStatusSetter' do
58
+ Rubycritic::SmellsStatusSetter.expects(:set).once
59
+ subject.set_statuses([])
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
data/test/test_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'minitest/autorun'
2
2
  require 'minitest/pride'
3
- require 'mocha/setup'
3
+ require 'mocha/mini_test'
4
4
  require 'ostruct'
5
5
 
6
6
  def context(*args, &block)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubycritic
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 2.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guilherme Simoes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-27 00:00:00.000000000 Z
11
+ date: 2016-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 3.9.1
61
+ version: 3.10.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 3.9.1
68
+ version: 3.10.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: parser
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -184,28 +184,28 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '1.0'
187
+ version: '1.1'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '1.0'
194
+ version: '1.1'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: rubocop
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - '='
200
200
  - !ruby/object:Gem::Version
201
- version: 0.36.0
201
+ version: 0.37.0
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - '='
207
207
  - !ruby/object:Gem::Version
208
- version: 0.36.0
208
+ version: 0.37.0
209
209
  description: RubyCritic is a tool that wraps around various static analysis gems to
210
210
  provide a quality report of your Ruby code.
211
211
  email:
@@ -324,6 +324,7 @@ files:
324
324
  - test/lib/rubycritic/generators/console_report_test.rb
325
325
  - test/lib/rubycritic/generators/turbulence_test.rb
326
326
  - test/lib/rubycritic/generators/view_helpers_test.rb
327
+ - test/lib/rubycritic/revision_comparator_test.rb
327
328
  - test/lib/rubycritic/smells_status_setter_test.rb
328
329
  - test/lib/rubycritic/source_control_systems/base_test.rb
329
330
  - test/lib/rubycritic/source_control_systems/double_test.rb
@@ -370,7 +371,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
370
371
  version: '0'
371
372
  requirements: []
372
373
  rubyforge_project:
373
- rubygems_version: 2.4.5.1
374
+ rubygems_version: 2.4.5
374
375
  signing_key:
375
376
  specification_version: 4
376
377
  summary: RubyCritic is a Ruby code quality reporter
@@ -394,6 +395,7 @@ test_files:
394
395
  - test/lib/rubycritic/generators/console_report_test.rb
395
396
  - test/lib/rubycritic/generators/turbulence_test.rb
396
397
  - test/lib/rubycritic/generators/view_helpers_test.rb
398
+ - test/lib/rubycritic/revision_comparator_test.rb
397
399
  - test/lib/rubycritic/smells_status_setter_test.rb
398
400
  - test/lib/rubycritic/source_control_systems/base_test.rb
399
401
  - test/lib/rubycritic/source_control_systems/double_test.rb
@@ -420,4 +422,3 @@ test_files:
420
422
  - test/samples/reek/smelly.rb
421
423
  - test/samples/unparsable.rb
422
424
  - test/test_helper.rb
423
- has_rdoc: