debride 1.12.0 → 1.14.0
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 +0 -0
- data/History.rdoc +18 -0
- data/Rakefile +2 -2
- data/bin/debride +1 -1
- data/bin/debride_rails_whitelist +1 -1
- data/bin/debride_rm +10 -3
- data/lib/debride.rb +26 -7
- data/test/test_debride.rb +5 -2
- data.tar.gz.sig +0 -0
- metadata +18 -21
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3a714288d6ecf460fcc966b8affc300f4bfe72da8e7d955e1345d757fbe389e9
|
|
4
|
+
data.tar.gz: '0608d18319513d0193482b503def7a86b7fc1544dfffb1048849d74b0b0d1728'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c7faa53a9d8aaa8e1f6bb5673ac7619a357a34d75636eaaab43fc017814cac33805dcb0904385d19a4e1d32b95ccc6a01877083a379ee74e6c91847b4713e278
|
|
7
|
+
data.tar.gz: ec449e3d4d5bdae20271e58d54da4dce6050866e56493d68f7ce236bb7829e51f342185576c5a772ee6e140e1855557598bd9062c5b9cc6f4d2112ea3fc16ed7
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/History.rdoc
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
=== 1.14.0 / 2025-12-11
|
|
2
|
+
|
|
3
|
+
* 2 minor enhancements:
|
|
4
|
+
|
|
5
|
+
* Bumped path_expander to 2.0.0.
|
|
6
|
+
* Switched to prism for ruby parsing. Use --legacy for RubyParser.
|
|
7
|
+
|
|
8
|
+
=== 1.13.0 / 2025-06-10
|
|
9
|
+
|
|
10
|
+
* 2 minor enhancements:
|
|
11
|
+
|
|
12
|
+
* Added -y to debride_rm to opt-in to running autoclave.
|
|
13
|
+
* Print command for autoclave to help see what's happening.
|
|
14
|
+
|
|
15
|
+
* 1 bug fix:
|
|
16
|
+
|
|
17
|
+
* Fixed shebangs on all bin/* files, added -w for all.
|
|
18
|
+
|
|
1
19
|
=== 1.12.0 / 2023-05-18
|
|
2
20
|
|
|
3
21
|
* 1 major enhancement:
|
data/Rakefile
CHANGED
|
@@ -21,8 +21,8 @@ Hoe.spec "debride" do
|
|
|
21
21
|
license "MIT"
|
|
22
22
|
|
|
23
23
|
dependency "sexp_processor", "~> 4.17"
|
|
24
|
-
dependency "
|
|
25
|
-
dependency "path_expander", "~>
|
|
24
|
+
dependency "prism", "~> 1.5"
|
|
25
|
+
dependency "path_expander", "~> 2.0"
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def run dir, whitelist
|
data/bin/debride
CHANGED
data/bin/debride_rails_whitelist
CHANGED
data/bin/debride_rm
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
#!/usr/bin/env ruby -ws
|
|
1
|
+
#!/usr/bin/env -S ruby -ws
|
|
2
2
|
|
|
3
3
|
$C ||= false # command to run between deletions
|
|
4
|
+
$y ||= false # yes, actually execute autoclave
|
|
4
5
|
|
|
5
6
|
require "set"
|
|
6
7
|
require_relative "../lib/debride"
|
|
@@ -19,14 +20,20 @@ def autoclave nuke, cmd
|
|
|
19
20
|
end
|
|
20
21
|
end
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
if cmd then
|
|
24
|
+
expanded = cmd.gsub(/\bNAME\b/, "#{klass}##{name}").gsub(/\bPATH\b/, path)
|
|
25
|
+
warn "CMD = %p" % [expanded]
|
|
26
|
+
`#{expanded}` if $y
|
|
27
|
+
end
|
|
23
28
|
end
|
|
24
29
|
end
|
|
25
30
|
|
|
26
31
|
iter = 0
|
|
27
32
|
old_count = nil
|
|
28
33
|
|
|
29
|
-
abort "usage: #{$0} [-C=cmd] [debride args]+" if ARGV.empty? or ARGV.include? "-h"
|
|
34
|
+
abort "usage: #{$0} [-y] [-C=cmd] [debride args]+" if ARGV.empty? or ARGV.include? "-h"
|
|
35
|
+
|
|
36
|
+
warn "NOT running commands, use -y to execute" unless $y
|
|
30
37
|
|
|
31
38
|
loop do
|
|
32
39
|
iter += 1
|
data/lib/debride.rb
CHANGED
|
@@ -4,15 +4,27 @@ require "optparse"
|
|
|
4
4
|
require "set"
|
|
5
5
|
require "stringio"
|
|
6
6
|
|
|
7
|
-
require "ruby_parser"
|
|
8
7
|
require "sexp_processor"
|
|
9
8
|
require "path_expander"
|
|
10
9
|
|
|
10
|
+
require "prism"
|
|
11
|
+
require "prism/translation/ruby_parser"
|
|
12
|
+
|
|
13
|
+
unless Prism::Translation::RubyParser.method_defined? :process then
|
|
14
|
+
class Prism::Translation::RubyParser # compatibility layer
|
|
15
|
+
def process(ruby, file, timeout=nil) =
|
|
16
|
+
Timeout.timeout(timeout) { parse ruby, file }
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class NotRubyParser < Prism::Translation::RubyParser # compatibility layer
|
|
21
|
+
end
|
|
22
|
+
|
|
11
23
|
##
|
|
12
24
|
# A static code analyzer that points out possible dead methods.
|
|
13
25
|
|
|
14
26
|
class Debride < MethodBasedSexpProcessor
|
|
15
|
-
VERSION = "1.
|
|
27
|
+
VERSION = "1.14.0" # :nodoc:
|
|
16
28
|
PROJECT = "debride"
|
|
17
29
|
|
|
18
30
|
def self.load_plugins proj = PROJECT
|
|
@@ -47,14 +59,12 @@ class Debride < MethodBasedSexpProcessor
|
|
|
47
59
|
# Top level runner for bin/debride.
|
|
48
60
|
|
|
49
61
|
def self.run args
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
debride = Debride.new opt
|
|
62
|
+
debride = Debride.new parse_options args
|
|
53
63
|
|
|
54
64
|
extensions = self.file_extensions
|
|
55
65
|
glob = "**/*.{#{extensions.join(",")}}"
|
|
56
66
|
expander = PathExpander.new(args, glob)
|
|
57
|
-
files = expander.process
|
|
67
|
+
files = expander.process.to_a
|
|
58
68
|
excl = debride.option[:exclude]
|
|
59
69
|
excl.map! { |fd| File.directory?(fd) ? "#{fd}/**/*" : fd } if excl
|
|
60
70
|
|
|
@@ -97,7 +107,8 @@ class Debride < MethodBasedSexpProcessor
|
|
|
97
107
|
raise "Unhandled type: #{path_or_io.class}:#{path_or_io.inspect}"
|
|
98
108
|
end
|
|
99
109
|
|
|
100
|
-
|
|
110
|
+
parser = option[:parser].new
|
|
111
|
+
parser.process(file, path, option[:timeout])
|
|
101
112
|
rescue Racc::ParseError, RegexpError => e
|
|
102
113
|
warn "Parse Error parsing #{path}. Skipping."
|
|
103
114
|
warn " #{e.message}"
|
|
@@ -161,6 +172,11 @@ class Debride < MethodBasedSexpProcessor
|
|
|
161
172
|
options[:minimum] = n
|
|
162
173
|
end
|
|
163
174
|
|
|
175
|
+
opts.on "--legacy" "Use RubyParser for parsing." do
|
|
176
|
+
require "ruby_parser"
|
|
177
|
+
option[:parser] = RubyParser
|
|
178
|
+
end
|
|
179
|
+
|
|
164
180
|
opts.on("-v", "--verbose", "Verbose. Show progress processing files.") do
|
|
165
181
|
options[:verbose] = true
|
|
166
182
|
end
|
|
@@ -208,6 +224,9 @@ class Debride < MethodBasedSexpProcessor
|
|
|
208
224
|
self.option = { :whitelist => [] }.merge options
|
|
209
225
|
self.known = Hash.new { |h,k| h[k] = Set.new }
|
|
210
226
|
self.called = Set.new
|
|
227
|
+
|
|
228
|
+
option[:parser] ||= NotRubyParser
|
|
229
|
+
|
|
211
230
|
super()
|
|
212
231
|
end
|
|
213
232
|
|
data/test/test_debride.rb
CHANGED
|
@@ -342,8 +342,11 @@ class TestDebride < Minitest::Test
|
|
|
342
342
|
end
|
|
343
343
|
|
|
344
344
|
def test_block_pass_empty
|
|
345
|
-
ruby =
|
|
346
|
-
|
|
345
|
+
ruby = <<~RUBY
|
|
346
|
+
def g(&)
|
|
347
|
+
f(&) # block forwarding
|
|
348
|
+
end
|
|
349
|
+
g
|
|
347
350
|
RUBY
|
|
348
351
|
|
|
349
352
|
assert_process [], ruby
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: debride
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.14.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Davis
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain:
|
|
11
10
|
- |
|
|
12
11
|
-----BEGIN CERTIFICATE-----
|
|
13
|
-
|
|
12
|
+
MIIDPjCCAiagAwIBAgIBCTANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
|
|
14
13
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
|
15
|
-
|
|
14
|
+
GRYDY29tMB4XDTI1MDEwNjIzMjcwMVoXDTI2MDEwNjIzMjcwMVowRTETMBEGA1UE
|
|
16
15
|
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
|
17
16
|
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
|
18
17
|
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
|
@@ -22,14 +21,14 @@ cert_chain:
|
|
|
22
21
|
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
|
23
22
|
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
|
24
23
|
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
AQAC0WQJcPOWPFwkojhzweilRVjTJ19UiLhiBTw3C1wJO3LVdBkWDmnnhAmKuX4D
|
|
25
|
+
r7vjQvESlABGIPdutI1Yl7mrHQzTkfLfXvNN6MT0nLChPyIYauT6SZZxubwJrUfA
|
|
26
|
+
7R0c2CJTIboZ0XaGpLsXqHEF1c29H7TV1QvVuqKAN2mCjh4N82QVn+ZKtys28AwT
|
|
27
|
+
6GfQX2fqLoi4KSc7xIzHKaNzqxeOICmJofk9w5VZ2rRN6yes8jvFYwz9HR41wdj8
|
|
28
|
+
bwfinv7Yp5fA6AysuZLhCykyfDuZVRrUp0Vb68YCKsLjJly/Theak+euNTxvHsB+
|
|
29
|
+
al9oSgPPHICMEX65qvLywitx
|
|
31
30
|
-----END CERTIFICATE-----
|
|
32
|
-
date:
|
|
31
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
33
32
|
dependencies:
|
|
34
33
|
- !ruby/object:Gem::Dependency
|
|
35
34
|
name: sexp_processor
|
|
@@ -46,33 +45,33 @@ dependencies:
|
|
|
46
45
|
- !ruby/object:Gem::Version
|
|
47
46
|
version: '4.17'
|
|
48
47
|
- !ruby/object:Gem::Dependency
|
|
49
|
-
name:
|
|
48
|
+
name: prism
|
|
50
49
|
requirement: !ruby/object:Gem::Requirement
|
|
51
50
|
requirements:
|
|
52
51
|
- - "~>"
|
|
53
52
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
53
|
+
version: '1.5'
|
|
55
54
|
type: :runtime
|
|
56
55
|
prerelease: false
|
|
57
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
58
57
|
requirements:
|
|
59
58
|
- - "~>"
|
|
60
59
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
60
|
+
version: '1.5'
|
|
62
61
|
- !ruby/object:Gem::Dependency
|
|
63
62
|
name: path_expander
|
|
64
63
|
requirement: !ruby/object:Gem::Requirement
|
|
65
64
|
requirements:
|
|
66
65
|
- - "~>"
|
|
67
66
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
67
|
+
version: '2.0'
|
|
69
68
|
type: :runtime
|
|
70
69
|
prerelease: false
|
|
71
70
|
version_requirements: !ruby/object:Gem::Requirement
|
|
72
71
|
requirements:
|
|
73
72
|
- - "~>"
|
|
74
73
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '
|
|
74
|
+
version: '2.0'
|
|
76
75
|
- !ruby/object:Gem::Dependency
|
|
77
76
|
name: rdoc
|
|
78
77
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -113,14 +112,14 @@ dependencies:
|
|
|
113
112
|
requirements:
|
|
114
113
|
- - "~>"
|
|
115
114
|
- !ruby/object:Gem::Version
|
|
116
|
-
version: '4.
|
|
115
|
+
version: '4.3'
|
|
117
116
|
type: :development
|
|
118
117
|
prerelease: false
|
|
119
118
|
version_requirements: !ruby/object:Gem::Requirement
|
|
120
119
|
requirements:
|
|
121
120
|
- - "~>"
|
|
122
121
|
- !ruby/object:Gem::Version
|
|
123
|
-
version: '4.
|
|
122
|
+
version: '4.3'
|
|
124
123
|
description: Analyze code for potentially uncalled / dead methods, now with auto-removal.
|
|
125
124
|
email:
|
|
126
125
|
- ryand-ruby@zenspider.com
|
|
@@ -149,7 +148,6 @@ licenses:
|
|
|
149
148
|
- MIT
|
|
150
149
|
metadata:
|
|
151
150
|
homepage_uri: https://github.com/seattlerb/debride
|
|
152
|
-
post_install_message:
|
|
153
151
|
rdoc_options:
|
|
154
152
|
- "--main"
|
|
155
153
|
- README.rdoc
|
|
@@ -166,8 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
166
164
|
- !ruby/object:Gem::Version
|
|
167
165
|
version: '0'
|
|
168
166
|
requirements: []
|
|
169
|
-
rubygems_version: 3.
|
|
170
|
-
signing_key:
|
|
167
|
+
rubygems_version: 3.7.2
|
|
171
168
|
specification_version: 4
|
|
172
169
|
summary: Analyze code for potentially uncalled / dead methods, now with auto-removal.
|
|
173
170
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|