leftovers 0.4.2 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +30 -0
- data/README.md +30 -0
- data/docs/Configuration.md +46 -11
- data/leftovers.gemspec +1 -0
- data/lib/config/actioncable.yml +4 -0
- data/lib/config/actionmailer.yml +22 -0
- data/lib/config/actionpack.yml +190 -0
- data/lib/config/actionview.yml +64 -0
- data/lib/config/activejob.yml +29 -0
- data/lib/config/activemodel.yml +74 -0
- data/lib/config/activerecord.yml +179 -0
- data/lib/config/activesupport.yml +98 -0
- data/lib/config/haml.yml +2 -0
- data/lib/config/rails.yml +11 -450
- data/lib/config/ruby.yml +6 -0
- data/lib/leftovers/ast/node.rb +14 -0
- data/lib/leftovers/cli.rb +13 -4
- data/lib/leftovers/collector.rb +1 -0
- data/lib/leftovers/config.rb +8 -0
- data/lib/leftovers/config_validator/schema_hash.rb +62 -29
- data/lib/leftovers/definition.rb +4 -4
- data/lib/leftovers/erb.rb +2 -2
- data/lib/leftovers/file.rb +2 -3
- data/lib/leftovers/matcher_builders/node.rb +2 -0
- data/lib/leftovers/matcher_builders/node_has_argument.rb +11 -7
- data/lib/leftovers/matcher_builders/node_has_keyword_argument.rb +14 -10
- data/lib/leftovers/matcher_builders/node_has_positional_argument.rb +17 -13
- data/lib/leftovers/matcher_builders/node_has_receiver.rb +15 -0
- data/lib/leftovers/matcher_builders/node_type.rb +7 -6
- data/lib/leftovers/matcher_builders/node_value.rb +50 -0
- data/lib/leftovers/matcher_builders.rb +3 -2
- data/lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb +4 -1
- data/lib/leftovers/matchers/node_has_positional_argument.rb +0 -4
- data/lib/leftovers/matchers/node_has_receiver.rb +20 -0
- data/lib/leftovers/matchers/predicate.rb +19 -0
- data/lib/leftovers/matchers.rb +2 -0
- data/lib/leftovers/merged_config.rb +24 -1
- data/lib/leftovers/reporter.rb +56 -4
- data/lib/leftovers/todo_reporter.rb +127 -0
- data/lib/leftovers/version.rb +1 -1
- data/lib/leftovers.rb +93 -96
- metadata +31 -4
- data/lib/leftovers/matcher_builders/argument_node_value.rb +0 -21
@@ -12,6 +12,7 @@ module Leftovers
|
|
12
12
|
|
13
13
|
self << :ruby
|
14
14
|
self << project_config
|
15
|
+
self << project_todo
|
15
16
|
load_bundled_gem_config
|
16
17
|
end
|
17
18
|
|
@@ -32,10 +33,16 @@ module Leftovers
|
|
32
33
|
Leftovers::Config.new(:'.leftovers.yml', path: Leftovers.pwd + '.leftovers.yml')
|
33
34
|
end
|
34
35
|
|
35
|
-
def
|
36
|
+
def project_todo
|
37
|
+
Leftovers::Config.new(:'.leftovers_todo.yml', path: Leftovers.pwd + '.leftovers_todo.yml')
|
38
|
+
end
|
39
|
+
|
40
|
+
def unmemoize # rubocop:disable Metrics/CyclomaticComplexity
|
36
41
|
remove_instance_variable(:@exclude_paths) if defined?(@exclude_paths)
|
37
42
|
remove_instance_variable(:@include_paths) if defined?(@include_paths)
|
38
43
|
remove_instance_variable(:@test_paths) if defined?(@test_paths)
|
44
|
+
remove_instance_variable(:@haml_paths) if defined?(@haml_paths)
|
45
|
+
remove_instance_variable(:@erb_paths) if defined?(@erb_paths)
|
39
46
|
remove_instance_variable(:@dynamic) if defined?(@dynamic)
|
40
47
|
remove_instance_variable(:@keep) if defined?(@keep)
|
41
48
|
end
|
@@ -56,6 +63,22 @@ module Leftovers
|
|
56
63
|
)
|
57
64
|
end
|
58
65
|
|
66
|
+
def haml_paths
|
67
|
+
@haml_paths ||= FastIgnore.new(
|
68
|
+
include_rules: @configs.flat_map(&:haml_paths),
|
69
|
+
gitignore: false,
|
70
|
+
root: Leftovers.pwd
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
def erb_paths
|
75
|
+
@erb_paths ||= FastIgnore.new(
|
76
|
+
include_rules: @configs.flat_map(&:erb_paths),
|
77
|
+
gitignore: false,
|
78
|
+
root: Leftovers.pwd
|
79
|
+
)
|
80
|
+
end
|
81
|
+
|
59
82
|
def dynamic
|
60
83
|
@dynamic ||= ::Leftovers::ProcessorBuilders::EachDynamic.build(@configs.map(&:dynamic))
|
61
84
|
end
|
data/lib/leftovers/reporter.rb
CHANGED
@@ -2,10 +2,62 @@
|
|
2
2
|
|
3
3
|
module Leftovers
|
4
4
|
class Reporter
|
5
|
-
def
|
6
|
-
|
7
|
-
|
8
|
-
)
|
5
|
+
def prepare; end
|
6
|
+
|
7
|
+
def report(only_test:, none:)
|
8
|
+
report_list('Only directly called in tests:', only_test)
|
9
|
+
report_list('Not directly called at all:', none)
|
10
|
+
report_instructions
|
11
|
+
|
12
|
+
1
|
13
|
+
end
|
14
|
+
|
15
|
+
def report_success
|
16
|
+
puts green('Everything is used')
|
17
|
+
|
18
|
+
0
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def report_instructions
|
24
|
+
puts <<~HELP
|
25
|
+
|
26
|
+
how to resolve: #{green Leftovers.resolution_instructions_link}
|
27
|
+
HELP
|
28
|
+
end
|
29
|
+
|
30
|
+
def report_list(title, list)
|
31
|
+
return if list.empty?
|
32
|
+
|
33
|
+
puts red(title)
|
34
|
+
list.each { |d| print_definition(d) }
|
35
|
+
end
|
36
|
+
|
37
|
+
def print_definition(definition)
|
38
|
+
puts "#{aqua definition.location_s} "\
|
39
|
+
"#{definition} "\
|
40
|
+
"#{grey definition.highlighted_source("\e[33m", "\e[0;2m")}"
|
41
|
+
end
|
42
|
+
|
43
|
+
def puts(string)
|
44
|
+
Leftovers.puts(string)
|
45
|
+
end
|
46
|
+
|
47
|
+
def red(string)
|
48
|
+
"\e[31m#{string}\e[0m"
|
49
|
+
end
|
50
|
+
|
51
|
+
def green(string)
|
52
|
+
"\e[32m#{string}\e[0m"
|
53
|
+
end
|
54
|
+
|
55
|
+
def aqua(string)
|
56
|
+
"\e[36m#{string}\e[0m"
|
57
|
+
end
|
58
|
+
|
59
|
+
def grey(string)
|
60
|
+
"\e[2m#{string}\e[0m"
|
9
61
|
end
|
10
62
|
end
|
11
63
|
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
module Leftovers
|
6
|
+
class TodoReporter
|
7
|
+
def prepare
|
8
|
+
return unless path.exist?
|
9
|
+
|
10
|
+
puts "Removing previous #{path.basename} file"
|
11
|
+
puts ''
|
12
|
+
path.delete
|
13
|
+
end
|
14
|
+
|
15
|
+
def report(only_test:, none:)
|
16
|
+
path.write(generate_file_body(only_test, none))
|
17
|
+
report_instructions
|
18
|
+
|
19
|
+
0
|
20
|
+
end
|
21
|
+
|
22
|
+
def report_success
|
23
|
+
puts "No #{path.basename} file generated, everything is used"
|
24
|
+
|
25
|
+
0
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def report_instructions
|
31
|
+
puts <<~MESSAGE
|
32
|
+
generated #{path.basename}.
|
33
|
+
running leftovers again will read this file and not alert you to any unused items mentioned in it.
|
34
|
+
|
35
|
+
commit this file so you/your team can gradually address these items while still having leftovers alert you to any newly unused items.
|
36
|
+
MESSAGE
|
37
|
+
end
|
38
|
+
|
39
|
+
def path
|
40
|
+
Leftovers.pwd.join('.leftovers_todo.yml')
|
41
|
+
end
|
42
|
+
|
43
|
+
def generate_file_body(only_test, none)
|
44
|
+
<<~YML.chomp
|
45
|
+
#{generation_message.chomp}
|
46
|
+
#
|
47
|
+
#{resolution_instructions}
|
48
|
+
#{todo_data(only_test, none).chomp}
|
49
|
+
YML
|
50
|
+
end
|
51
|
+
|
52
|
+
def generation_message
|
53
|
+
<<~YML
|
54
|
+
# This file was generated by `leftovers --write-todo`
|
55
|
+
# Generated at: #{Time.now.utc.strftime('%F %T')} UTC
|
56
|
+
YML
|
57
|
+
end
|
58
|
+
|
59
|
+
def resolution_instructions
|
60
|
+
<<~YML
|
61
|
+
# for instructions on how to address these
|
62
|
+
# see #{Leftovers.resolution_instructions_link}
|
63
|
+
YML
|
64
|
+
end
|
65
|
+
|
66
|
+
def todo_data(only_test, none)
|
67
|
+
none_test = none.select(&:test?)
|
68
|
+
none_non_test = none.reject(&:test?)
|
69
|
+
[
|
70
|
+
test_only_data(none_test),
|
71
|
+
keep_data(only_test, none_non_test)
|
72
|
+
].compact.join
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_only_data(list)
|
76
|
+
return if list.empty?
|
77
|
+
|
78
|
+
<<~YML
|
79
|
+
test_only:
|
80
|
+
#{generate_list('Defined in tests:', list).chomp}
|
81
|
+
YML
|
82
|
+
end
|
83
|
+
|
84
|
+
def keep_data(only_test, none_non_test)
|
85
|
+
return if only_test.empty? && none_non_test.empty?
|
86
|
+
|
87
|
+
<<~YML.chomp
|
88
|
+
keep:
|
89
|
+
#{keep_test_called_data(only_test)}#{keep_never_called_data(none_non_test)}
|
90
|
+
YML
|
91
|
+
end
|
92
|
+
|
93
|
+
def keep_test_called_data(list)
|
94
|
+
return if list.empty?
|
95
|
+
|
96
|
+
generate_list('Only directly called in tests:', list)
|
97
|
+
end
|
98
|
+
|
99
|
+
def keep_never_called_data(list)
|
100
|
+
return if list.empty?
|
101
|
+
|
102
|
+
generate_list('Not directly called at all:', list)
|
103
|
+
end
|
104
|
+
|
105
|
+
def generate_list(title, list)
|
106
|
+
<<~YML
|
107
|
+
# #{title}
|
108
|
+
#{print_definition_list(list)}
|
109
|
+
|
110
|
+
YML
|
111
|
+
end
|
112
|
+
|
113
|
+
def print_definition_list(definition_list)
|
114
|
+
definition_list.map { |definition| print_definition(definition) }.join("\n")
|
115
|
+
end
|
116
|
+
|
117
|
+
def print_definition(definition)
|
118
|
+
return print_definition_list(definition.definitions) if definition.is_a?(DefinitionSet)
|
119
|
+
|
120
|
+
" - #{definition.to_s.inspect} # #{definition.location_s} #{definition.source_line.strip}"
|
121
|
+
end
|
122
|
+
|
123
|
+
def puts(string)
|
124
|
+
Leftovers.puts(string)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
data/lib/leftovers/version.rb
CHANGED
data/lib/leftovers.rb
CHANGED
@@ -3,8 +3,6 @@
|
|
3
3
|
module Leftovers # rubocop:disable Metrics/ModuleLength
|
4
4
|
class Error < ::StandardError; end
|
5
5
|
|
6
|
-
module_function
|
7
|
-
|
8
6
|
autoload(:AST, "#{__dir__}/leftovers/ast")
|
9
7
|
autoload(:Backports, "#{__dir__}/leftovers/backports")
|
10
8
|
autoload(:CLI, "#{__dir__}/leftovers/cli")
|
@@ -26,136 +24,135 @@ module Leftovers # rubocop:disable Metrics/ModuleLength
|
|
26
24
|
autoload(:ProcessorBuilders, "#{__dir__}/leftovers/processor_builders")
|
27
25
|
autoload(:RakeTask, "#{__dir__}/leftovers/rake_task")
|
28
26
|
autoload(:Reporter, "#{__dir__}/leftovers/reporter")
|
27
|
+
autoload(:TodoReporter, "#{__dir__}/leftovers/todo_reporter")
|
29
28
|
autoload(:DynamicProcessors, "#{__dir__}/leftovers/dynamic_processors")
|
30
29
|
autoload(:ValueProcessors, "#{__dir__}/leftovers/value_processors")
|
31
30
|
autoload(:VERSION, "#{__dir__}/leftovers/version")
|
32
31
|
|
33
32
|
class << self
|
34
33
|
attr_accessor :parallel, :progress
|
34
|
+
attr_writer :reporter
|
35
35
|
alias_method :parallel?, :parallel
|
36
|
-
|
37
36
|
alias_method :progress?, :progress
|
38
|
-
end
|
39
|
-
|
40
|
-
def stdout
|
41
|
-
@stdout ||= $stdout
|
42
|
-
end
|
43
37
|
|
44
|
-
|
45
|
-
|
46
|
-
|
38
|
+
def stdout
|
39
|
+
@stdout ||= $stdout
|
40
|
+
end
|
47
41
|
|
48
|
-
|
49
|
-
|
50
|
-
|
42
|
+
def stderr
|
43
|
+
@stderr ||= $stderr
|
44
|
+
end
|
51
45
|
|
52
|
-
|
53
|
-
|
54
|
-
|
46
|
+
def config
|
47
|
+
@config ||= Leftovers::MergedConfig.new(load_defaults: true)
|
48
|
+
end
|
55
49
|
|
56
|
-
|
57
|
-
|
58
|
-
|
50
|
+
def collector
|
51
|
+
@collector ||= Leftovers::Collector.new
|
52
|
+
end
|
59
53
|
|
60
|
-
|
61
|
-
|
62
|
-
collector.collect
|
63
|
-
collector.definitions.reject(&:in_collection?)
|
54
|
+
def reporter
|
55
|
+
@reporter ||= Leftovers::Reporter.new
|
64
56
|
end
|
65
|
-
end
|
66
57
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
only_test = []
|
73
|
-
none = []
|
74
|
-
leftovers.sort_by(&:location_s).each do |definition|
|
75
|
-
if !definition.test? && definition.in_test_collection?
|
76
|
-
only_test << definition
|
77
|
-
else
|
78
|
-
none << definition
|
58
|
+
def leftovers
|
59
|
+
@leftovers ||= begin
|
60
|
+
collector.collect
|
61
|
+
collector.definitions.reject(&:in_collection?)
|
79
62
|
end
|
80
63
|
end
|
81
64
|
|
82
|
-
|
83
|
-
|
84
|
-
|
65
|
+
def run(stdout: StringIO.new, stderr: StringIO.new) # rubocop:disable Metrics/MethodLength
|
66
|
+
@stdout = stdout
|
67
|
+
@stderr = stderr
|
68
|
+
return reporter.report_success if leftovers.empty?
|
69
|
+
|
70
|
+
only_test = []
|
71
|
+
none = []
|
72
|
+
leftovers.sort_by(&:location_s).each do |definition|
|
73
|
+
if !definition.test? && definition.in_test_collection?
|
74
|
+
only_test << definition
|
75
|
+
else
|
76
|
+
none << definition
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
reporter.report(only_test: only_test, none: none)
|
85
81
|
end
|
86
82
|
|
87
|
-
|
88
|
-
|
89
|
-
|
83
|
+
def reset # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
|
84
|
+
remove_instance_variable(:@config) if defined?(@config)
|
85
|
+
remove_instance_variable(:@collector) if defined?(@collector)
|
86
|
+
remove_instance_variable(:@reporter) if defined?(@reporter)
|
87
|
+
remove_instance_variable(:@leftovers) if defined?(@leftovers)
|
88
|
+
remove_instance_variable(:@try_require_cache) if defined?(@try_require_cache)
|
89
|
+
remove_instance_variable(:@stdout) if defined?(@stdout)
|
90
|
+
remove_instance_variable(:@stderr) if defined?(@stderr)
|
91
|
+
remove_instance_variable(:@parallel) if defined?(@parallel)
|
92
|
+
remove_instance_variable(:@pwd) if defined?(@pwd)
|
90
93
|
end
|
91
94
|
|
92
|
-
|
93
|
-
|
95
|
+
def resolution_instructions_link
|
96
|
+
"https://github.com/robotdana/leftovers/tree/v#{Leftovers::VERSION}/README.md#how_to_resolve"
|
97
|
+
end
|
94
98
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
remove_instance_variable(:@reporter) if defined?(@reporter)
|
99
|
-
remove_instance_variable(:@leftovers) if defined?(@leftovers)
|
100
|
-
remove_instance_variable(:@try_require) if defined?(@try_require)
|
101
|
-
remove_instance_variable(:@stdout) if defined?(@stdout)
|
102
|
-
remove_instance_variable(:@stderr) if defined?(@stderr)
|
103
|
-
remove_instance_variable(:@parallel) if defined?(@parallel)
|
104
|
-
remove_instance_variable(:@pwd) if defined?(@pwd)
|
105
|
-
end
|
99
|
+
def warn(message)
|
100
|
+
stderr.puts("\e[2K#{message}")
|
101
|
+
end
|
106
102
|
|
107
|
-
|
108
|
-
|
109
|
-
|
103
|
+
def error(message)
|
104
|
+
warn(message)
|
105
|
+
exit 1
|
106
|
+
end
|
110
107
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
end
|
108
|
+
def puts(message)
|
109
|
+
stdout.puts("\e[2K#{message}")
|
110
|
+
end
|
115
111
|
|
116
|
-
|
117
|
-
|
118
|
-
|
112
|
+
def print(message)
|
113
|
+
stdout.print(message)
|
114
|
+
end
|
119
115
|
|
120
|
-
|
121
|
-
|
122
|
-
|
116
|
+
def newline
|
117
|
+
stdout.puts('')
|
118
|
+
end
|
123
119
|
|
124
|
-
|
125
|
-
|
126
|
-
|
120
|
+
def pwd
|
121
|
+
@pwd ||= Pathname.new(Dir.pwd + '/')
|
122
|
+
end
|
127
123
|
|
128
|
-
|
129
|
-
|
130
|
-
|
124
|
+
def exit(status = 0)
|
125
|
+
throw :leftovers_exit, status
|
126
|
+
end
|
131
127
|
|
132
|
-
|
133
|
-
|
134
|
-
|
128
|
+
def try_require(requirable, message: nil)
|
129
|
+
warn message if !try_require_cache(requirable) && message
|
130
|
+
try_require_cache(requirable)
|
131
|
+
end
|
135
132
|
|
136
|
-
|
137
|
-
|
133
|
+
def each_or_self(value, &block)
|
134
|
+
return enum_for(__method__, value) unless block
|
138
135
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
else
|
143
|
-
require requirable
|
144
|
-
true
|
136
|
+
case value
|
137
|
+
when nil then nil
|
138
|
+
when Array then value.each(&block)
|
139
|
+
else yield(value)
|
145
140
|
end
|
146
|
-
rescue LoadError
|
147
|
-
false
|
148
141
|
end
|
149
142
|
|
150
|
-
|
151
|
-
@try_require[requirable]
|
152
|
-
end
|
143
|
+
private
|
153
144
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
145
|
+
def try_require_cache(requirable)
|
146
|
+
@try_require_cache ||= {}
|
147
|
+
|
148
|
+
@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
|
155
|
+
end
|
159
156
|
end
|
160
157
|
end
|
161
158
|
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.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dana Sherson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -178,6 +178,20 @@ dependencies:
|
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: timecop
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: tty_string
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -277,6 +291,14 @@ files:
|
|
277
291
|
- docs/Configuration.md
|
278
292
|
- exe/leftovers
|
279
293
|
- leftovers.gemspec
|
294
|
+
- lib/config/actioncable.yml
|
295
|
+
- lib/config/actionmailer.yml
|
296
|
+
- lib/config/actionpack.yml
|
297
|
+
- lib/config/actionview.yml
|
298
|
+
- lib/config/activejob.yml
|
299
|
+
- lib/config/activemodel.yml
|
300
|
+
- lib/config/activerecord.yml
|
301
|
+
- lib/config/activesupport.yml
|
280
302
|
- lib/config/attr_encrypted.yml
|
281
303
|
- lib/config/audited.yml
|
282
304
|
- lib/config/builder.yml
|
@@ -329,17 +351,18 @@ files:
|
|
329
351
|
- lib/leftovers/matcher_builders.rb
|
330
352
|
- lib/leftovers/matcher_builders/and.rb
|
331
353
|
- lib/leftovers/matcher_builders/and_not.rb
|
332
|
-
- lib/leftovers/matcher_builders/argument_node_value.rb
|
333
354
|
- lib/leftovers/matcher_builders/name.rb
|
334
355
|
- lib/leftovers/matcher_builders/node.rb
|
335
356
|
- lib/leftovers/matcher_builders/node_has_argument.rb
|
336
357
|
- lib/leftovers/matcher_builders/node_has_keyword_argument.rb
|
337
358
|
- lib/leftovers/matcher_builders/node_has_positional_argument.rb
|
359
|
+
- lib/leftovers/matcher_builders/node_has_receiver.rb
|
338
360
|
- lib/leftovers/matcher_builders/node_name.rb
|
339
361
|
- lib/leftovers/matcher_builders/node_pair_name.rb
|
340
362
|
- lib/leftovers/matcher_builders/node_pair_value.rb
|
341
363
|
- lib/leftovers/matcher_builders/node_path.rb
|
342
364
|
- lib/leftovers/matcher_builders/node_type.rb
|
365
|
+
- lib/leftovers/matcher_builders/node_value.rb
|
343
366
|
- lib/leftovers/matcher_builders/or.rb
|
344
367
|
- lib/leftovers/matcher_builders/path.rb
|
345
368
|
- lib/leftovers/matcher_builders/string.rb
|
@@ -353,6 +376,7 @@ files:
|
|
353
376
|
- lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb
|
354
377
|
- lib/leftovers/matchers/node_has_positional_argument.rb
|
355
378
|
- lib/leftovers/matchers/node_has_positional_argument_with_value.rb
|
379
|
+
- lib/leftovers/matchers/node_has_receiver.rb
|
356
380
|
- lib/leftovers/matchers/node_name.rb
|
357
381
|
- lib/leftovers/matchers/node_pair_value.rb
|
358
382
|
- lib/leftovers/matchers/node_path.rb
|
@@ -360,6 +384,7 @@ files:
|
|
360
384
|
- lib/leftovers/matchers/node_type.rb
|
361
385
|
- lib/leftovers/matchers/not.rb
|
362
386
|
- lib/leftovers/matchers/or.rb
|
387
|
+
- lib/leftovers/matchers/predicate.rb
|
363
388
|
- lib/leftovers/merged_config.rb
|
364
389
|
- lib/leftovers/parser.rb
|
365
390
|
- lib/leftovers/processor_builders.rb
|
@@ -381,6 +406,7 @@ files:
|
|
381
406
|
- lib/leftovers/processor_builders/value.rb
|
382
407
|
- lib/leftovers/rake_task.rb
|
383
408
|
- lib/leftovers/reporter.rb
|
409
|
+
- lib/leftovers/todo_reporter.rb
|
384
410
|
- lib/leftovers/value_processors.rb
|
385
411
|
- lib/leftovers/value_processors/add_dynamic_prefix.rb
|
386
412
|
- lib/leftovers/value_processors/add_dynamic_suffix.rb
|
@@ -439,7 +465,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
439
465
|
- !ruby/object:Gem::Version
|
440
466
|
version: '0'
|
441
467
|
requirements: []
|
442
|
-
|
468
|
+
rubyforge_project:
|
469
|
+
rubygems_version: 2.6.13
|
443
470
|
signing_key:
|
444
471
|
specification_version: 4
|
445
472
|
summary: Find unused methods and classes/modules
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen-string-literal: true
|
2
|
-
|
3
|
-
module Leftovers
|
4
|
-
module MatcherBuilders
|
5
|
-
module ArgumentNodeValue
|
6
|
-
def self.build(pattern)
|
7
|
-
::Leftovers::MatcherBuilders::Or.each_or_self(pattern) do |pat|
|
8
|
-
case pat
|
9
|
-
when ::Integer, true, false, nil
|
10
|
-
::Leftovers::Matchers::NodeScalarValue.new(pat)
|
11
|
-
when ::String, ::Hash
|
12
|
-
::Leftovers::MatcherBuilders::NodeName.build(pat)
|
13
|
-
# :nocov:
|
14
|
-
else raise
|
15
|
-
# :nocov:
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|