reek 4.1.0 → 4.1.1
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -1
- data/defaults.reek +1 -0
- data/lib/reek/ast/sexp_extensions/lambda.rb +4 -0
- data/lib/reek/cli/options.rb +1 -2
- data/lib/reek/configuration/app_configuration.rb +2 -3
- data/lib/reek/report.rb +2 -1
- data/lib/reek/report/code_climate/code_climate_formatter.rb +2 -4
- data/lib/reek/smells/data_clump.rb +1 -2
- data/lib/reek/smells/duplicate_method_call.rb +1 -2
- data/lib/reek/smells/long_parameter_list.rb +1 -2
- data/lib/reek/smells/nested_iterators.rb +1 -2
- data/lib/reek/smells/too_many_instance_variables.rb +1 -2
- data/lib/reek/smells/too_many_methods.rb +1 -2
- data/lib/reek/smells/too_many_statements.rb +1 -2
- data/lib/reek/smells/uncommunicative_method_name.rb +1 -2
- data/lib/reek/smells/uncommunicative_module_name.rb +1 -2
- data/lib/reek/smells/uncommunicative_parameter_name.rb +1 -2
- data/lib/reek/smells/uncommunicative_variable_name.rb +1 -2
- data/lib/reek/version.rb +1 -1
- data/spec/reek/ast/sexp_extensions_spec.rb +8 -0
- data/spec/reek/report/code_climate_formatter_spec.rb +10 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd5651b2cc5c8b32a2eb8d1297c190b67ebf3f6b
|
4
|
+
data.tar.gz: 948781b5c00280ff13499c1a31cf634f495e5736
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16653eda1cae7ac27cf6f439f45b8d2f77e8c954bd9e989cd70fdfa0c5c553cebb3caa97bb6a8696312a5029120455a7e7c45e20a46b42b3823d77c25abc3a2d
|
7
|
+
data.tar.gz: ecc7e1105e00ae9e6f284889ad5fc58e19eee73d79fde9f6c6ae9194ed6ad2b29c06006e3eee8e74356a4f629b04cfb001ab6e8ea9c7ad1dc4e263051a1edb83
|
data/.rubocop.yml
CHANGED
@@ -52,6 +52,10 @@ Style/FrozenStringLiteralComment:
|
|
52
52
|
Style/MultilineBlockChain:
|
53
53
|
Enabled: false
|
54
54
|
|
55
|
+
# Always put the closing brace on the last line
|
56
|
+
Style/MultilineMethodCallBraceLayout:
|
57
|
+
EnforcedStyle: same_line
|
58
|
+
|
55
59
|
# Indent one level for follow-up lines
|
56
60
|
Style/MultilineMethodCallIndentation:
|
57
61
|
EnforcedStyle: indented
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -10,9 +10,10 @@ group :development do
|
|
10
10
|
gem 'mutant-rspec', '~> 0.8.8'
|
11
11
|
gem 'rake', '~> 11.1'
|
12
12
|
gem 'rspec', '~> 3.0'
|
13
|
-
gem 'rubocop', '~> 0.
|
13
|
+
gem 'rubocop', '~> 0.41.1'
|
14
14
|
gem 'simplecov', '~> 0.11.1'
|
15
15
|
gem 'yard', '~> 0.8.7'
|
16
|
+
gem 'activesupport', '~> 4.2.7.rc1'
|
16
17
|
|
17
18
|
platforms :mri do
|
18
19
|
gem 'redcarpet', '~> 3.3.1'
|
data/defaults.reek
CHANGED
data/lib/reek/cli/options.rb
CHANGED
@@ -109,8 +109,7 @@ module Reek
|
|
109
109
|
parser.on(
|
110
110
|
'-f', '--format FORMAT', [:html, :text, :yaml, :json, :xml, :code_climate],
|
111
111
|
'Report smells in the given format:',
|
112
|
-
' html', ' text (default)', ' yaml', ' json', ' xml', ' code_climate'
|
113
|
-
) do |opt|
|
112
|
+
' html', ' text (default)', ' yaml', ' json', ' xml', ' code_climate') do |opt|
|
114
113
|
self.report_format = opt
|
115
114
|
end
|
116
115
|
end
|
@@ -72,10 +72,9 @@ module Reek
|
|
72
72
|
|
73
73
|
def load_values(configuration_hash)
|
74
74
|
configuration_hash.each do |key, value|
|
75
|
-
|
76
|
-
when key == EXCLUDE_PATHS_KEY
|
75
|
+
if key == EXCLUDE_PATHS_KEY
|
77
76
|
excluded_paths.add value
|
78
|
-
|
77
|
+
elsif smell_type?(key)
|
79
78
|
default_directive.add key, value
|
80
79
|
else
|
81
80
|
directory_directives.add key, value
|
data/lib/reek/report.rb
CHANGED
@@ -15,8 +15,7 @@ module Reek
|
|
15
15
|
categories: categories,
|
16
16
|
location: location,
|
17
17
|
remediation_points: remediation_points,
|
18
|
-
content: content
|
19
|
-
).render
|
18
|
+
content: content).render
|
20
19
|
end
|
21
20
|
|
22
21
|
private
|
@@ -39,8 +38,7 @@ module Reek
|
|
39
38
|
warning_lines = warning.lines
|
40
39
|
CCEngine::Location::LineRange.new(
|
41
40
|
path: warning.source,
|
42
|
-
line_range: warning_lines.first..warning_lines.last
|
43
|
-
)
|
41
|
+
line_range: warning_lines.first..warning_lines.last)
|
44
42
|
end
|
45
43
|
|
46
44
|
def remediation_points
|
@@ -31,8 +31,7 @@ module Reek
|
|
31
31
|
def self.default_config
|
32
32
|
super.merge(
|
33
33
|
MAX_ALLOWED_NESTING_KEY => DEFAULT_MAX_ALLOWED_NESTING,
|
34
|
-
IGNORE_ITERATORS_KEY => DEFAULT_IGNORE_ITERATORS
|
35
|
-
)
|
34
|
+
IGNORE_ITERATORS_KEY => DEFAULT_IGNORE_ITERATORS)
|
36
35
|
end
|
37
36
|
|
38
37
|
# Generates a smell warning for each independent deepest nesting depth
|
data/lib/reek/version.rb
CHANGED
@@ -466,6 +466,14 @@ RSpec.describe Reek::AST::SexpExtensions::CasgnNode do
|
|
466
466
|
expect(exp.defines_module?).to be_truthy
|
467
467
|
end
|
468
468
|
end
|
469
|
+
|
470
|
+
context 'when assign a lambda to a constant' do
|
471
|
+
it 'does not define a module' do
|
472
|
+
exp = Reek::Source::SourceCode.from('C = ->{}').syntax_tree
|
473
|
+
|
474
|
+
expect(exp.defines_module?).to be_falsey
|
475
|
+
end
|
476
|
+
end
|
469
477
|
end
|
470
478
|
|
471
479
|
context '#superclass' do
|
@@ -11,34 +11,35 @@ RSpec.describe Reek::Report::CodeClimateFormatter, '#render' do
|
|
11
11
|
source: 'a/ruby/source/file.rb')
|
12
12
|
end
|
13
13
|
let(:rendered) { Reek::Report::CodeClimateFormatter.new(warning).render }
|
14
|
+
let(:json) { JSON.parse rendered.chop }
|
14
15
|
|
15
16
|
it "sets the type as 'issue'" do
|
16
|
-
expect(
|
17
|
+
expect(json['type']).to eq 'issue'
|
17
18
|
end
|
18
19
|
|
19
20
|
it 'sets the category' do
|
20
|
-
expect(
|
21
|
+
expect(json['categories']).to eq ['Complexity']
|
21
22
|
end
|
22
23
|
|
23
24
|
it 'constructs a description based on the context and message' do
|
24
|
-
expect(
|
25
|
+
expect(json['description']).to eq 'context foo message bar'
|
25
26
|
end
|
26
27
|
|
27
28
|
it 'sets a check name based on the smell detector' do
|
28
|
-
expect(
|
29
|
+
expect(json['check_name']).to eq 'UtilityFunction'
|
29
30
|
end
|
30
31
|
|
31
32
|
it 'sets the location' do
|
32
|
-
expect(
|
33
|
+
expect(json['location']).to eq('path' => 'a/ruby/source/file.rb',
|
34
|
+
'lines' => { 'begin' => 1, 'end' => 2 })
|
33
35
|
end
|
34
36
|
|
35
37
|
it 'sets a content based on the smell detector' do
|
36
|
-
expect(
|
37
|
-
|
38
|
-
)
|
38
|
+
expect(json['content']['body']).
|
39
|
+
to eq "A _Utility Function_ is any instance method that has no dependency on the state of the instance.\n"
|
39
40
|
end
|
40
41
|
|
41
42
|
it 'sets remediation points based on the smell detector' do
|
42
|
-
expect(
|
43
|
+
expect(json['remediation_points']).to eq 250_000
|
43
44
|
end
|
44
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Rutherford
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-
|
14
|
+
date: 2016-07-05 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: codeclimate-engine-rb
|