debride 1.8.0 → 1.8.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
- checksums.yaml.gz.sig +1 -2
- data.tar.gz.sig +2 -2
- data/History.rdoc +12 -0
- data/README.rdoc +15 -0
- data/lib/debride.rb +19 -3
- data/test/test_debride.rb +20 -0
- metadata +13 -14
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6c48bfb811ddf65ebb59e059f86fdc044a6fee24
|
|
4
|
+
data.tar.gz: ca159205e89ef9ad140c609a54d5b9e1f5e5d9ab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d50c5b8b1b7f9d93fcd749fbf54ed1498d0cf119e1cb69040d68613af87d3724b4bed9e3fdb542d81652da79379fa05b02b6e2f894de7c0f80c3f58440c1616d
|
|
7
|
+
data.tar.gz: a494099a812064e03a10f8ff6820a02321c9f36985df86b3dabeaf068c2feced7b9b7b91c70509c6e8edd215810042ac0ba1f1e950dfd38c312b3ab65b8959dd
|
checksums.yaml.gz.sig
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
�ߖ�t�!N��
|
|
1
|
+
|��+S�s���p�S&�xRLs��\�ro�y�7��G}X1�q�S6?V+���q����-w�&��V8B���<�E��_� va2E��Qs�t�^����S�v�!X݈��oy�݆�|?��� ���Y.V��4�;Xs���څ��<Аʹ�YvM�T�����Kq�!7
|
data.tar.gz.sig
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
�Fc�;�eiBV[+�,j�ݎ
|
|
2
|
+
�_C�'�g*D���XQ�~����P�����]l}խ�N�������g-�B��JO*��w��[/q$v�N}�ؑ�2E����U��e�@}H�Dw�C����)�^�t��u�ԯ�'F~�q�
|
data/History.rdoc
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
=== 1.8.1 / 2017-11-29
|
|
2
|
+
|
|
3
|
+
* 2 minor enhancements:
|
|
4
|
+
|
|
5
|
+
* Add basic support for jbuilder files. (d-mato)
|
|
6
|
+
* Added rails & whitelist example to readme. (TheRusskiy)
|
|
7
|
+
|
|
8
|
+
* 2 bug fixes:
|
|
9
|
+
|
|
10
|
+
* Capture RegexpError and skip file. (mrdShinse)
|
|
11
|
+
* Fixed reporting of cdecl+const2 (eg X::Y = 42). (herwinw)
|
|
12
|
+
|
|
1
13
|
=== 1.8.0 / 2017-05-09
|
|
2
14
|
|
|
3
15
|
* 1 minor enhancement:
|
data/README.rdoc
CHANGED
|
@@ -42,6 +42,21 @@ API), then you can whitelist it:
|
|
|
42
42
|
MyClass
|
|
43
43
|
bad_method lib/some/file.rb:20
|
|
44
44
|
...
|
|
45
|
+
|
|
46
|
+
Usage example for a typical rails application:
|
|
47
|
+
# dump rake routes into a file
|
|
48
|
+
% rake routes > routes.txt
|
|
49
|
+
# generate whitelist based on routes and usages from production log
|
|
50
|
+
% debride_rails_whitelist routes.txt log/production.log | sort -u > whitelist.txt
|
|
51
|
+
# add migration methods
|
|
52
|
+
% echo up >> whitelist.txt
|
|
53
|
+
% echo down >> whitelist.txt
|
|
54
|
+
% echo change >> whitelist.txt
|
|
55
|
+
# output debride report co standard output with the following options:
|
|
56
|
+
# ignore typical rails methods,
|
|
57
|
+
# specify generated whitelist,
|
|
58
|
+
# run in current directory (".")
|
|
59
|
+
% debride --rails --whitelist whitelist.txt .
|
|
45
60
|
|
|
46
61
|
You can also use regexps in your whitelist by delimiting them with //'s.
|
|
47
62
|
|
data/lib/debride.rb
CHANGED
|
@@ -22,7 +22,7 @@ end
|
|
|
22
22
|
# A static code analyzer that points out possible dead methods.
|
|
23
23
|
|
|
24
24
|
class Debride < MethodBasedSexpProcessor
|
|
25
|
-
VERSION = "1.8.
|
|
25
|
+
VERSION = "1.8.1" # :nodoc:
|
|
26
26
|
PROJECT = "debride"
|
|
27
27
|
|
|
28
28
|
def self.load_plugins proj = PROJECT
|
|
@@ -50,7 +50,7 @@ class Debride < MethodBasedSexpProcessor
|
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def self.file_extensions
|
|
53
|
-
%w[rb rake] + load_plugins
|
|
53
|
+
%w[rb rake jbuilder] + load_plugins
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
##
|
|
@@ -108,7 +108,7 @@ class Debride < MethodBasedSexpProcessor
|
|
|
108
108
|
|
|
109
109
|
rp = RubyParser.for_current_ruby rescue RubyParser.new
|
|
110
110
|
rp.process(file, path, option[:timeout])
|
|
111
|
-
rescue Racc::ParseError => e
|
|
111
|
+
rescue Racc::ParseError, RegexpError => e
|
|
112
112
|
warn "Parse Error parsing #{path}. Skipping."
|
|
113
113
|
warn " #{e.message}"
|
|
114
114
|
rescue Timeout::Error
|
|
@@ -296,6 +296,9 @@ class Debride < MethodBasedSexpProcessor
|
|
|
296
296
|
|
|
297
297
|
def process_cdecl exp # :nodoc:
|
|
298
298
|
_, name, val = exp
|
|
299
|
+
|
|
300
|
+
name = name_to_string process name if Sexp === name
|
|
301
|
+
|
|
299
302
|
process val
|
|
300
303
|
|
|
301
304
|
signature = "#{klass_name}::#{name}"
|
|
@@ -307,6 +310,19 @@ class Debride < MethodBasedSexpProcessor
|
|
|
307
310
|
exp
|
|
308
311
|
end
|
|
309
312
|
|
|
313
|
+
def name_to_string exp
|
|
314
|
+
case exp.sexp_type
|
|
315
|
+
when :colon2 then
|
|
316
|
+
_, (_, lhs), rhs = exp
|
|
317
|
+
"#{lhs}::#{rhs}"
|
|
318
|
+
when :colon3 then
|
|
319
|
+
_, rhs = exp
|
|
320
|
+
"::#{rhs}"
|
|
321
|
+
else
|
|
322
|
+
raise "Not handled: #{exp.inspect}"
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
|
|
310
326
|
def process_colon2 exp # :nodoc:
|
|
311
327
|
_, lhs, name = exp
|
|
312
328
|
process lhs
|
data/test/test_debride.rb
CHANGED
|
@@ -186,6 +186,26 @@ class TestDebride < Minitest::Test
|
|
|
186
186
|
assert_process exp, ruby, :rails => true
|
|
187
187
|
end
|
|
188
188
|
|
|
189
|
+
def test_cdecl_const2
|
|
190
|
+
ruby = <<-RUBY.strip
|
|
191
|
+
class Z
|
|
192
|
+
X::Y = 42
|
|
193
|
+
end
|
|
194
|
+
RUBY
|
|
195
|
+
|
|
196
|
+
assert_process [["Z", ["X::Y"]]], ruby
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def test_cdecl_const3
|
|
200
|
+
ruby = <<-RUBY.strip
|
|
201
|
+
class Z
|
|
202
|
+
::Y = 42
|
|
203
|
+
end
|
|
204
|
+
RUBY
|
|
205
|
+
|
|
206
|
+
assert_process [["Z", ["::Y"]]], ruby
|
|
207
|
+
end
|
|
208
|
+
|
|
189
209
|
def test_method_send
|
|
190
210
|
ruby = <<-RUBY.strip
|
|
191
211
|
class Seattle
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: debride
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.8.
|
|
4
|
+
version: 1.8.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Davis
|
|
@@ -10,9 +10,9 @@ bindir: bin
|
|
|
10
10
|
cert_chain:
|
|
11
11
|
- |
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
|
13
|
-
|
|
13
|
+
MIIDPjCCAiagAwIBAgIBAjANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
|
|
14
14
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
|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FnXGajxuBRnL66E15KU0BNehVxdG258bdPu
|
|
28
|
+
EKN6MqBPftFiev3tuwqDV11r2GquDpniYcT+Mi8/PgeAgVT/afBeVgbB3KaZeTRR
|
|
29
|
+
AhXhF6Wi2GTMezlj5jlI5XV7WsJUSwTp/YiVvcmT74ZaCRvexm6EnNhkrvJJ1Xeu
|
|
30
|
+
V+HB+LYYhXWitInO/eXxDrFB
|
|
32
31
|
-----END CERTIFICATE-----
|
|
33
|
-
date: 2017-
|
|
32
|
+
date: 2017-11-29 00:00:00.000000000 Z
|
|
34
33
|
dependencies:
|
|
35
34
|
- !ruby/object:Gem::Dependency
|
|
36
35
|
name: sexp_processor
|
|
@@ -147,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
147
146
|
version: '0'
|
|
148
147
|
requirements: []
|
|
149
148
|
rubyforge_project:
|
|
150
|
-
rubygems_version: 2.6.
|
|
149
|
+
rubygems_version: 2.6.13
|
|
151
150
|
signing_key:
|
|
152
151
|
specification_version: 4
|
|
153
152
|
summary: Analyze code for potentially uncalled / dead methods, now with auto-removal.
|
metadata.gz.sig
CHANGED
|
Binary file
|