leftovers 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +28 -45
- data/docs/Configuration.md +598 -0
- data/exe/leftovers +1 -1
- data/leftovers.gemspec +9 -6
- data/lib/config/attr_encrypted.yml +3 -4
- data/lib/config/audited.yml +9 -4
- data/lib/config/datagrid.yml +1 -1
- data/lib/config/flipper.yml +1 -3
- data/lib/config/graphql.yml +15 -13
- data/lib/config/okcomputer.yml +1 -3
- data/lib/config/parser.yml +89 -91
- data/lib/config/rails.yml +125 -107
- data/lib/config/redcarpet.yml +35 -38
- data/lib/config/rollbar.yml +1 -3
- data/lib/config/rspec.yml +18 -10
- data/lib/config/ruby.yml +40 -50
- data/lib/config/selenium-webdriver.yml +19 -21
- data/lib/config/sidekiq.yml +4 -8
- data/lib/config/will_paginate.yml +12 -14
- data/lib/leftovers.rb +38 -26
- data/lib/leftovers/ast.rb +8 -0
- data/lib/leftovers/ast/builder.rb +4 -4
- data/lib/leftovers/ast/node.rb +50 -77
- data/lib/leftovers/backports.rb +27 -23
- data/lib/leftovers/cli.rb +0 -3
- data/lib/leftovers/collector.rb +4 -8
- data/lib/leftovers/config.rb +19 -25
- data/lib/leftovers/config_validator.rb +60 -0
- data/lib/leftovers/config_validator/error_processor.rb +196 -0
- data/lib/leftovers/config_validator/schema_hash.rb +495 -0
- data/lib/leftovers/definition.rb +11 -36
- data/lib/leftovers/definition_set.rb +7 -17
- data/lib/leftovers/dynamic_processors.rb +11 -0
- data/lib/leftovers/dynamic_processors/call.rb +25 -0
- data/lib/leftovers/dynamic_processors/call_definition.rb +31 -0
- data/lib/leftovers/dynamic_processors/definition.rb +26 -0
- data/lib/leftovers/dynamic_processors/each.rb +19 -0
- data/lib/leftovers/dynamic_processors/null.rb +9 -0
- data/lib/leftovers/erb.rb +2 -2
- data/lib/leftovers/file.rb +3 -5
- data/lib/leftovers/file_collector.rb +65 -49
- data/lib/leftovers/file_list.rb +0 -1
- data/lib/leftovers/haml.rb +1 -1
- data/lib/leftovers/matcher_builders.rb +24 -0
- data/lib/leftovers/matcher_builders/and.rb +19 -0
- data/lib/leftovers/matcher_builders/and_not.rb +14 -0
- data/lib/leftovers/matcher_builders/argument_node_value.rb +21 -0
- data/lib/leftovers/matcher_builders/name.rb +29 -0
- data/lib/leftovers/matcher_builders/node.rb +40 -0
- data/lib/leftovers/matcher_builders/node_has_argument.rb +71 -0
- data/lib/leftovers/matcher_builders/node_has_keyword_argument.rb +22 -0
- data/lib/leftovers/matcher_builders/node_has_positional_argument.rb +24 -0
- data/lib/leftovers/matcher_builders/node_name.rb +15 -0
- data/lib/leftovers/matcher_builders/node_pair_name.rb +18 -0
- data/lib/leftovers/matcher_builders/node_pair_value.rb +16 -0
- data/lib/leftovers/matcher_builders/node_path.rb +14 -0
- data/lib/leftovers/matcher_builders/node_type.rb +28 -0
- data/lib/leftovers/matcher_builders/or.rb +73 -0
- data/lib/leftovers/matcher_builders/path.rb +15 -0
- data/lib/leftovers/matcher_builders/string.rb +11 -0
- data/lib/leftovers/matcher_builders/string_pattern.rb +19 -0
- data/lib/leftovers/matcher_builders/unless.rb +13 -0
- data/lib/leftovers/matchers.rb +26 -0
- data/lib/leftovers/matchers/all.rb +25 -0
- data/lib/leftovers/matchers/and.rb +24 -0
- data/lib/leftovers/matchers/any.rb +27 -0
- data/lib/leftovers/matchers/node_has_any_keyword_argument.rb +28 -0
- data/lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb +25 -0
- data/lib/leftovers/matchers/node_has_positional_argument.rb +23 -0
- data/lib/leftovers/matchers/node_has_positional_argument_with_value.rb +25 -0
- data/lib/leftovers/matchers/node_name.rb +23 -0
- data/lib/leftovers/matchers/node_pair_value.rb +23 -0
- data/lib/leftovers/matchers/node_path.rb +23 -0
- data/lib/leftovers/matchers/node_scalar_value.rb +25 -0
- data/lib/leftovers/matchers/node_type.rb +23 -0
- data/lib/leftovers/matchers/not.rb +23 -0
- data/lib/leftovers/matchers/or.rb +26 -0
- data/lib/leftovers/merged_config.rb +13 -8
- data/lib/leftovers/parser.rb +1 -4
- data/lib/leftovers/processor_builders.rb +22 -0
- data/lib/leftovers/processor_builders/action.rb +63 -0
- data/lib/leftovers/processor_builders/add_prefix.rb +20 -0
- data/lib/leftovers/processor_builders/add_suffix.rb +20 -0
- data/lib/leftovers/processor_builders/argument.rb +25 -0
- data/lib/leftovers/processor_builders/dynamic.rb +27 -0
- data/lib/leftovers/processor_builders/each.rb +36 -0
- data/lib/leftovers/processor_builders/each_action.rb +51 -0
- data/lib/leftovers/processor_builders/each_dynamic.rb +54 -0
- data/lib/leftovers/processor_builders/each_for_definition_set.rb +36 -0
- data/lib/leftovers/processor_builders/itself.rb +13 -0
- data/lib/leftovers/processor_builders/keyword.rb +24 -0
- data/lib/leftovers/processor_builders/keyword_argument.rb +14 -0
- data/lib/leftovers/processor_builders/transform.rb +55 -0
- data/lib/leftovers/processor_builders/transform_chain.rb +24 -0
- data/lib/leftovers/processor_builders/transform_set.rb +47 -0
- data/lib/leftovers/processor_builders/value.rb +13 -0
- data/lib/leftovers/rake_task.rb +1 -1
- data/lib/leftovers/reporter.rb +1 -1
- data/lib/leftovers/value_processors.rb +40 -0
- data/lib/leftovers/value_processors/add_dynamic_prefix.rb +31 -0
- data/lib/leftovers/value_processors/add_dynamic_suffix.rb +31 -0
- data/lib/leftovers/value_processors/add_prefix.rb +20 -0
- data/lib/leftovers/value_processors/add_suffix.rb +20 -0
- data/lib/leftovers/value_processors/camelize.rb +24 -0
- data/lib/leftovers/value_processors/capitalize.rb +19 -0
- data/lib/leftovers/value_processors/deconstantize.rb +24 -0
- data/lib/leftovers/value_processors/delete_after.rb +22 -0
- data/lib/leftovers/value_processors/delete_before.rb +22 -0
- data/lib/leftovers/value_processors/delete_prefix.rb +26 -0
- data/lib/leftovers/value_processors/delete_suffix.rb +26 -0
- data/lib/leftovers/value_processors/demodulize.rb +24 -0
- data/lib/leftovers/value_processors/downcase.rb +19 -0
- data/lib/leftovers/value_processors/each.rb +21 -0
- data/lib/leftovers/value_processors/each_for_definition_set.rb +33 -0
- data/lib/leftovers/value_processors/each_keyword.rb +27 -0
- data/lib/leftovers/value_processors/each_keyword_argument.rb +27 -0
- data/lib/leftovers/value_processors/each_positional_argument.rb +24 -0
- data/lib/leftovers/value_processors/itself.rb +17 -0
- data/lib/leftovers/value_processors/keyword.rb +36 -0
- data/lib/leftovers/value_processors/keyword_argument.rb +36 -0
- data/lib/leftovers/value_processors/parameterize.rb +24 -0
- data/lib/leftovers/value_processors/placeholder.rb +18 -0
- data/lib/leftovers/value_processors/pluralize.rb +24 -0
- data/lib/leftovers/value_processors/positional_argument.rb +26 -0
- data/lib/leftovers/value_processors/replace_value.rb +18 -0
- data/lib/leftovers/value_processors/return_definition.rb +24 -0
- data/lib/leftovers/value_processors/return_string.rb +14 -0
- data/lib/leftovers/value_processors/singularize.rb +24 -0
- data/lib/leftovers/value_processors/split.rb +22 -0
- data/lib/leftovers/value_processors/swapcase.rb +19 -0
- data/lib/leftovers/value_processors/titleize.rb +24 -0
- data/lib/leftovers/value_processors/underscore.rb +24 -0
- data/lib/leftovers/value_processors/upcase.rb +19 -0
- data/lib/leftovers/version.rb +1 -1
- metadata +143 -24
- data/lib/leftovers/argument_rule.rb +0 -229
- data/lib/leftovers/core_ext.rb +0 -15
- data/lib/leftovers/hash_rule.rb +0 -42
- data/lib/leftovers/name_rule.rb +0 -98
- data/lib/leftovers/rule.rb +0 -82
- data/lib/leftovers/transform_rule.rb +0 -169
- data/lib/leftovers/value_rule.rb +0 -57
data/lib/config/redcarpet.yml
CHANGED
@@ -1,38 +1,35 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
- doc_footer
|
37
|
-
- preprocess
|
38
|
-
- postprocess
|
1
|
+
keep:
|
2
|
+
- autolink
|
3
|
+
- block_code
|
4
|
+
- block_html
|
5
|
+
- block_quote
|
6
|
+
- codespan
|
7
|
+
- doc_footer
|
8
|
+
- doc_header
|
9
|
+
- double_emphasis
|
10
|
+
- emphasis
|
11
|
+
- entity
|
12
|
+
- footnote_def
|
13
|
+
- footnote_ref
|
14
|
+
- footnotes
|
15
|
+
- header
|
16
|
+
- highlight
|
17
|
+
- hrule
|
18
|
+
- image
|
19
|
+
- linebreak
|
20
|
+
- link
|
21
|
+
- list
|
22
|
+
- list_item
|
23
|
+
- normal_text
|
24
|
+
- paragraph
|
25
|
+
- postprocess
|
26
|
+
- preprocess
|
27
|
+
- quote
|
28
|
+
- raw_html
|
29
|
+
- strikethrough
|
30
|
+
- superscript
|
31
|
+
- table
|
32
|
+
- table_cell
|
33
|
+
- table_row
|
34
|
+
- triple_emphasis
|
35
|
+
- underline
|
data/lib/config/rollbar.yml
CHANGED
data/lib/config/rspec.yml
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
test_paths:
|
2
2
|
- /spec/
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
# split into gems too
|
5
|
+
|
6
|
+
keep:
|
7
|
+
- path: /spec/
|
6
8
|
name:
|
7
9
|
# matchers
|
8
10
|
- diffable?
|
@@ -22,28 +24,31 @@ rules:
|
|
22
24
|
- dump_summary
|
23
25
|
- seed
|
24
26
|
- close
|
27
|
+
dynamic:
|
25
28
|
- name:
|
26
29
|
- have_attributes
|
27
30
|
- has_attributes?
|
28
31
|
- receive_messages
|
29
32
|
calls:
|
30
|
-
|
33
|
+
keywords: '**'
|
34
|
+
path: /spec/
|
31
35
|
- name:
|
32
36
|
- receive
|
33
37
|
- respond_to
|
34
38
|
calls:
|
35
|
-
argument:
|
39
|
+
argument: 0
|
40
|
+
path: /spec/
|
36
41
|
- name: define_negated_matcher
|
37
|
-
defines:
|
38
|
-
|
39
|
-
|
40
|
-
argument: 2
|
42
|
+
defines: 0
|
43
|
+
calls: 1
|
44
|
+
path: /spec/
|
41
45
|
- name:
|
42
46
|
has_prefix: be_
|
43
47
|
calls:
|
44
48
|
itself: true
|
45
49
|
delete_prefix: be_
|
46
50
|
add_suffix: '?'
|
51
|
+
path: /spec/
|
47
52
|
- name:
|
48
53
|
has_prefix: have_
|
49
54
|
calls:
|
@@ -51,6 +56,9 @@ rules:
|
|
51
56
|
add_suffix: '?'
|
52
57
|
delete_prefix: have_
|
53
58
|
add_prefix: has_
|
59
|
+
path: /spec/
|
54
60
|
- name: let
|
55
|
-
|
56
|
-
|
61
|
+
unless:
|
62
|
+
has_argument: 1
|
63
|
+
defines: 0
|
64
|
+
path: /spec/
|
data/lib/config/ruby.yml
CHANGED
@@ -14,36 +14,35 @@ test_paths:
|
|
14
14
|
- /tests/
|
15
15
|
- /test/
|
16
16
|
|
17
|
-
|
18
|
-
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
- eql? # called by Hash key equality
|
17
|
+
keep:
|
18
|
+
- initialize # called by new
|
19
|
+
- inspect # called by repl, to_s
|
20
|
+
- respond_to_missing? # called by respond_to?
|
21
|
+
- method_missing # called by method dispatch
|
22
|
+
- coerce # called by Numeric
|
23
|
+
- to_s # called by "#{}"
|
24
|
+
- to_ary # called by Array(), []+
|
25
|
+
- to_a # called by Array(), *splat
|
26
|
+
- to_str # called by String(), ""+
|
27
|
+
- to_hash # called by Hash(), **splat, {}.merge
|
28
|
+
- to_int # called by Integer()
|
29
|
+
- to_i # called by Integer()
|
30
|
+
- to_f # called by Float()
|
31
|
+
- <=> # called by Comparable
|
32
|
+
- each # called by Enumerable
|
33
|
+
- marshal_dump # called by Marshal.dump
|
34
|
+
- marshal_load # called by Marshal.load
|
35
|
+
- _dump # called by Marshal.dump
|
36
|
+
- _load # called by Marshal.load
|
37
|
+
- inherited # called by Subclass < Klass or Class.new(Klass)
|
38
|
+
- extended # called by extend Module
|
39
|
+
- included # called by include Module
|
40
|
+
- $VERBOSE # called by whatever is outputting warnings i guess
|
41
|
+
- === # called by when
|
42
|
+
- == # called by Array value, Hash value equality, ===
|
43
|
+
- hash # called by Hash key equality
|
44
|
+
- eql? # called by Hash key equality
|
45
|
+
dynamic:
|
47
46
|
- name:
|
48
47
|
- send
|
49
48
|
- public_send
|
@@ -51,8 +50,7 @@ rules:
|
|
51
50
|
- method
|
52
51
|
- respond_to?
|
53
52
|
- instance_method
|
54
|
-
calls:
|
55
|
-
argument: 1
|
53
|
+
calls: 0
|
56
54
|
- name: attr_reader
|
57
55
|
defines:
|
58
56
|
argument: '*'
|
@@ -62,33 +60,25 @@ rules:
|
|
62
60
|
- name: attr_writer
|
63
61
|
defines:
|
64
62
|
argument: '*'
|
65
|
-
|
66
|
-
- add_suffix: '='
|
63
|
+
add_suffix: '='
|
67
64
|
- name: attr_accessor
|
68
65
|
defines:
|
69
66
|
- argument: '*'
|
70
|
-
|
71
|
-
|
72
|
-
- add_suffix: '='
|
67
|
+
add_suffix: '='
|
68
|
+
- argument: '*'
|
73
69
|
calls:
|
74
70
|
argument: '*'
|
75
|
-
|
76
|
-
add_prefix: '@'
|
71
|
+
add_prefix: '@'
|
77
72
|
- name: define_method
|
78
|
-
defines:
|
79
|
-
argument: 1
|
73
|
+
defines: 0
|
80
74
|
- name: alias_method
|
81
|
-
defines:
|
82
|
-
|
83
|
-
calls:
|
84
|
-
argument: 2
|
75
|
+
defines: 0
|
76
|
+
calls: 1
|
85
77
|
- name:
|
86
78
|
- instance_variable_get
|
87
|
-
-
|
88
|
-
calls:
|
89
|
-
argument: 1
|
79
|
+
- class_variable_get
|
80
|
+
calls: 0
|
90
81
|
- name:
|
91
82
|
- instance_variable_set
|
92
83
|
- class_variable_set
|
93
|
-
defines:
|
94
|
-
argument: 1
|
84
|
+
defines: 0
|
@@ -1,21 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- after_quit
|
21
|
-
- after_close
|
1
|
+
keep:
|
2
|
+
- before_navigate_to
|
3
|
+
- before_navigate_back
|
4
|
+
- after_navigate_back
|
5
|
+
- before_navigate_forward
|
6
|
+
- after_navigate_forward
|
7
|
+
- before_find
|
8
|
+
- after_find
|
9
|
+
- before_click
|
10
|
+
- before_change_value_of
|
11
|
+
- after_change_value_of
|
12
|
+
- before_execute_script
|
13
|
+
- after_execute_script
|
14
|
+
- before_quit
|
15
|
+
- before_close
|
16
|
+
- after_navigate_to
|
17
|
+
- after_click
|
18
|
+
- after_quit
|
19
|
+
- after_close
|
data/lib/config/sidekiq.yml
CHANGED
@@ -1,14 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
- to_html
|
14
|
-
- container_attributes
|
1
|
+
keep:
|
2
|
+
# WillPaginate::ViewHelpers::LinkRenderer
|
3
|
+
- page_number
|
4
|
+
- gap
|
5
|
+
- previous_page
|
6
|
+
- next_page
|
7
|
+
- previous_or_next_page
|
8
|
+
- html_container
|
9
|
+
- url
|
10
|
+
- prepare
|
11
|
+
- to_html
|
12
|
+
- container_attributes
|
data/lib/leftovers.rb
CHANGED
@@ -1,22 +1,38 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './leftovers/core_ext'
|
4
|
-
require_relative './leftovers/backports'
|
5
|
-
require_relative './leftovers/collector'
|
6
|
-
require_relative './leftovers/merged_config'
|
7
|
-
require_relative './leftovers/reporter'
|
8
|
-
|
9
3
|
module Leftovers # rubocop:disable Metrics/ModuleLength
|
10
|
-
class Error < StandardError; end
|
11
|
-
class ConfigError < Error; end
|
4
|
+
class Error < ::StandardError; end
|
12
5
|
|
13
6
|
module_function
|
14
7
|
|
8
|
+
autoload(:AST, "#{__dir__}/leftovers/ast")
|
9
|
+
autoload(:Backports, "#{__dir__}/leftovers/backports")
|
10
|
+
autoload(:CLI, "#{__dir__}/leftovers/cli")
|
11
|
+
autoload(:Collector, "#{__dir__}/leftovers/collector")
|
12
|
+
autoload(:ConfigValidator, "#{__dir__}/leftovers/config_validator")
|
13
|
+
autoload(:Config, "#{__dir__}/leftovers/config")
|
14
|
+
autoload(:DefinitionSet, "#{__dir__}/leftovers/definition_set")
|
15
|
+
autoload(:Definition, "#{__dir__}/leftovers/definition")
|
16
|
+
autoload(:ERB, "#{__dir__}/leftovers/erb")
|
17
|
+
autoload(:FileCollector, "#{__dir__}/leftovers/file_collector")
|
18
|
+
autoload(:FileList, "#{__dir__}/leftovers/file_list")
|
19
|
+
autoload(:File, "#{__dir__}/leftovers/file")
|
20
|
+
autoload(:Haml, "#{__dir__}/leftovers/haml")
|
21
|
+
autoload(:MatcherBuilders, "#{__dir__}/leftovers/matcher_builders")
|
22
|
+
autoload(:Matchers, "#{__dir__}/leftovers/matchers")
|
23
|
+
autoload(:MergedConfig, "#{__dir__}/leftovers/merged_config")
|
24
|
+
autoload(:Parser, "#{__dir__}/leftovers/parser")
|
25
|
+
autoload(:ProcessorBuilders, "#{__dir__}/leftovers/processor_builders")
|
26
|
+
autoload(:RakeTask, "#{__dir__}/leftovers/rake_task")
|
27
|
+
autoload(:Reporter, "#{__dir__}/leftovers/reporter")
|
28
|
+
autoload(:DynamicProcessors, "#{__dir__}/leftovers/dynamic_processors")
|
29
|
+
autoload(:ValueProcessors, "#{__dir__}/leftovers/value_processors")
|
30
|
+
autoload(:VERSION, "#{__dir__}/leftovers/version")
|
31
|
+
|
15
32
|
class << self
|
16
|
-
attr_accessor :parallel
|
33
|
+
attr_accessor :parallel, :progress
|
17
34
|
alias_method :parallel?, :parallel
|
18
35
|
|
19
|
-
attr_accessor :progress
|
20
36
|
alias_method :progress?, :progress
|
21
37
|
end
|
22
38
|
|
@@ -29,7 +45,7 @@ module Leftovers # rubocop:disable Metrics/ModuleLength
|
|
29
45
|
end
|
30
46
|
|
31
47
|
def config
|
32
|
-
@config ||= Leftovers::MergedConfig.new
|
48
|
+
@config ||= Leftovers::MergedConfig.new(load_defaults: true)
|
33
49
|
end
|
34
50
|
|
35
51
|
def collector
|
@@ -40,23 +56,21 @@ module Leftovers # rubocop:disable Metrics/ModuleLength
|
|
40
56
|
@reporter ||= Leftovers::Reporter.new
|
41
57
|
end
|
42
58
|
|
43
|
-
def leftovers
|
59
|
+
def leftovers
|
44
60
|
@leftovers ||= begin
|
45
61
|
collector.collect
|
46
|
-
collector.definitions.reject
|
47
|
-
definition.skipped? || definition.in_collection?
|
48
|
-
end
|
62
|
+
collector.definitions.reject(&:in_collection?)
|
49
63
|
end
|
50
64
|
end
|
51
65
|
|
52
|
-
def run(stdout: StringIO.new, stderr: StringIO.new) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
66
|
+
def run(stdout: StringIO.new, stderr: StringIO.new) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
53
67
|
@stdout = stdout
|
54
68
|
@stderr = stderr
|
55
69
|
return 0 if leftovers.empty?
|
56
70
|
|
57
71
|
only_test = []
|
58
72
|
none = []
|
59
|
-
leftovers.
|
73
|
+
leftovers.sort_by(&:location_s).each do |definition|
|
60
74
|
if !definition.test? && definition.in_test_collection?
|
61
75
|
only_test << definition
|
62
76
|
else
|
@@ -77,7 +91,7 @@ module Leftovers # rubocop:disable Metrics/ModuleLength
|
|
77
91
|
1
|
78
92
|
end
|
79
93
|
|
80
|
-
def reset # rubocop:disable Metrics/
|
94
|
+
def reset # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
|
81
95
|
remove_instance_variable(:@config) if defined?(@config)
|
82
96
|
remove_instance_variable(:@collector) if defined?(@collector)
|
83
97
|
remove_instance_variable(:@reporter) if defined?(@reporter)
|
@@ -93,6 +107,11 @@ module Leftovers # rubocop:disable Metrics/ModuleLength
|
|
93
107
|
stderr.puts("\e[2K#{message}")
|
94
108
|
end
|
95
109
|
|
110
|
+
def error(message)
|
111
|
+
warn(message)
|
112
|
+
exit 1
|
113
|
+
end
|
114
|
+
|
96
115
|
def puts(message)
|
97
116
|
stdout.puts("\e[2K#{message}")
|
98
117
|
end
|
@@ -126,6 +145,7 @@ module Leftovers # rubocop:disable Metrics/ModuleLength
|
|
126
145
|
rescue LoadError
|
127
146
|
false
|
128
147
|
end
|
148
|
+
|
129
149
|
warn message if !@try_require[requirable] && message
|
130
150
|
@try_require[requirable]
|
131
151
|
end
|
@@ -137,12 +157,4 @@ module Leftovers # rubocop:disable Metrics/ModuleLength
|
|
137
157
|
else yield(value)
|
138
158
|
end
|
139
159
|
end
|
140
|
-
|
141
|
-
def array_wrap(value)
|
142
|
-
case value
|
143
|
-
when nil then [].freeze
|
144
|
-
when Array then value
|
145
|
-
else [value]
|
146
|
-
end
|
147
|
-
end
|
148
160
|
end
|