debride 1.15.1 → 1.15.2

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: a141179f7eaccb00427a5f08718c4feb5f4cc71f088c85c9fa5ca9a2a9d11320
4
- data.tar.gz: 90cf53e502fb9174beaba59f09f45c1c316c2c0179f5c35509523af2c0c49cb8
3
+ metadata.gz: a2a172fbacd06e56a051cb02614afd1abe8f6d58a89e2fbf316e981b7d984ad2
4
+ data.tar.gz: ad77390a37d25f0d3af9d7c8b399151ad653321117020b029b15cd1e587b94eb
5
5
  SHA512:
6
- metadata.gz: e716a26676e9a6e3eef63dff026138910c7bd49ff4e89c0741f6be172cfe1e470a01944db3912555efc0e34a981fd6903164ee6a139795ed78e507bfa4911d7d
7
- data.tar.gz: b4d27a4b57292cfd04ee94849cc42fbb281a9446ee850f5c3e049fdf4a6cc6fde04eeca89092dbf08147f52e5ba1dbf644145a62ea12eb9a95bd6557f2cc15ad
6
+ metadata.gz: 03610f92787f0dc2e44af469f11582a6a2f4a6463e210b0c79e01c9294c89fe6dd37c2147f6ad1476c6a125a1238efb1c742ac9c29844b2fabad4e27bc60e878
7
+ data.tar.gz: 6c21f8d4c056aff81158115b7a12880537a96e52d40913ffea8a43ab900eed95f58c2a9c7bd200cf721ed32c981cae7b3c6d1df7f9cfbd6cda8ef4a4c418f314
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,11 @@
1
+ === 1.15.2 / 2026-04-20
2
+
3
+ * 3 bug fixes:
4
+
5
+ * Fix #process_hash when there's a kwsplat in the middle. (carlos-musetti)
6
+ * Rescue StandardError in .run to handle wider gamut of errors gracefully.
7
+ * Add #process override to handle errors as well.
8
+
1
9
  === 1.15.1 / 2026-01-26
2
10
 
3
11
  * 1 bug fix:
data/lib/debride.rb CHANGED
@@ -15,7 +15,7 @@ require "prism/translation/ruby_parser"
15
15
  # A static code analyzer that points out possible dead methods.
16
16
 
17
17
  class Debride < MethodBasedSexpProcessor
18
- VERSION = "1.15.1" # :nodoc:
18
+ VERSION = "1.15.2" # :nodoc:
19
19
  PROJECT = "debride"
20
20
 
21
21
  NotRubyParser = Class.new Prism::Translation::RubyParser # compatibility layer :nodoc:
@@ -82,12 +82,18 @@ class Debride < MethodBasedSexpProcessor
82
82
 
83
83
  begin
84
84
  process send(msg, file)
85
- rescue RuntimeError, SyntaxError => e
85
+ rescue StandardError, SyntaxError => e
86
86
  warn " skipping #{file}: #{e.message}"
87
87
  end
88
88
  end
89
89
  end
90
90
 
91
+ def process exp # :nodoc:
92
+ super
93
+ rescue => e # override to capture these but move on
94
+ warn " skipping: #{e.message}"
95
+ end
96
+
91
97
  def process_rb path_or_io
92
98
  warn "Processing ruby: #{path_or_io}" if option[:verbose]
93
99
 
@@ -485,6 +491,9 @@ class Debride < MethodBasedSexpProcessor
485
491
  def process_hash sexp
486
492
  _, *pairs = sexp
487
493
 
494
+ # pad kwsplat to survive each_slice 2
495
+ pairs = pairs.flat_map { |s| s && s.sexp_type == :kwsplat ? [s, nil] : [s] }
496
+
488
497
  pairs.each_slice 2 do |k, v|
489
498
  if v.nil? && k.sexp_type == :lit then
490
499
  called << k.last
data/test/test_debride.rb CHANGED
@@ -425,6 +425,18 @@ class TestDebride < Minitest::Test
425
425
  assert_process [["Seattle", [:raining]]], ruby
426
426
  end
427
427
 
428
+ def test_hash__kwsplat_bug
429
+ ruby = <<~RUBY
430
+ {
431
+ a:,
432
+ **b,
433
+ c:,
434
+ }
435
+ RUBY
436
+
437
+ assert_process [], ruby
438
+ end
439
+
428
440
  def test_safe_navigation_operator
429
441
  ruby = <<-RUBY.strip
430
442
  class Seattle
data.tar.gz.sig CHANGED
Binary file
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.15.1
4
+ version: 1.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -112,15 +112,29 @@ dependencies:
112
112
  requirements:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
- version: '4.5'
115
+ version: '4.6'
116
116
  type: :development
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
- version: '4.5'
123
- description: Analyze code for potentially uncalled / dead methods, now with auto-removal.
122
+ version: '4.6'
123
+ description: |-
124
+ Analyze code for potentially uncalled / dead methods, now with auto-removal.
125
+
126
+ == Features/Problems:
127
+
128
+ * Static analysis of code. Can be easily hooked up to a CI.
129
+ * As with all static analysis tools of dynamic languages, can't be 100%.
130
+ * Whitelisting known good methods by name or regexp.
131
+ * Use --rails for Rails-specific domain knowledge.
132
+ * Use debride_rm to brazenly remove all unused methods. BE CAREFUL.
133
+ * Use `debride_rails_whitelist` to generate an emperical whitelist from logs.
134
+ * Uses path_expander, so you can use:
135
+ * dir_arg -- expand a directory automatically
136
+ * @file_of_args -- persist arguments in a file
137
+ * -path_to_subtract -- ignore intersecting subsets of files/directories
124
138
  email:
125
139
  - ryand-ruby@zenspider.com
126
140
  executables:
@@ -148,6 +162,7 @@ licenses:
148
162
  - MIT
149
163
  metadata:
150
164
  homepage_uri: https://github.com/seattlerb/debride
165
+ documentation_uri: http://docs.seattlerb.org/debride
151
166
  rdoc_options:
152
167
  - "--main"
153
168
  - README.rdoc
@@ -166,5 +181,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
181
  requirements: []
167
182
  rubygems_version: 3.7.2
168
183
  specification_version: 4
169
- summary: Analyze code for potentially uncalled / dead methods, now with auto-removal.
184
+ summary: Analyze code for potentially uncalled / dead methods, now with auto-removal
170
185
  test_files: []
metadata.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- 9�óyO'Z�T�X@wm'(ՏJ|-6;Ҝ��1c�Ƞ����菾EARG�f�4��^d+*����qc 0C��jWa��<�_R49�����[�k��<V��xȴ���4e�`e�ܡue�͊�{P N?˝F���Y%�4� 2$���Rw����Z~1�-�k/����W�]���/�ڵw;���i��u, eϗ}
2
- �ݎ^�o��w�۠p4L��H��Cl����$�fm��h�lK[O��
1
+ .����B'$���4��v8������цX��/�s@�S��h������ȑ�>ow�/�5��������r����o_�oq@e��;p��vֲ�l��9�识`Ke}-�$�TVI#O�.#����P5���� ���v���
2
+ ��pVv�@�����a Ty�Y{���[�j�%��X�K��/S��=�2����?����(z@&;ng�h�thUIDIr�y E��Zr�V�+ߗ[�n�w�l�D