leftovers 0.5.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +23 -3
  4. data/docs/Configuration.md +119 -2
  5. data/leftovers.gemspec +8 -4
  6. data/lib/.DS_Store +0 -0
  7. data/lib/config/actionpack.yml +11 -0
  8. data/lib/config/activesupport.yml +1 -0
  9. data/lib/config/ruby.yml +10 -0
  10. data/lib/config/slim.yml +4 -0
  11. data/lib/leftovers/collector.rb +3 -1
  12. data/lib/leftovers/config.rb +12 -4
  13. data/lib/leftovers/config_validator/schema_hash.rb +171 -149
  14. data/lib/leftovers/config_validator.rb +1 -0
  15. data/lib/leftovers/definition.rb +1 -1
  16. data/lib/leftovers/dynamic_processors/call.rb +0 -4
  17. data/lib/leftovers/dynamic_processors/call_definition.rb +0 -4
  18. data/lib/leftovers/dynamic_processors/definition.rb +0 -4
  19. data/lib/leftovers/erb.rb +1 -1
  20. data/lib/leftovers/file.rb +53 -5
  21. data/lib/leftovers/file_collector.rb +33 -2
  22. data/lib/leftovers/json.rb +28 -0
  23. data/lib/leftovers/matcher_builders/document.rb +13 -0
  24. data/lib/leftovers/matcher_builders/node.rb +3 -1
  25. data/lib/leftovers/matcher_builders/node_has_argument.rb +3 -4
  26. data/lib/leftovers/matcher_builders/node_has_keyword_argument.rb +1 -1
  27. data/lib/leftovers/matcher_builders/node_has_positional_argument.rb +1 -1
  28. data/lib/leftovers/matcher_builders.rb +1 -0
  29. data/lib/leftovers/matchers/all.rb +0 -4
  30. data/lib/leftovers/matchers/and.rb +0 -4
  31. data/lib/leftovers/matchers/any.rb +0 -4
  32. data/lib/leftovers/matchers/node_has_any_keyword_argument.rb +1 -7
  33. data/lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb +1 -7
  34. data/lib/leftovers/matchers/node_has_positional_argument_with_value.rb +0 -4
  35. data/lib/leftovers/matchers/node_name.rb +0 -4
  36. data/lib/leftovers/matchers/node_pair_value.rb +0 -4
  37. data/lib/leftovers/matchers/node_path.rb +0 -4
  38. data/lib/leftovers/matchers/node_scalar_value.rb +0 -4
  39. data/lib/leftovers/matchers/node_type.rb +0 -4
  40. data/lib/leftovers/matchers/not.rb +0 -4
  41. data/lib/leftovers/matchers/or.rb +0 -4
  42. data/lib/leftovers/merged_config.rb +43 -9
  43. data/lib/leftovers/processor_builders/dynamic.rb +2 -1
  44. data/lib/leftovers/slim.rb +21 -0
  45. data/lib/leftovers/todo_reporter.rb +10 -35
  46. data/lib/leftovers/value_processors/camelize.rb +1 -1
  47. data/lib/leftovers/value_processors/deconstantize.rb +1 -1
  48. data/lib/leftovers/value_processors/delete_prefix.rb +0 -6
  49. data/lib/leftovers/value_processors/delete_suffix.rb +0 -6
  50. data/lib/leftovers/value_processors/demodulize.rb +1 -1
  51. data/lib/leftovers/value_processors/keyword.rb +0 -4
  52. data/lib/leftovers/value_processors/keyword_argument.rb +0 -4
  53. data/lib/leftovers/value_processors/parameterize.rb +1 -1
  54. data/lib/leftovers/value_processors/pluralize.rb +1 -1
  55. data/lib/leftovers/value_processors/return_definition.rb +0 -4
  56. data/lib/leftovers/value_processors/singularize.rb +1 -1
  57. data/lib/leftovers/value_processors/titleize.rb +1 -1
  58. data/lib/leftovers/value_processors/underscore.rb +1 -1
  59. data/lib/leftovers/version.rb +1 -1
  60. data/lib/leftovers/yaml.rb +73 -0
  61. data/lib/leftovers.rb +8 -8
  62. metadata +51 -18
  63. data/lib/leftovers/backports.rb +0 -40
data/lib/leftovers.rb CHANGED
@@ -4,7 +4,6 @@ module Leftovers # rubocop:disable Metrics/ModuleLength
4
4
  class Error < ::StandardError; end
