reek 3.8.2 → 3.8.3

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: 4b0a5ac6a8b0b3a7b7c68c09462e3337c8914e9e
4
- data.tar.gz: 519f5ade29783ce076e8b6ee58b126ccef9afc27
3
+ metadata.gz: bee0377800c5a5a58c7a27bf63f92cc56b195327
4
+ data.tar.gz: d824f0e71d925b69c3c2d23d95b4a4c68f4d5a2c
5
5
  SHA512:
6
- metadata.gz: 336a10dfe8f830398b76dc288aab1eaad282d6f6e83d904d5292ee08436ea932e14090f791f9eee039fea211b772aee472ca66a0f31f4b10c5742db147b5e414
7
- data.tar.gz: 8a120730d0611c4ca5e23bbddfca5c0ea76badf734dfe925588b299e2d5508298cbeae7be1c943e6e3b8dfe21e813907085eda4fcf15024c96dd32926edd0f4d
6
+ metadata.gz: fdd5cd74638b200650968a537305b71aca06e986643a30a06f703652f59e0b663510425dd4aaf5ebc292fd315ecf85793dca4bfe3aff14873ddfddb15602103c
7
+ data.tar.gz: 9bea39cdfbaf775cf748852b69bc009f8b1adfa7b6cfa1f5763810c3236c1ed5f5336691e81e34d88bc66ba2c3208605d291104531711beb4778614d91d2af55
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 3.8.3 (2016-01-15)
6
+
7
+ * (avdgaag) Accept FileList as Rake task source file
8
+
5
9
  ## 3.8.2 (2016-01-07)
6
10
 
7
11
  * (pocke) Skip path if path doesn't exist.
@@ -41,6 +41,14 @@ Reek::Rake::Task.new do |t|
41
41
  end
42
42
  ```
43
43
 
44
+ Alternatively, you can create your own [Rake::FileList](http://rake.rubyforge.org/classes/Rake/FileList.html) and use that for `source_files`:
45
+
46
+ ```Ruby
47
+ Reek::Rake::Task.new do |t|
48
+ t.source_files = FileList['lib/**/*.rb'].exclude('lib/templates/**/*.rb')
49
+ end
50
+ ```
51
+
44
52
  ## Configuration via environment variables
45
53
 
46
54
  You can overwrite the following attributes by environment variables:
@@ -45,3 +45,30 @@ class ContextBuilder
45
45
  end
46
46
  ```
47
47
 
48
+ Note that disabling this detector via comment works on a class scope, not
49
+ a method scope (like you can see above).
50
+
51
+ ## Known limitations
52
+
53
+ * Method calls via dynamic dispatch (e.g. via `send`) is something `Reek` (or any other
54
+ static tool for that matter) can not detect.
55
+ * Method calls via callback like [Rails filters](http://guides.rubyonrails.org/action_controller_overview.html#filters)
56
+ will trigger this as well, e.g.:
57
+
58
+ ```Ruby
59
+ class BankController < ActionController::Base
60
+ before_filter :audit
61
+
62
+ private
63
+ def audit
64
+ # ....
65
+ end
66
+ end
67
+ ```
68
+ * `Reek` works on a per-file base. This means that using something like the [template pattern](https://en.wikipedia.org/wiki/Template_method_pattern)
69
+ with private methods will trigger this detector.
70
+ We do believe though that using private methods to fill out a template in a
71
+ superclass is not a good idea in general so this probably isn't really a problem
72
+ but still worth mentioning it.
73
+
74
+
@@ -20,6 +20,24 @@ Feature: Reek can be driven through its Task
20
20
  [3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
21
21
  """
22
22
 
23
+ Scenario: source_files using a FileList instead of a String
24
+ Given a smelly file called 'smelly.rb'
25
+ When I run rake reek with:
26
+ """
27
+ Reek::Rake::Task.new do |t|
28
+ t.source_files = FileList['smelly.*']
29
+ t.reek_opts = '--no-color'
30
+ end
31
+ """
32
+ Then the exit status indicates an error
33
+ And it reports:
34
+ """
35
+ smelly.rb -- 3 warnings:
36
+ [4, 5]:DuplicateMethodCall: Smelly#m calls @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
37
+ [4, 5]:DuplicateMethodCall: Smelly#m calls puts(@foo.bar) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
38
+ [3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
39
+ """
40
+
23
41
  Scenario: name changes the task name
24
42
  Given a smelly file called 'smelly.rb'
25
43
  When I run rake silky with:
@@ -85,7 +85,10 @@ module Reek
85
85
 
86
86
  # @public
87
87
  def source_files=(files)
88
- raise ArgumentError, no_string_given_for_file_list_warning unless files.is_a?(String)
88
+ unless files.is_a?(String) || files.is_a?(FileList)
89
+ raise ArgumentError, 'File list should be a FileList or a String that can contain'\
90
+ " a glob pattern, e.g. '{app,lib,spec}/**/*.rb'"
91
+ end
89
92
  @source_files = FileList[files]
90
93
  end
91
94
 
@@ -93,10 +96,6 @@ module Reek
93
96
 
94
97
  private_attr_reader :fail_on_error, :name, :verbose
95
98
 
96
- def no_string_given_for_file_list_warning
97
- "File list should be a String that can contain a glob pattern, e.g. '{app,lib,spec}/**/*.rb'"
98
- end
99
-
100
99
  def define_task
101
100
  desc 'Check for code smells'
102
101
  task(name) { run_task }
@@ -6,6 +6,6 @@ module Reek
6
6
  # @public
7
7
  module Version
8
8
  # @public
9
- STRING = '3.8.2'
9
+ STRING = '3.8.3'
10
10
  end
11
11
  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: 3.8.2
4
+ version: 3.8.3
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-01-07 00:00:00.000000000 Z
14
+ date: 2016-01-15 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: codeclimate-engine-rb
@@ -538,7 +538,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
538
538
  version: '0'
539
539
  requirements: []
540
540
  rubyforge_project:
541
- rubygems_version: 2.4.5
541
+ rubygems_version: 2.4.5.1
542
542
  signing_key:
543
543
  specification_version: 4
544
544
  summary: Code smell detector for Ruby