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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9997dcf31c73430147cd74d4365cacc011a9ddf9
4
- data.tar.gz: 0d52faa989d72642bfc90eb59efe69c1eb29bd85
3
+ metadata.gz: 6c48bfb811ddf65ebb59e059f86fdc044a6fee24
4
+ data.tar.gz: ca159205e89ef9ad140c609a54d5b9e1f5e5d9ab
5
5
  SHA512:
6
- metadata.gz: '090808da18149228a64261245d549cb50fa78141b73428a913fe606b61f700bec4ada3de220c5b9ff01e48b1f15f94daa93a4296f570d8da65f6cea7bf53e124'
7
- data.tar.gz: 73af8d47c93780a568590bc7bf34b4ff4df80dd6ce9e877d01347b232ca2907274b7d1cb4b090481a5aaab13e23f2e3575324a02e9f49c10bffb513c7817086b
6
+ metadata.gz: d50c5b8b1b7f9d93fcd749fbf54ed1498d0cf119e1cb69040d68613af87d3724b4bed9e3fdb542d81652da79379fa05b02b6e2f894de7c0f80c3f58440c1616d
7
+ data.tar.gz: a494099a812064e03a10f8ff6820a02321c9f36985df86b3dabeaf068c2feced7b9b7b91c70509c6e8edd215810042ac0ba1f1e950dfd38c312b3ab65b8959dd
@@ -1,2 +1 @@
1
- ����⫤MdWr
2
- �ߖ�t�!N��
1
+ |��+Ss���p�S&�xRLs��\�ro�y�7��G}X1�q�S໅6?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
- ����v�| $����c������>�D{=�\�U��\���V�!�*�譡#߂��$�&W���9�фIt~�}����q�.�A�Vճ`RK��N�S�s
2
- tW������M�4�r&�pvZKfG�=�����0xK��Q!��� uz�(8�`�eE@�}8���S��u/-,��]LjJxn଑q�|#
1
+ �Fc�;�eiBV[+�,j�ݎ
2
+ _C'g*D���XQ�~����P�����]l}խ�N�������g-� B��JO*��w��[/q$vN}�ؑ�2E����U��e�@}H�Dw�C����)�^�t��u�ԯ�'F~�q
@@ -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:
@@ -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
 
@@ -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.0" # :nodoc:
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
@@ -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.0
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
- MIIDijCCAnKgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDPjCCAiagAwIBAgIBAjANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTE2MDkyNjAxNTczNVoXDTE3MDkyNjAxNTczNVowRTETMBEGA1UE
15
+ GRYDY29tMB4XDTE3MTEyMTIxMTExMFoXDTE4MTEyMTIxMTExMFowRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
17
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
18
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -20,17 +20,16 @@ cert_chain:
20
20
  oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
21
21
  GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
22
22
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
- gBEfoTEGr7Zii72cx+sCAwEAAaOBhDCBgTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIE
24
- sDAdBgNVHQ4EFgQUR8V72Z3+v+2P9abCnL4wjx32T+EwIwYDVR0RBBwwGoEYcnlh
25
- bmQtcnVieUB6ZW5zcGlkZXIuY29tMCMGA1UdEgQcMBqBGHJ5YW5kLXJ1YnlAemVu
26
- c3BpZGVyLmNvbTANBgkqhkiG9w0BAQUFAAOCAQEAIGzgp0aZ2W9+v96ujmBcQHoC
27
- buy0iU68MVj2VlxMyfr1KPZIh1OyhU4UO4zrkREcH8ML70v9cYHNvOd9oynRHnvC
28
- l2tj/fD3YJ0AEkJxGrYwRWQmvMfC4bJ02bC1+rVOUIXXKp3+cUmiN4sTniof8VFo
29
- bo/YYP4c7erpERa+9hrqygg6WQbJlk2YRlH3JXPFjmu869i2dcbR5ZLOAeEy+axH
30
- E4oJcnPkJAr0rw504JGtlZtONZQblwmRJOIdXzolaE3NRGUzGVOUSptZppAKiavY
31
- fO6tdKQc/5RfA8oQEkg8hrxA5PQSz4TOFJGLpFvIapEk6tMruQ0bHgkhr9auXg==
23
+ gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
24
+ HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
25
+ AQAfAXSQpsW7YSxd1csRtA/M4Zt0AMXFMd76GJ8Lgtg8G0+VFbdChRyDuDb0kPlW
26
+ h9QQX/YABfCW8vxmssbMGrP+VGBAn7BbdTcfTlgCWrvMX1uL5aRL74nA4urKXqdW
27
+ a0nP70K4958P3GffBdtE3KGkU5xstFnXGajxuBRnL66E15KU0BNehVxdG258bdPu
28
+ EKN6MqBPftFiev3tuwqDV11r2GquDpniYcT+Mi8/PgeAgVT/afBeVgbB3KaZeTRR
29
+ AhXhF6Wi2GTMezlj5jlI5XV7WsJUSwTp/YiVvcmT74ZaCRvexm6EnNhkrvJJ1Xeu
30
+ V+HB+LYYhXWitInO/eXxDrFB
32
31
  -----END CERTIFICATE-----
33
- date: 2017-05-09 00:00:00.000000000 Z
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.8
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