5
5
 
6
6
  autoload(:AST, "#{__dir__}/leftovers/ast")
7
- autoload(:Backports, "#{__dir__}/leftovers/backports")
8
7
  autoload(:CLI, "#{__dir__}/leftovers/cli")
9
8
  autoload(:Collector, "#{__dir__}/leftovers/collector")
10
9
  autoload(:ConfigValidator, "#{__dir__}/leftovers/config_validator")
@@ -17,6 +16,8 @@ module Leftovers # rubocop:disable Metrics/ModuleLength
17
16
  autoload(:FileList, "#{__dir__}/leftovers/file_list")
18
17
  autoload(:File, "#{__dir__}/leftovers/file")
19
18
  autoload(:Haml, "#{__dir__}/leftovers/haml")
19
+ autoload(:YAML, "#{__dir__}/leftovers/yaml")
20
+ autoload(:JSON, "#{__dir__}/leftovers/json")
20
21
  autoload(:MatcherBuilders, "#{__dir__}/leftovers/matcher_builders")
21
22
  autoload(:Matchers, "#{__dir__}/leftovers/matchers")
22
23
  autoload(:MergedConfig, "#{__dir__}/leftovers/merged_config")
@@ -24,6 +25,7 @@ module Leftovers # rubocop:disable Metrics/ModuleLength
24
25
  autoload(:ProcessorBuilders, "#{__dir__}/leftovers/processor_builders")
25
26
  autoload(:RakeTask, "#{__dir__}/leftovers/rake_task")
26
27
  autoload(:Reporter, "#{__dir__}/leftovers/reporter")
28
+ autoload(:Slim, "#{__dir__}/leftovers/slim")
27
29
  autoload(:TodoReporter, "#{__dir__}/leftovers/todo_reporter")
28
30
  autoload(:DynamicProcessors, "#{__dir__}/leftovers/dynamic_processors")
29
31
  autoload(:ValueProcessors, "#{__dir__}/leftovers/value_processors")
@@ -93,7 +95,7 @@ module Leftovers # rubocop:disable Metrics/ModuleLength
93
95
  end
94
96
 
95
97
  def resolution_instructions_link
96
- "https://github.com/robotdana/leftovers/tree/v#{Leftovers::VERSION}/README.md#how_to_resolve"
98
+ "https://github.com/robotdana/leftovers/tree/v#{Leftovers::VERSION}/README.md#how-to-resolve"
97
99
  end
98
100
 
99
101
  def warn(message)
@@ -146,12 +148,10 @@ module Leftovers # rubocop:disable Metrics/ModuleLength
146
148
  @try_require_cache ||= {}
147
149
 
148
150
  @try_require_cache.fetch(requirable) do
149
- begin
150
- require requirable
151
- @try_require_cache[requirable] = true
152
- rescue LoadError
153
- @try_require_cache[requirable] = false
154
- end
151
+ require requirable
152
+ @try_require_cache[requirable] = true
153
+ rescue LoadError
154
+ @try_require_cache[requirable] = false
155
155
  end
156
156
  end
157
157
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leftovers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dana Sherson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-27 00:00:00.000000000 Z
11
+ date: 2022-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -112,44 +112,58 @@ dependencies:
112
112
  name: rubocop
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 0.93.1
117
+ version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 0.93.1
124
+ version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rubocop-performance
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: 1.8.1
131
+ version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-rake
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
137
151
  - !ruby/object:Gem::Version
138
- version: 1.8.1
152
+ version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: rubocop-rspec
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - "~>"
157
+ - - ">="
144
158
  - !ruby/object:Gem::Version
145
- version: 1.44.1
159
+ version: '0'
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - "~>"
164
+ - - ">="
151
165
  - !ruby/object:Gem::Version
152
- version: 1.44.1
166
+ version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: simplecov
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -178,6 +192,20 @@ dependencies:
178
192
  - - ">="
179
193
  - !ruby/object:Gem::Version
180
194
  version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: slim
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
181
209
  - !ruby/object:Gem::Dependency
182
210
  name: timecop
183
211
  requirement: !ruby/object:Gem::Requirement
@@ -291,6 +319,7 @@ files:
291
319
  - docs/Configuration.md
292
320
  - exe/leftovers
293
321
  - leftovers.gemspec
322
+ - lib/.DS_Store
294
323
  - lib/config/actioncable.yml
