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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e23117d21c55f9b3a52eb52b6bbd068167cb1b5852650359e62809ed8de15f1b
4
- data.tar.gz: 231f1adaefd3cfb507d2352c72a7af1200e3db691d1617186f1cd4bc561e68e8
3
+ metadata.gz: 3a714288d6ecf460fcc966b8affc300f4bfe72da8e7d955e1345d757fbe389e9
4
+ data.tar.gz: '0608d18319513d0193482b503def7a86b7fc1544dfffb1048849d74b0b0d1728'
5
5
  SHA512:
6
- metadata.gz: bea8df45994be8ac31ddf803ec258fcc03054f2f2d3fbed6fd13124bf3c38125398c2f24e5de81e36460305c30b650c4bba2e0f7664854fb0a741085d4d2a138
7
- data.tar.gz: d9465fbd7fd9404c7b5b381b7d98a40bed4da3de1f87ac39ae11bd13e25a6eb957380537de02f8bd41a6247629f5e6cfe0da975b4dff216850a68bb2d84051d5
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 "ruby_parser", "~> 3.20"
25
- dependency "path_expander", "~> 1.0"
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
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env ruby
1
+ #!/usr/bin/env -S ruby -w
2
2
 
3
3
  require "debride"
4
4
 
@@ -1,4 +1,4 @@
1
- #!/usr/bin/ruby -w
1
+ #!/usr/bin/env -S ruby -w
2
2
 
3
3
  route = ARGV.shift
4
4
  routes = {}
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
- `#{cmd.gsub(/\bNAME\b/, "#{klass}##{name}").gsub(/\bPATH\b/, path)}` if cmd
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.12.0" # :nodoc:
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
- opt = parse_options args
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
- RubyParser.new.process(file, path, option[:timeout])
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 = <<-RUBY.strip
346
- f(&) # block forwarding
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.12.0
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
- MIIDPjCCAiagAwIBAgIBBzANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
12
+ MIIDPjCCAiagAwIBAgIBCTANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
14
13
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTIzMDEwMTA3NTExN1oXDTI0MDEwMTA3NTExN1owRTETMBEGA1UE
14
+ GRYDY29tMB4XDTI1MDEwNjIzMjcwMVoXDTI2MDEwNj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xeOICmJofk9w5VZ2rRN6yes8jvFYwz9HR41wdj8
28
+ bwfinv7Yp5fA6AysuZLhCykyfDuZVRrUp0Vb68YCKsLjJly/Theak+euNTxvHsB+
29
+ al9oSgPPHICMEX65qvLywitx
31
30
  -----END CERTIFICATE-----
32
- date: 2023-05-18 00:00:00.000000000 Z
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: ruby_parser
48
+ name: prism
50
49
  requirement: !ruby/object:Gem::Requirement
51
50
  requirements:
52
51
  - - "~>"
53
52
  - !ruby/object:Gem::Version
54
- version: '3.20'
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: '3.20'
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: '1.0'
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: '1.0'
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.0'
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.0'
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.4.10
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