rubycritic 2.8.0 → 2.9.0

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: 98d2664f3cdb47e1c19d036b56085e1f62d7f930
4
- data.tar.gz: 08a7a743ec2f7891a694bb2e27fb96c905c6ec58
3
+ metadata.gz: 1dbaa6b17360c86029115d0519f0f0219ca5bc1d
4
+ data.tar.gz: ae570da462c045f67baa3a18bc7fc68ea4713561
5
5
  SHA512:
6
- metadata.gz: 993ea1b9d055be63eabcba5a8706fcf1aa8b5f9bd04a6681f1ed79f92fc22503892c6fbeabed3be0e1d80383b91fc25dbccb1ddf51450cdbc82a58e51335bc5d
7
- data.tar.gz: 721f4a64f158559101ea871cbfa88474993487861e95f623d01b5667a0cca1c4e39869ee26b6fa97ddfaffd97f848a86e2a61dececf4e564a55b8101998778bc
6
+ metadata.gz: 623d51c7a505561830c35cdf90cc75a9102a1da66cc050b1e125f7f5cd0cef659b1d146714b186e9a591b72089855c4664e4322b3fdc659b64210458e34a6985
7
+ data.tar.gz: b22749541a3981cd8109d20cf098c4e7be6ed4e10e03c43fe67dcf024b28546ac4688ba08c739c4e1b9db6d8ca19606e3b7d30c98bf9e577323df2c80916fcec
data/.todo.reek CHANGED
@@ -77,6 +77,7 @@ DuplicateMethodCall:
77
77
  - Parser::AST::Node#module_name
78
78
  TooManyStatements:
79
79
  exclude:
80
+ - Rubycritic::RakeTask#initialize
80
81
  - Rubycritic::Analyser::Complexity#run
81
82
  - Parser::AST::Node#get_module_names
82
83
  - Rubycritic::Analyser::FlaySmells#run
@@ -2,7 +2,6 @@ sudo: false
2
2
  language: ruby
3
3
 
4
4
  rvm:
5
- - 2.0.0-p648
6
5
  - 2.1.8
7
6
  - 2.2.4
8
7
  - 2.3.0
@@ -1,3 +1,11 @@
1
+ # 2.9.0 / 2016-04-12
2
+
3
+ * [FEATURE] Add links to Flay and Flog code smells documentation (by ragesoss)
4
+ * [FEATURE] Documentation updates (by troessner)
5
+ * [CHANGE] Bump Rubocop to 0.39.0 (by nijikon)
6
+ * [CHANGE] Bump Reek to 4.0.1 (by nijikon)
7
+ * [CHANGE] Drop support for Ruby 2.0 (by nijikon)
8
+
1
9
  # 2.8.0 / 2016-02-29
2
10
 
3
11
  * [FEATURE] Add link to Reek's code smells documentation (by danielmbarlow)
data/README.md CHANGED
@@ -108,7 +108,10 @@ Analyzer Configuration
108
108
  This means that if you have an existing `Reek` configuration file, you can just put this into your
109
109
  project root and `RubyCritic` will respect this configuration.
110
110
  * [`flay`](https://github.com/seattlerb/flay): We use `flay`'s default configuration.
111
- * [`flog`](https://github.com/seattlerb/flog): We use `flog`'s default configuration with a couple of [smaller tweaks](https://github.com/whitesmith/rubycritic/blob/master/lib/rubycritic/analysers/helpers/flog.rb#L5).
111
+ * [`flog`](https://github.com/seattlerb/flog): We use `flog`'s default configuration with a couple of [smaller tweaks](https://github.com/whitesmith/rubycritic/blob/master/lib/rubycritic/analysers/helpers/flog.rb#L5):
112
+ * `all`: Forces `flog` to report scores on all classes and methods. Without this option `flog` will only give results up to a certain threshold.
113
+ * `continue`: Makes it so that `flog` does not abort when a ruby file cannot be parsed.
114
+ * `methods`: Configures `flog` to skip code outside of methods. It prevents `flog` from reporting on the "methods" `private` and `protected`. It also prevents `flog` from reporting on Rails methods like `before_action` and `has_many`.
112
115
 
113
116
  Alternative Usage Methods
114
117
  -------------------------
@@ -161,7 +164,6 @@ Compatibility
161
164
 
162
165
  RubyCritic is supporting:
163
166
 
164
- * 2.0
165
167
  * 2.1
166
168
  * 2.2
167
169
  * 2.3
@@ -48,6 +48,7 @@ module Rubycritic
48
48
  message: "found in #{nodes.size} nodes",
49
49
  score: mass,
50
50
  type: 'DuplicateCode',
51
+ analyser: 'flay',
51
52
  cost: cost(mass)
52
53
  )
53
54
  end
@@ -46,6 +46,7 @@ module Rubycritic
46
46
  message: "has a flog score of #{score}",
47
47
  score: score,
48
48
  type: type(score),
49
+ analyser: 'flog',
49
50
  cost: 0
50
51
  )
51
52
  end
@@ -36,6 +36,7 @@ module Rubycritic
36
36
  context: smell.context,
37
37
  message: smell.message,
38
38
  type: smell.smell_type,
39
+ analyser: 'reek',
39
40
  cost: 0
40
41
  )
41
42
  end
@@ -12,6 +12,10 @@ module Rubycritic
12
12
  attribute :score
13
13
  attribute :status
14
14
  attribute :type