295
324
  - lib/config/actionmailer.yml
296
325
  - lib/config/actionpack.yml
@@ -322,12 +351,12 @@ files:
322
351
  - lib/config/selenium-webdriver.yml
323
352
  - lib/config/sidekiq.yml
324
353
  - lib/config/simplecov.yml
354
+ - lib/config/slim.yml
325
355
  - lib/config/will_paginate.yml
326
356
  - lib/leftovers.rb
327
357
  - lib/leftovers/ast.rb
328
358
  - lib/leftovers/ast/builder.rb
329
359
  - lib/leftovers/ast/node.rb
330
- - lib/leftovers/backports.rb
331
360
  - lib/leftovers/cli.rb
332
361
  - lib/leftovers/collector.rb
333
362
  - lib/leftovers/config.rb
@@ -348,9 +377,11 @@ files:
348
377
  - lib/leftovers/file_collector.rb
349
378
  - lib/leftovers/file_list.rb
350
379
  - lib/leftovers/haml.rb
380
+ - lib/leftovers/json.rb
351
381
  - lib/leftovers/matcher_builders.rb
352
382
  - lib/leftovers/matcher_builders/and.rb
353
383
  - lib/leftovers/matcher_builders/and_not.rb
384
+ - lib/leftovers/matcher_builders/document.rb
354
385
  - lib/leftovers/matcher_builders/name.rb
355
386
  - lib/leftovers/matcher_builders/node.rb
356
387
  - lib/leftovers/matcher_builders/node_has_argument.rb
@@ -406,6 +437,7 @@ files:
406
437
  - lib/leftovers/processor_builders/value.rb
407
438
  - lib/leftovers/rake_task.rb
408
439
  - lib/leftovers/reporter.rb
440
+ - lib/leftovers/slim.rb
409
441
  - lib/leftovers/todo_reporter.rb
410
442
  - lib/leftovers/value_processors.rb
411
443
  - lib/leftovers/value_processors/add_dynamic_prefix.rb
@@ -443,6 +475,7 @@ files:
443
475
  - lib/leftovers/value_processors/underscore.rb
444
476
  - lib/leftovers/value_processors/upcase.rb
445
477
  - lib/leftovers/version.rb
478
+ - lib/leftovers/yaml.rb
446
479
  homepage: http://github.com/robotdana/leftovers
447
480
  licenses:
448
481
  - MIT
@@ -450,6 +483,7 @@ metadata:
450
483
  homepage_uri: http://github.com/robotdana/leftovers
451
484
  source_code_uri: http://github.com/robotdana/leftovers
452
485
  changelog_uri: http://github.com/robotdana/leftovers/blob/main/CHANGELOG.md
486
+ rubygems_mfa_required: 'true'
453
487
  post_install_message:
454
488
  rdoc_options: []
455
489
  require_paths:
@@ -458,15 +492,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
458
492
  requirements:
459
493
  - - ">="
460
494
  - !ruby/object:Gem::Version
461
- version: 2.4.0
495
+ version: 2.5.0
462
496
  required_rubygems_version: !ruby/object:Gem::Requirement
463
497
  requirements:
464
498
  - - ">="
465
499
  - !ruby/object:Gem::Version
466
500
  version: '0'
467
501
  requirements: []
468
- rubyforge_project:
469
- rubygems_version: 2.6.13
502
+ rubygems_version: 3.2.15
470
503
  signing_key:
471
504
  specification_version: 4
472
505
  summary: Find unused methods and classes/modules
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Leftovers
4
- module Backports
5
- ruby_version = Gem::Version.new(RUBY_VERSION)
6
-
7
- unless ruby_version >= Gem::Version.new('2.5')
8
- require 'set'
9
- module SetCaseEq
10
- refine ::Set do
11
- def ===(value)
12
- include?(value)
13
- end
14
- end
15
- end
16
-
17
- module StringDeletePrefixSuffix
18
- refine ::String do
19
- def delete_prefix!(str)
20
- slice!(0..(str.length - 1)) if start_with?(str)
21
- self
22
- end
23
-
24
- def delete_suffix!(str)
25
- slice!(-str.length..-1) if end_with?(str)
26
- self
27
- end
28
-
29
- def delete_prefix(str)
30
- dup.delete_prefix!(str)
31
- end
32
-
33
- def delete_suffix(str)
34
- dup.delete_suffix!(str)
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end