leftovers 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e6117fe1e8a7c5be09e50512f8bc17287f5dd99352d58645d53846130eeb4e9
4
- data.tar.gz: a7907abb8c07b4f5026f78203bd1b216df655ad2853f199da381a53366edabb4
3
+ metadata.gz: 52698685d049f76cfbe3034d85b9de65aec3c06b44434119a6581b399778a648
4
+ data.tar.gz: daa5a40d80c7a180eb81a4dd59bc841788da04db541cfc93f2ae02577b1fd251
5
5
  SHA512:
6
- metadata.gz: 8c9ddf1a721a8bbe56fafde72e65aad91450a64cbfb63667584f87ca7d63d580372724cfc7677f978f6e981bd269addbe4b1395e95c40a6dd6dd8752d1627927
7
- data.tar.gz: 290a53782aa235c4fad3ce22257146e42b7268882fa34b3ffdf809b1023308e5266a621004a8e1d14e3217b6a9a60c4574cfd204669bd385a11f2a69e575fdf7
6
+ metadata.gz: 98ab99b3d471cdf3d42cf2c2e4940fc985313d68ce6a1ffe7b2f2909b0bcd95c1019a5fccdb306177a8283c0837baf068942a9f390fc38ccdeed9f5ecf8019f7
7
+ data.tar.gz: 1dcea67041a8afec49b80ff6b168d18fa28fcba7c6bbd546d0f004f76152f12116d9538cc0920e32721228a8a41233ad8788678d77fd55279f79b000e744ac55
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # v0.2.3
2
+ - restore ability to handle syntax errors. I really need to add coverage to this project
3
+ - Fix bug with delete_after on an empty string
4
+ - Support more of rails
5
+ - Support parts of sidekiq
6
+
1
7
  # v0.2.2
2
8
  - update fast_ignore dependency
3
9
 
data/exe/leftovers CHANGED
@@ -3,4 +3,4 @@
3
3
 
4
4
  require_relative '../lib/leftovers/cli'
5
5
 
6
- Leftovers::CLI.new(argv: ARGV, stdout: $stdout, stderr: $stderr)
6
+ Leftovers::CLI.new(argv: ARGV)
data/leftovers.gemspec CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency 'bundler', '~> 2.0'
34
34
  spec.add_development_dependency 'haml'
35
35
  spec.add_development_dependency 'pry', '~> 0.1'
36
- spec.add_development_dependency 'rake', '~> 10.0'
36
+ spec.add_development_dependency 'rake', '>= 13'
37
37
  spec.add_development_dependency 'rspec', '~> 3.0'
38
38
  spec.add_development_dependency 'rubocop', '~> 0.74'
39
39
  spec.add_development_dependency 'rubocop-performance', '~> 1.4'
data/lib/config/rails.yml CHANGED
@@ -20,6 +20,7 @@ rules:
20
20
  - ssl_configured? # ApplicationController
21
21
  - APP_PATH
22
22
  - APP_ROOT
23
+ - default_url_options # called by url_for
23
24
  - skip: true
24
25
  names:
25
26
  has_suffix: Helper
@@ -190,38 +191,81 @@ rules:
190
191
  - has_many
191
192
  - has_and_belongs_to_many
192
193
  calls:
193
- argument: 1
194
- camelize: true
195
- singularize: true
196
- unless:
197
- has_argument: class_name
194
+ - argument: 1
195
+ camelize: true
196
+ singularize: true
197
+ unless:
198
+ has_argument: class_name
199
+ defines:
200
+ - argument: 1
201
+ linked_transforms:
202
+ - original
203
+ - add_suffix: '='
204
+ - singularize: true
205
+ add_suffix: _ids
206
+ - singularize: true
207
+ add_suffix: _ids=
198
208
  - name:
199
209
  - has_many
200
210
  - has_one
201
211
  - has_and_belongs_to_many
202
212
  calls:
203
- argument: as
213
+ argument:
214
+ - as
215
+ - name:
216
+ - has_one
217
+ - has_many
218
+ calls:
219
+ - argument:
220
+ - source_type
221
+ - source
222
+ - through
204
223
  - name:
205
224
  - has_one
206
- - has_many
207
225
  - belongs_to
208
- - has_and_belongs_to_many
209
226
  defines:
210
227
  - argument: 1
211
228
  linked_transforms:
212
229
  - original
213
230
  - add_suffix: '='
231
+ - add_prefix: build_
232
+ - add_prefix: create_
233
+ - add_prefix: create_
234
+ add_suffix: '!'
235
+ - add_prefix: reload
236
+ - name: belongs_to
237
+ calls:
238
+ argument: 1
239
+ unless:
240
+ has_argument:
241
+ keyword: optional
242
+ value: true
243
+
244
+ - name:
245
+ - has_one
246
+ - has_many
247
+ - belongs_to
248
+ - has_and_belongs_to_many
214
249
  calls:
215
250
  - argument:
216
- - through
217
251
  - class_name
218
252
  - inverse_of
253
+ - argument: touch
254
+ add_suffix: '='
219
255
  - argument: 1
220
256
  if:
221
257
  has_argument: dependent
222
258
  - argument: 1
223
259
  if:
224
260
  has_argument: inverse_of
261
+ - argument: 1
262
+ if:
263
+ has_argument: touch
264
+ - argument: 1
265
+ if:
266
+ has_argument:
267
+ keyword: validate
268
+ value: true
225
269
  - name:
226
270
  - rescue_from
227
271
  calls:
@@ -0,0 +1,13 @@
1
+ rules:
2
+ - skip: true
3
+ names:
4
+ - on_complete
5
+ - names:
6
+ - perform_async
7
+ calls:
8
+ itself: true
9
+ delete_suffix: _async
10
+ - name: register
11
+ calls:
12
+ argument: 2
13
+
data/lib/leftovers.rb CHANGED
@@ -21,11 +21,11 @@ module Leftovers # rubocop:disable Metrics/ModuleLength
21
21
  end
22
22
 
23
23
  def stdout
24
- @stdout ||= StringIO.new
24
+ @stdout ||= $stdout
25
25
  end
26
26
 
27
27
  def stderr
28
- @stderr ||= StringIO.new
28
+ @stderr ||= $stderr
29
29
  end
30
30
 
31
31
  def config
data/lib/leftovers/cli.rb CHANGED
@@ -8,7 +8,7 @@ module Leftovers
8
8
  class CLI
9
9
  attr_reader :argv, :stdout, :stderr
10
10
 
11
- def initialize(argv: [], stdout: StringIO.new, stderr: StringIO.new)
11
+ def initialize(argv: [], stdout: $stdout, stderr: $stderr)
12
12
  @argv = argv
13
13
  @stdout = stdout
14
14
  @stderr = stderr
@@ -35,8 +35,8 @@ module Leftovers
35
35
  ast, comments = Leftovers::Parser.parse_with_comments(@ruby, @file)
36
36
  process_comments(comments)
37
37
  process(ast)
38
- rescue Parser::SyntaxError => e
39
- Leftovers.warn "#{e.class}: #{e.message} #{filename}:#{e.diagnostic.location.line}:#{e.diagnostic.location.column}" # rubocop:disable Layout/LineLength
38
+ rescue ::Parser::SyntaxError => e
39
+ Leftovers.warn "\e[31m#{filename}:#{e.diagnostic.location.line}:#{e.diagnostic.location.column} SyntaxError: #{e.message}\e[0m" # rubocop:disable Layout/LineLength
40
40
  end
41
41
 
42
42
  METHOD_NAME_RE = /[[:alpha:]_][[:alnum:]_]*\b[\?!=]?/.freeze
@@ -212,6 +212,8 @@ module Leftovers
212
212
  node.test = test?(node.loc)
213
213
  definitions.concat(rule.definitions(node))
214
214
  end
215
+ rescue StandardError => e
216
+ raise e.class, "#{e.message}\nwhen processing #{node} at #{filename}:#{node.loc.line}:#{node.loc.column}", e.backtrace # rubocop:disable Layout/LineLength
215
217
  end
216
218
  end
217
219
  end
@@ -29,7 +29,7 @@ module Leftovers
29
29
  p.diagnostics.ignore_warnings = true
30
30
 
31
31
  p.diagnostics.consumer = lambda do |diagnostic|
32
- warn(diagnostic.render)
32
+ diagnostic
33
33
  end
34
34
 
35
35
  p
@@ -49,7 +49,7 @@ module Leftovers
49
49
  end
50
50
 
51
51
  def run(argv)
52
- Leftovers::CLI.new(argv: argv, stdout: $stdout, stderr: $stderr)
52
+ Leftovers::CLI.new(argv: argv)
53
53
  rescue SystemExit => e
54
54
  raise unless e.status == 0
55
55
  end
@@ -127,7 +127,7 @@ module Leftovers
127
127
  end
128
128
 
129
129
  def delete_after(string, _method_node)
130
- string.split(@delete_after, 2).first
130
+ string.split(@delete_after, 2).first || string
131
131
  end
132
132
 
133
133
  def replace_with(_string, _method_node)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leftovers
4
- VERSION = '0.2.2'
4
+ VERSION = '0.2.3'
5
5
  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.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dana Sherson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-21 00:00:00.000000000 Z
11
+ date: 2020-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '10.0'
75
+ version: '13'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '10.0'
82
+ version: '13'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -227,6 +227,7 @@ files:
227
227
  - lib/config/rspec.yml
228
228
  - lib/config/ruby.yml
229
229
  - lib/config/selenium.yml
230
+ - lib/config/sidekiq.yml
230
231
  - lib/config/simplecov.yml
231
232
  - lib/config/will_paginate.yml
232
233
  - lib/leftovers.rb