15
+ attribute :analyser
16
+
17
+ FLAY_DOCS_URL = 'http://docs.seattlerb.org/flay/'.freeze
18
+ FLOG_DOCS_URL = 'http://docs.seattlerb.org/flog/'.freeze
15
19
 
16
20
  def at_location?(other_location)
17
21
  locations.any? { |location| location == other_location }
@@ -47,7 +51,16 @@ module Rubycritic
47
51
  end
48
52
 
49
53
  def doc_url
50
- "https://github.com/troessner/reek/blob/master/docs/#{dasherized_type}.md"
54
+ case analyser
55
+ when 'reek'
56
+ "https://github.com/troessner/reek/blob/master/docs/#{dasherized_type}.md"
57
+ when 'flay'
58
+ FLAY_DOCS_URL
59
+ when 'flog'
60
+ FLOG_DOCS_URL
61
+ else
62
+ raise "No documentation URL set for analyser '#{analyser}' smells"
63
+ end
51
64
  end
52
65
 
53
66
  def hash
@@ -19,7 +19,6 @@ module Rubycritic
19
19
  # task.paths = FileList['lib/**/*.rb', 'spec/**/*.rb']
20
20
  # end
21
21
  #
22
- # :reek:TooManyStatements: { max_statements: 6 }
23
22
  class RakeTask < ::Rake::TaskLib
24
23
  # Name of RubyCritic task. Defaults to :rubycritic.
25
24
  attr_writer :name
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rubycritic
4
- VERSION = '2.8.0'.freeze
4
+ VERSION = '2.9.0'.freeze
5
5
  end
@@ -23,8 +23,8 @@ Gem::Specification.new do |spec|
23
23
  spec.add_runtime_dependency 'virtus', '~> 1.0'
24
24
  spec.add_runtime_dependency 'flay', '2.7.0'
25
25
  spec.add_runtime_dependency 'flog', '4.3.2'
26
- spec.add_runtime_dependency 'reek', '3.11'
27
- spec.add_runtime_dependency 'parser', '~> 2.3'
26
+ spec.add_runtime_dependency 'reek', '4.0.1'
27
+ spec.add_runtime_dependency 'parser', '2.3.0.7'
28
28
  spec.add_runtime_dependency 'ruby_parser', '~> 3.8'
29
29
  spec.add_runtime_dependency 'colorize'
30
30
  spec.add_runtime_dependency 'launchy', '2.4.3'
@@ -35,6 +35,6 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency 'rake'
36
36
  spec.add_development_dependency 'minitest', '~> 5.3'
37
37
  spec.add_development_dependency 'mocha', '~> 1.1'
38
- spec.add_development_dependency 'rubocop', '0.37.2'
38
+ spec.add_development_dependency 'rubocop', '0.39.0'
39
39
  spec.add_development_dependency 'pry-byebug'
40
40
  end
@@ -71,16 +71,33 @@ describe Rubycritic::Smell do
71
71
  end
72
72
 
73
73
  describe '#doc_url' do
74
- it 'handles one word type names' do
75
- smell = Rubycritic::Smell.new(type: 'Complexity')
74
+ it 'handles one word type names for reek smells' do
75
+ smell = Rubycritic::Smell.new(type: 'Complexity', analyser: 'reek')
76
76
 
77
77
  smell.doc_url.must_equal('https://github.com/troessner/reek/blob/master/docs/Complexity.md')
78
78
  end
79
79
 
80
- it 'handles multiple word type names' do
81
- smell = Rubycritic::Smell.new(type: 'TooManyStatements')
80
+ it 'handles multiple word type names for reek smells' do
81
+ smell = Rubycritic::Smell.new(type: 'TooManyStatements', analyser: 'reek')
82
82
 
83
83
  smell.doc_url.must_equal('https://github.com/troessner/reek/blob/master/docs/Too-Many-Statements.md')
84
84
  end
85
+
86
+ it 'handles flay smells' do
87
+ smell = Rubycritic::Smell.new(type: 'DuplicateCode', analyser: 'flay')
88
+
89
+ smell.doc_url.must_equal('http://docs.seattlerb.org/flay/')
90
+ end
91
+
92
+ it 'handles flog smells' do
93
+ smell = Rubycritic::Smell.new(type: 'VeryHighComplexity', analyser: 'flog')
94
+
95
+ smell.doc_url.must_equal('http://docs.seattlerb.org/flog/')
96
+ end
97
+
98
+ it 'raises an error for unknown analysers' do
99
+ smell = Rubycritic::Smell.new(type: 'FooSmell', analyser: 'foo')
100
+ assert_raises { smell.doc_url }
101
+ end
85
102
  end
86
103
  end
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.8.0
4
+ version: 2.9.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-03-01 00:00:00.000000000 Z
11
+ date: 2016-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: '3.11'
61
+ version: 4.0.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.11'
68
+ version: 4.0.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: parser
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: '2.3'
75
+ version: 2.3.0.7
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: '2.3'
82
+ version: 2.3.0.7
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: ruby_parser
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -212,14 +212,14 @@ dependencies:
212
212
  requirements:
213
213
  - - '='
214
214
  - !ruby/object:Gem::Version
215
- version: 0.37.2
215
+ version: 0.39.0
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - '='
221
221
  - !ruby/object:Gem::Version
222
- version: 0.37.2
222
+ version: 0.39.0
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: pry-byebug
225
225
  requirement: !ruby/object:Gem::Requirement
@@ -454,3 +454,4 @@ test_files:
454
454
  - test/samples/reek/smelly.rb
455
455
  - test/samples/unparsable.rb
456
456
  - test/test_helper.rb
457
+ has_rdoc: