rubycritic 2.6.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -585
- data/.rubocop_todo.yml +36 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/Rakefile +9 -9
- data/bin/rubycritic +2 -2
- data/features/command_line_interface/options.feature +1 -0
- data/features/step_definitions/rubycritic_steps.rb +1 -1
- data/features/step_definitions/sample_file_steps.rb +3 -3
- data/features/support/env.rb +6 -6
- data/lib/rubycritic.rb +1 -1
- data/lib/rubycritic/analysers/attributes.rb +6 -7
- data/lib/rubycritic/analysers/churn.rb +4 -6
- data/lib/rubycritic/analysers/complexity.rb +5 -7
- data/lib/rubycritic/analysers/helpers/ast_node.rb +4 -6
- data/lib/rubycritic/analysers/helpers/flay.rb +1 -3
- data/lib/rubycritic/analysers/helpers/flog.rb +5 -7
- data/lib/rubycritic/analysers/helpers/methods_counter.rb +1 -3
- data/lib/rubycritic/analysers/helpers/modules_locator.rb +3 -5
- data/lib/rubycritic/analysers/helpers/parser.rb +2 -2
- data/lib/rubycritic/analysers/helpers/reek.rb +1 -1
- data/lib/rubycritic/analysers/smells/flay.rb +14 -16
- data/lib/rubycritic/analysers/smells/flog.rb +15 -17
- data/lib/rubycritic/analysers/smells/reek.rb +11 -13
- data/lib/rubycritic/analysers_runner.rb +8 -10
- data/lib/rubycritic/browser.rb +17 -0
- data/lib/rubycritic/cli/application.rb +3 -3
- data/lib/rubycritic/cli/options.rb +29 -23
- data/lib/rubycritic/command_factory.rb +5 -5
- data/lib/rubycritic/commands/base.rb +2 -2
- data/lib/rubycritic/commands/ci.rb +4 -4
- data/lib/rubycritic/commands/default.rb +5 -5
- data/lib/rubycritic/commands/help.rb +1 -1
- data/lib/rubycritic/commands/status_reporter.rb +1 -1
- data/lib/rubycritic/commands/version.rb +2 -2
- data/lib/rubycritic/configuration.rb +4 -2
- data/lib/rubycritic/core/analysed_module.rb +15 -17
- data/lib/rubycritic/core/analysed_modules_collection.rb +3 -3
- data/lib/rubycritic/core/location.rb +4 -6
- data/lib/rubycritic/core/rating.rb +5 -7
- data/lib/rubycritic/core/smell.rb +11 -13
- data/lib/rubycritic/generators/console_report.rb +1 -1
- data/lib/rubycritic/generators/html/base.rb +9 -9
- data/lib/rubycritic/generators/html/code_file.rb +5 -7
- data/lib/rubycritic/generators/html/code_index.rb +3 -5
- data/lib/rubycritic/generators/html/line.rb +4 -6
- data/lib/rubycritic/generators/html/overview.rb +4 -6
- data/lib/rubycritic/generators/html/smells_index.rb +3 -5
- data/lib/rubycritic/generators/html/turbulence.rb +4 -6
- data/lib/rubycritic/generators/html/view_helpers.rb +4 -4
- data/lib/rubycritic/generators/html_report.rb +13 -9
- data/lib/rubycritic/generators/json/simple.rb +7 -9
- data/lib/rubycritic/generators/json_report.rb +1 -3
- data/lib/rubycritic/generators/text/list.rb +9 -9
- data/lib/rubycritic/reporter.rb +3 -5
- data/lib/rubycritic/revision_comparator.rb +6 -8
- data/lib/rubycritic/serializer.rb +2 -4
- data/lib/rubycritic/smells_status_setter.rb +2 -4
- data/lib/rubycritic/source_control_systems/base.rb +4 -6
- data/lib/rubycritic/source_control_systems/double.rb +1 -2
- data/lib/rubycritic/source_control_systems/git.rb +1 -3
- data/lib/rubycritic/source_control_systems/mercurial.rb +1 -3
- data/lib/rubycritic/source_locator.rb +5 -6
- data/lib/rubycritic/version.rb +1 -1
- data/rubycritic.gemspec +26 -25
- data/test/analysers_test_helper.rb +1 -1
- data/test/lib/rubycritic/analysers/churn_test.rb +9 -9
- data/test/lib/rubycritic/analysers/complexity_test.rb +5 -5
- data/test/lib/rubycritic/analysers/helpers/methods_counter_test.rb +12 -12
- data/test/lib/rubycritic/analysers/helpers/modules_locator_test.rb +25 -25
- data/test/lib/rubycritic/analysers/smells/flay_test.rb +12 -12
- data/test/lib/rubycritic/analysers/smells/flog_test.rb +7 -7
- data/test/lib/rubycritic/analysers/smells/reek_test.rb +8 -8
- data/test/lib/rubycritic/browser_test.rb +16 -0
- data/test/lib/rubycritic/commands/status_reporter_test.rb +31 -19
- data/test/lib/rubycritic/configuration_test.rb +10 -10
- data/test/lib/rubycritic/core/analysed_module_test.rb +37 -37
- data/test/lib/rubycritic/core/analysed_modules_collection_test.rb +32 -32
- data/test/lib/rubycritic/core/location_test.rb +16 -16
- data/test/lib/rubycritic/core/smell_test.rb +31 -31
- data/test/lib/rubycritic/core/smells_array_test.rb +18 -18
- data/test/lib/rubycritic/generators/console_report_test.rb +26 -26
- data/test/lib/rubycritic/generators/turbulence_test.rb +8 -8
- data/test/lib/rubycritic/generators/view_helpers_test.rb +36 -36
- data/test/lib/rubycritic/smells_status_setter_test.rb +7 -7
- data/test/lib/rubycritic/source_control_systems/base_test.rb +7 -7
- data/test/lib/rubycritic/source_control_systems/double_test.rb +3 -3
- data/test/lib/rubycritic/source_control_systems/git_test.rb +4 -4
- data/test/lib/rubycritic/source_control_systems/mercurial_test.rb +3 -3
- data/test/lib/rubycritic/source_locator_test.rb +30 -30
- data/test/lib/rubycritic/version_test.rb +4 -4
- data/test/test_helper.rb +4 -4
- metadata +30 -17
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'test_helper'
|
2
|
+
require 'rubycritic/source_control_systems/base'
|
3
3
|
|
4
4
|
describe Rubycritic::SourceControlSystem::Base do
|
5
5
|
before do
|
@@ -8,17 +8,17 @@ describe Rubycritic::SourceControlSystem::Base do
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
describe
|
12
|
-
context
|
13
|
-
it
|
11
|
+
describe '::create' do
|
12
|
+
context 'when a source control system is found' do
|
13
|
+
it 'creates an instance of that source control system' do
|
14
14
|
Rubycritic::SourceControlSystem::Git.stubs(:supported?).returns(true)
|
15
15
|
system = Rubycritic::SourceControlSystem::Base.create
|
16
16
|
system.must_be_instance_of Rubycritic::SourceControlSystem::Git
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
context
|
21
|
-
it
|
20
|
+
context 'when no source control system is found' do
|
21
|
+
it 'creates a source control system double' do
|
22
22
|
capture_output_streams do
|
23
23
|
system = Rubycritic::SourceControlSystem::Base.create
|
24
24
|
system.must_be_instance_of Rubycritic::SourceControlSystem::Double
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require_relative
|
1
|
+
require 'test_helper'
|
2
|
+
require 'rubycritic/source_control_systems/base'
|
3
|
+
require_relative 'interfaces/basic'
|
4
4
|
|
5
5
|
class DoubleTest < Minitest::Test
|
6
6
|
include BasicInterface
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require_relative
|
4
|
-
require_relative
|
1
|
+
require 'test_helper'
|
2
|
+
require 'rubycritic/source_control_systems/base'
|
3
|
+
require_relative 'interfaces/basic'
|
4
|
+
require_relative 'interfaces/time_travel'
|
5
5
|
|
6
6
|
class GitTest < Minitest::Test
|
7
7
|
include BasicInterface
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require_relative
|
1
|
+
require 'test_helper'
|
2
|
+
require 'rubycritic/source_control_systems/base'
|
3
|
+
require_relative 'interfaces/basic'
|
4
4
|
|
5
5
|
class MercurialTest < Minitest::Test
|
6
6
|
include BasicInterface
|
@@ -1,73 +1,73 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'test_helper'
|
2
|
+
require 'rubycritic/source_locator'
|
3
3
|
|
4
4
|
describe Rubycritic::SourceLocator do
|
5
5
|
before do
|
6
6
|
@original_dir = Dir.getwd
|
7
|
-
Dir.chdir(
|
7
|
+
Dir.chdir('test/samples/location')
|
8
8
|
end
|
9
9
|
|
10
|
-
describe
|
11
|
-
it
|
12
|
-
paths = [
|
10
|
+
describe '#paths' do
|
11
|
+
it 'finds a single file' do
|
12
|
+
paths = ['file0.rb']
|
13
13
|
Rubycritic::SourceLocator.new(paths).paths.must_equal paths
|
14
14
|
end
|
15
15
|
|
16
|
-
it
|
17
|
-
initial_paths = [
|
18
|
-
final_paths = [
|
16
|
+
it 'finds all the files inside a given directory' do
|
17
|
+
initial_paths = ['dir1']
|
18
|
+
final_paths = ['dir1/file1.rb']
|
19
19
|
Rubycritic::SourceLocator.new(initial_paths).paths.must_equal final_paths
|
20
20
|
end
|
21
21
|
|
22
|
-
it
|
23
|
-
paths = [
|
22
|
+
it 'finds files through multiple paths' do
|
23
|
+
paths = ['dir1/file1.rb', 'file0.rb']
|
24
24
|
Rubycritic::SourceLocator.new(paths).paths.must_match_array paths
|
25
25
|
end
|
26
26
|
|
27
|
-
it
|
28
|
-
initial_paths = [
|
29
|
-
final_paths = [
|
27
|
+
it 'finds all the files' do
|
28
|
+
initial_paths = ['.']
|
29
|
+
final_paths = ['dir1/file1.rb', 'file0.rb', 'file0_symlink.rb']
|
30
30
|
Rubycritic::SourceLocator.new(initial_paths).paths.must_match_array final_paths
|
31
31
|
end
|
32
32
|
|
33
|
-
context
|
34
|
-
it
|
33
|
+
context 'when configured to deduplicate symlinks' do
|
34
|
+
it 'favors a file over a symlink if they both point to the same target' do
|
35
35
|
Rubycritic::Config.stubs(:deduplicate_symlinks).returns(true)
|
36
|
-
initial_paths = [
|
37
|
-
final_paths = [
|
36
|
+
initial_paths = ['file0.rb', 'file0_symlink.rb']
|
37
|
+
final_paths = ['file0.rb']
|
38
38
|
Rubycritic::SourceLocator.new(initial_paths).paths.must_match_array final_paths
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
it
|
43
|
-
initial_paths = [
|
44
|
-
final_paths = [
|
42
|
+
it 'cleans paths of consecutive slashes and useless dots' do
|
43
|
+
initial_paths = ['.//file0.rb']
|
44
|
+
final_paths = ['file0.rb']
|
45
45
|
Rubycritic::SourceLocator.new(initial_paths).paths.must_equal final_paths
|
46
46
|
end
|
47
47
|
|
48
|
-
it
|
49
|
-
initial_paths = [
|
48
|
+
it 'ignores paths to non-existent files' do
|
49
|
+
initial_paths = ['non_existent_dir1/non_existent_file1.rb', 'non_existent_file0.rb']
|
50
50
|
final_paths = []
|
51
51
|
Rubycritic::SourceLocator.new(initial_paths).paths.must_equal final_paths
|
52
52
|
end
|
53
53
|
|
54
|
-
it
|
55
|
-
initial_paths = [
|
54
|
+
it 'ignores paths to files that do not match the Ruby extension' do
|
55
|
+
initial_paths = ['file_with_no_extension', 'file_with_different_extension.py']
|
56
56
|
final_paths = []
|
57
57
|
Rubycritic::SourceLocator.new(initial_paths).paths.must_equal final_paths
|
58
58
|
end
|
59
59
|
|
60
|
-
it
|
60
|
+
it 'can deal with nil paths' do
|
61
61
|
paths = nil
|
62
62
|
final_paths = []
|
63
63
|
Rubycritic::SourceLocator.new(paths).paths.must_equal final_paths
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
describe
|
68
|
-
it
|
69
|
-
initial_paths = [
|
70
|
-
final_pathnames = [Pathname.new(
|
67
|
+
describe '#pathnames' do
|
68
|
+
it 'finds a single file' do
|
69
|
+
initial_paths = ['file0.rb']
|
70
|
+
final_pathnames = [Pathname.new('file0.rb')]
|
71
71
|
Rubycritic::SourceLocator.new(initial_paths).pathnames.must_equal final_pathnames
|
72
72
|
end
|
73
73
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'test_helper'
|
2
|
+
require 'rubycritic/version'
|
3
3
|
|
4
|
-
describe
|
5
|
-
it
|
4
|
+
describe 'Rubycritic version' do
|
5
|
+
it 'is defined' do
|
6
6
|
Rubycritic::VERSION.wont_be_nil
|
7
7
|
end
|
8
8
|
end
|
data/test/test_helper.rb
CHANGED
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.
|
4
|
+
version: 2.7.0
|
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-
|
11
|
+
date: 2016-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: virtus
|
@@ -58,34 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.
|
61
|
+
version: 3.9.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.
|
68
|
+
version: 3.9.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: parser
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 2.2.0
|
76
|
-
- - "<"
|
73
|
+
- - "~>"
|
77
74
|
- !ruby/object:Gem::Version
|
78
|
-
version: '3
|
75
|
+
version: '2.3'
|
79
76
|
type: :runtime
|
80
77
|
prerelease: false
|
81
78
|
version_requirements: !ruby/object:Gem::Requirement
|
82
79
|
requirements:
|
83
|
-
- - "
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: 2.2.0
|
86
|
-
- - "<"
|
80
|
+
- - "~>"
|
87
81
|
- !ruby/object:Gem::Version
|
88
|
-
version: '3
|
82
|
+
version: '2.3'
|
89
83
|
- !ruby/object:Gem::Dependency
|
90
84
|
name: colorize
|
91
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,6 +94,20 @@ dependencies:
|
|
100
94
|
- - ">="
|
101
95
|
- !ruby/object:Gem::Version
|
102
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: launchy
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.4.3
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.4.3
|
103
111
|
- !ruby/object:Gem::Dependency
|
104
112
|
name: aruba
|
105
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,14 +198,14 @@ dependencies:
|
|
190
198
|
requirements:
|
191
199
|
- - '='
|
192
200
|
- !ruby/object:Gem::Version
|
193
|
-
version: 0.
|
201
|
+
version: 0.36.0
|
194
202
|
type: :development
|
195
203
|
prerelease: false
|
196
204
|
version_requirements: !ruby/object:Gem::Requirement
|
197
205
|
requirements:
|
198
206
|
- - '='
|
199
207
|
- !ruby/object:Gem::Version
|
200
|
-
version: 0.
|
208
|
+
version: 0.36.0
|
201
209
|
description: RubyCritic is a tool that wraps around various static analysis gems to
|
202
210
|
provide a quality report of your Ruby code.
|
203
211
|
email:
|
@@ -209,6 +217,7 @@ extra_rdoc_files: []
|
|
209
217
|
files:
|
210
218
|
- ".gitignore"
|
211
219
|
- ".rubocop.yml"
|
220
|
+
- ".rubocop_todo.yml"
|
212
221
|
- ".travis.yml"
|
213
222
|
- CHANGELOG.md
|
214
223
|
- CONTRIBUTING.md
|
@@ -237,6 +246,7 @@ files:
|
|
237
246
|
- lib/rubycritic/analysers/smells/flog.rb
|
238
247
|
- lib/rubycritic/analysers/smells/reek.rb
|
239
248
|
- lib/rubycritic/analysers_runner.rb
|
249
|
+
- lib/rubycritic/browser.rb
|
240
250
|
- lib/rubycritic/cli/application.rb
|
241
251
|
- lib/rubycritic/cli/options.rb
|
242
252
|
- lib/rubycritic/colorize.rb
|
@@ -303,6 +313,7 @@ files:
|
|
303
313
|
- test/lib/rubycritic/analysers/smells/flay_test.rb
|
304
314
|
- test/lib/rubycritic/analysers/smells/flog_test.rb
|
305
315
|
- test/lib/rubycritic/analysers/smells/reek_test.rb
|
316
|
+
- test/lib/rubycritic/browser_test.rb
|
306
317
|
- test/lib/rubycritic/commands/status_reporter_test.rb
|
307
318
|
- test/lib/rubycritic/configuration_test.rb
|
308
319
|
- test/lib/rubycritic/core/analysed_module_test.rb
|
@@ -359,7 +370,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
359
370
|
version: '0'
|
360
371
|
requirements: []
|
361
372
|
rubyforge_project:
|
362
|
-
rubygems_version: 2.4.5
|
373
|
+
rubygems_version: 2.4.5.1
|
363
374
|
signing_key:
|
364
375
|
specification_version: 4
|
365
376
|
summary: RubyCritic is a Ruby code quality reporter
|
@@ -372,6 +383,7 @@ test_files:
|
|
372
383
|
- test/lib/rubycritic/analysers/smells/flay_test.rb
|
373
384
|
- test/lib/rubycritic/analysers/smells/flog_test.rb
|
374
385
|
- test/lib/rubycritic/analysers/smells/reek_test.rb
|
386
|
+
- test/lib/rubycritic/browser_test.rb
|
375
387
|
- test/lib/rubycritic/commands/status_reporter_test.rb
|
376
388
|
- test/lib/rubycritic/configuration_test.rb
|
377
389
|
- test/lib/rubycritic/core/analysed_module_test.rb
|
@@ -408,3 +420,4 @@ test_files:
|
|
408
420
|
- test/samples/reek/smelly.rb
|
409
421
|
- test/samples/unparsable.rb
|
410
422
|
- test/test_helper.rb
|
423
|
+
has_rdoc:
|