leftovers 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -2
- data/docs/Configuration.md +13 -0
- data/leftovers.gemspec +1 -0
- data/lib/config/ruby.yml +3 -0
- data/lib/config/slim.yml +4 -0
- data/lib/leftovers/config.rb +4 -0
- data/lib/leftovers/config_validator/schema_hash.rb +1 -0
- data/lib/leftovers/erb.rb +1 -1
- data/lib/leftovers/file.rb +10 -4
- data/lib/leftovers/merged_config.rb +24 -8
- data/lib/leftovers/slim.rb +21 -0
- data/lib/leftovers/version.rb +1 -1
- data/lib/leftovers.rb +2 -1
- metadata +17 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc87c83e3671055ddbbd445768b73d55576676da6cfff8d83f5ceb57eb1d78e8
|
4
|
+
data.tar.gz: a3cc4945b1d4158817d0a6b5a0c0cc8bc8ad1d2e7a402d0b0a3221cebba7dc02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 450162ef45051251a698a5cfbd0451ac50d175339b2a9888edd7790e29071a4360f7677ca4f8d6b927bfdc004b0e4fde747884804c8e480659b76a5b39d0f8e3
|
7
|
+
data.tar.gz: 6ae0474561c71a1eddd0f6ecb0ba184de668eaca4aea36da0460fbeec313f9f095533f913863913de89ad192903b1cadaaffb3231432136138b2720df094f636
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -57,7 +57,7 @@ Not directly called at all:
|
|
57
57
|
lib/hello_world.rb:6:6 generated_method= attr_accessor :generated_method
|
58
58
|
lib/hello_world.rb:6:6 generated_method attr_accessor :generated_method
|
59
59
|
|
60
|
-
how to resolve: https://github.com/robotdana/leftovers/tree/main/Readme.md#
|
60
|
+
how to resolve: https://github.com/robotdana/leftovers/tree/main/Readme.md#how-to-resolve
|
61
61
|
```
|
62
62
|
|
63
63
|
if there is an overwhelming number of results, try using [`--write-todo`](#write-todo)
|
@@ -163,7 +163,7 @@ see the [built in config files](https://github.com/robotdana/leftovers/tree/main
|
|
163
163
|
|
164
164
|
Add the method/pattern to the `dynamic:` list with `skip: true` in the `.leftovers.yml`, or add an inline comment with the list of possibilities `# leftovers:call my_method_1, my_method_2`.
|
165
165
|
- Leftovers compares by name only, so multiple definitions with the same name will count as used even if only one is.
|
166
|
-
- haml & erb line and column numbers will be wrong as the files have to be precompiled before checking.
|
166
|
+
- haml, slim & erb line and column numbers will be wrong as the files have to be precompiled before checking.
|
167
167
|
|
168
168
|
## Other tools
|
169
169
|
|
data/docs/Configuration.md
CHANGED
@@ -7,6 +7,7 @@ Its presence is optional and all of these settings are optional.
|
|
7
7
|
- [`exclude_paths:`](#exclude_paths)
|
8
8
|
- [`test_paths:`](#test_paths)
|
9
9
|
- [`haml_paths:`](#haml_paths)
|
10
|
+
- [`slim_paths:`](#slim_paths)
|
10
11
|
- [`erb_paths:`](#erb_paths)
|
11
12
|
- [`requires:`](#requires)
|
12
13
|
- [`gems:`](#gems)
|
@@ -92,6 +93,18 @@ haml_paths:
|
|
92
93
|
|
93
94
|
Arrays are not necessary for single values. `*.haml` is recognized by default
|
94
95
|
|
96
|
+
## `slim_paths:`
|
97
|
+
|
98
|
+
list filenames/paths of test directories that are in the slim format
|
99
|
+
Defined using the [.gitignore pattern format](https://git-scm.com/docs/gitignore#_pattern_format)
|
100
|
+
|
101
|
+
```yml
|
102
|
+
slim_paths:
|
103
|
+
- '*.slim'
|
104
|
+
```
|
105
|
+
|
106
|
+
Arrays are not necessary for single values. `*.slim` is recognized by default
|
107
|
+
|
95
108
|
## `erb_paths:`
|
96
109
|
|
97
110
|
list filenames/paths of test directories that are in the erb format
|
data/leftovers.gemspec
CHANGED
@@ -42,6 +42,7 @@ Gem::Specification.new do |spec|
|
|
42
42
|
spec.add_development_dependency 'rubocop-rspec', '~> 1.44.1'
|
43
43
|
spec.add_development_dependency 'simplecov', '>= 0.18.5'
|
44
44
|
spec.add_development_dependency 'simplecov-console'
|
45
|
+
spec.add_development_dependency 'slim'
|
45
46
|
spec.add_development_dependency 'timecop'
|
46
47
|
spec.add_development_dependency 'tty_string', '>= 0.2.1'
|
47
48
|
|
data/lib/config/ruby.yml
CHANGED
data/lib/config/slim.yml
ADDED
data/lib/leftovers/config.rb
CHANGED
@@ -517,6 +517,7 @@ module Leftovers
|
|
517
517
|
'exclude_paths' => { '$ref' => '#/definitions/stringList' },
|
518
518
|
'test_paths' => { '$ref' => '#/definitions/stringList' },
|
519
519
|
'haml_paths' => { '$ref' => '#/definitions/stringList' },
|
520
|
+
'slim_paths' => { '$ref' => '#/definitions/stringList' },
|
520
521
|
'erb_paths' => { '$ref' => '#/definitions/stringList' },
|
521
522
|
'requires' => { '$ref' => '#/definitions/stringList' },
|
522
523
|
'gems' => { '$ref' => '#/definitions/stringList' },
|
data/lib/leftovers/erb.rb
CHANGED
data/lib/leftovers/file.rb
CHANGED
@@ -15,12 +15,18 @@ module Leftovers
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def ruby
|
18
|
+
precompiler&.precompile(read, self) || read
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def precompiler
|
18
24
|
if Leftovers.config.haml_paths.allowed?(relative_path)
|
19
|
-
::Leftovers::Haml
|
25
|
+
::Leftovers::Haml
|
26
|
+
elsif Leftovers.config.slim_paths.allowed?(relative_path)
|
27
|
+
::Leftovers::Slim
|
20
28
|
elsif Leftovers.config.erb_paths.allowed?(relative_path)
|
21
|
-
::Leftovers::ERB
|
22
|
-
else
|
23
|
-
read
|
29
|
+
::Leftovers::ERB
|
24
30
|
end
|
25
31
|
end
|
26
32
|
end
|
@@ -37,14 +37,22 @@ module Leftovers
|
|
37
37
|
Leftovers::Config.new(:'.leftovers_todo.yml', path: Leftovers.pwd + '.leftovers_todo.yml')
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
40
|
+
MEMOIZED_IVARS = %i{
|
41
|
+
@exclude_paths
|
42
|
+
@include_paths
|
43
|
+
@test_paths
|
44
|
+
@haml_paths
|
45
|
+
@slim_paths
|
46
|
+
@erb_paths
|
47
|
+
@dynamic
|
48
|
+
@keep
|
49
|
+
@test_only
|
50
|
+
}.freeze
|
51
|
+
|
52
|
+
def unmemoize
|
53
|
+
MEMOIZED_IVARS.each do |ivar|
|
54
|
+
remove_instance_variable(ivar) if instance_variable_get(ivar)
|
55
|
+
end
|
48
56
|
end
|
49
57
|
|
50
58
|
def exclude_paths
|
@@ -71,6 +79,14 @@ module Leftovers
|
|
71
79
|
)
|
72
80
|
end
|
73
81
|
|
82
|
+
def slim_paths
|
83
|
+
@slim_paths ||= FastIgnore.new(
|
84
|
+
include_rules: @configs.flat_map(&:slim_paths),
|
85
|
+
gitignore: false,
|
86
|
+
root: Leftovers.pwd
|
87
|
+
)
|
88
|
+
end
|
89
|
+
|
74
90
|
def erb_paths
|
75
91
|
@erb_paths ||= FastIgnore.new(
|
76
92
|
include_rules: @configs.flat_map(&:erb_paths),
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Leftovers
|
4
|
+
module Slim
|
5
|
+
module_function
|
6
|
+
|
7
|
+
def precompile(file, name)
|
8
|
+
return '' unless Leftovers.try_require('slim', message: <<~MESSAGE) # rubocop:disable Layout/EmptyLineAfterGuardClause
|
9
|
+
Skipped parsing #{name.relative_path}, because the slim gem was not available
|
10
|
+
`gem install slim`
|
11
|
+
MESSAGE
|
12
|
+
|
13
|
+
begin
|
14
|
+
::Slim::Engine.new(file: file).call(file)
|
15
|
+
rescue ::Slim::Parser::SyntaxError => e
|
16
|
+
Leftovers.warn "#{e.class}: \"#{e.error}\" #{name.relative_path}:#{e.lineno}:#{e.column}"
|
17
|
+
''
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/leftovers/version.rb
CHANGED
data/lib/leftovers.rb
CHANGED
@@ -24,6 +24,7 @@ module Leftovers # rubocop:disable Metrics/ModuleLength
|
|
24
24
|
autoload(:ProcessorBuilders, "#{__dir__}/leftovers/processor_builders")
|
25
25
|
autoload(:RakeTask, "#{__dir__}/leftovers/rake_task")
|
26
26
|
autoload(:Reporter, "#{__dir__}/leftovers/reporter")
|
27
|
+
autoload(:Slim, "#{__dir__}/leftovers/slim")
|
27
28
|
autoload(:TodoReporter, "#{__dir__}/leftovers/todo_reporter")
|
28
29
|
autoload(:DynamicProcessors, "#{__dir__}/leftovers/dynamic_processors")
|
29
30
|
autoload(:ValueProcessors, "#{__dir__}/leftovers/value_processors")
|
@@ -93,7 +94,7 @@ module Leftovers # rubocop:disable Metrics/ModuleLength
|
|
93
94
|
end
|
94
95
|
|
95
96
|
def resolution_instructions_link
|
96
|
-
"https://github.com/robotdana/leftovers/tree/v#{Leftovers::VERSION}/README.md#
|
97
|
+
"https://github.com/robotdana/leftovers/tree/v#{Leftovers::VERSION}/README.md#how-to-resolve"
|
97
98
|
end
|
98
99
|
|
99
100
|
def warn(message)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leftovers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dana Sherson
|
@@ -178,6 +178,20 @@ dependencies:
|
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: slim
|
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: timecop
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -323,6 +337,7 @@ files:
|
|
323
337
|
- lib/config/selenium-webdriver.yml
|
324
338
|
- lib/config/sidekiq.yml
|
325
339
|
- lib/config/simplecov.yml
|
340
|
+
- lib/config/slim.yml
|
326
341
|
- lib/config/will_paginate.yml
|
327
342
|
- lib/leftovers.rb
|
328
343
|
- lib/leftovers/ast.rb
|
@@ -407,6 +422,7 @@ files:
|
|
407
422
|
- lib/leftovers/processor_builders/value.rb
|
408
423
|
- lib/leftovers/rake_task.rb
|
409
424
|
- lib/leftovers/reporter.rb
|
425
|
+
- lib/leftovers/slim.rb
|
410
426
|
- lib/leftovers/todo_reporter.rb
|
411
427
|
- lib/leftovers/value_processors.rb
|
412
428
|
- lib/leftovers/value_processors/add_dynamic_prefix.rb
|