flay 2.12.1 → 2.13.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: 82b6642b1277bcd3a44da4c3ce4b5e72fa4432f7660a3d497d933ca4c2950556
4
- data.tar.gz: c865cbbdf68e0183bbf3fb6a1ff6188651034634398364aac77c4eed451384c3
3
+ metadata.gz: f398ea8e7f796a1871faedb32dbee7d7377d30abcc91edd075f2015a6be95c74
4
+ data.tar.gz: cdb49c908285be2c5c40118a33e7d0227e4a32a4b31736b374aaf31a43e58ac6
5
5
  SHA512:
6
- metadata.gz: 5ed7081512167da74c114acbd37098f1b6ff01a0521c2f400408da1243441030e6d342d7e34b400702eb74cf97a66879bd5b276339564c83582f1105c624fe15
7
- data.tar.gz: c57fdc2be2bb6c85523fa4e895fc6cbe04ffd158a17a0d946768950dec545653a132ccdfa9ab51c25502a66076f7a7e8f45ba78dafc921995b175aabe22f1531
6
+ metadata.gz: 9c7f5b54202e563702d21ee8006d24124dd7810bb3518ae307a1eba17966a042864af2c0b772df9deab11517a8a6268159e5503d6fe70845722ef3544b7b84a9
7
+ data.tar.gz: 301d1e56ecfd1c12e8d41e826e56c44899598712aec55daac4ba55f74df547e5421250c3ea8dace955edaeacacd0a513c4a3e888f83aa47fddcfe340fb49c9b2
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,32 @@
1
+ === 2.13.3 / 2024-05-21
2
+
3
+ * 2 bug fixes:
4
+
5
+ * Add secondary sort of score & files on output. (njhammond)
6
+ * Sort input files to make tracking progress easier.
7
+
8
+ === 2.13.2 / 2024-02-05
9
+
10
+ * 1 bug fix:
11
+
12
+ * Pass dirs to Flay.run in FlayTask. (adam12)
13
+
14
+ === 2.13.1 / 2023-07-20
15
+
16
+ * 1 minor enhancement:
17
+
18
+ * Brought in action_view erubi hacks to enable block calls w/ <%= forms.
19
+
20
+ === 2.13.0 / 2022-04-09
21
+
22
+ * 1 minor enhancement:
23
+
24
+ * Switched from erubis to erubi for erb processing. (clive-devops)
25
+
26
+ * 1 bug fix:
27
+
28
+ * Minor cleanup and top-level error handling changes.
29
+
1
30
  === 2.12.1 / 2019-10-08
2
31
 
3
32
  * 1 bug fix:
data/Rakefile CHANGED
@@ -21,7 +21,7 @@ Hoe.spec "flay" do
21
21
 
22
22
  dependency "sexp_processor", "~> 4.0"
23
23
  dependency "ruby_parser", "~> 3.0"
24
- dependency "erubis", "~> 2.7.0"
24
+ dependency "erubi", "~> 1.10"
25
25
  dependency "path_expander", "~> 1.0"
26
26
 
27
27
  dependency "minitest", "~> 5.8.0", :dev
data/lib/flay.rb CHANGED
@@ -1,23 +1,14 @@
1
1
  #!/usr/bin/env ruby -w
2
2
 
3
3
  require "optparse"
4
- require "rubygems"
5
4
  require "sexp_processor"
6
5
  require "ruby_parser"
7
6
  require "path_expander"
8
7
  require "timeout"
9
8
  require "zlib"
10
9
 
11
- class File
12
- RUBY19 = "<3".respond_to? :encoding unless defined? RUBY19 # :nodoc:
13
-
14
- class << self
15
- alias :binread :read unless RUBY19
16
- end
17
- end
18
-
19
10
  class Flay
20
- VERSION = "2.12.1" # :nodoc:
11
+ VERSION = "2.13.3" # :nodoc:
21
12
 
22
13
  class Item < Struct.new(:structural_hash, :name, :bonus, :mass, :locations)
23
14
  alias identical? bonus
@@ -35,7 +26,7 @@ class Flay
35
26
  files = expander.filter_files expander.process, DEFAULT_IGNORE
36
27
 
37
28
  flay = Flay.new Flay.parse_options args
38
- flay.process(*files)
29
+ flay.process(*files.sort)
39
30
  flay
40
31
  end
41
32
 
@@ -159,8 +150,8 @@ class Flay
159
150
  end
160
151
  end
161
152
  @@plugins
162
- rescue
163
- # ignore
153
+ rescue => e
154
+ warn "Error loading plugins: #{e}" if option[:verbose]
164
155
  end
165
156
 
166
157
  # :stopdoc:
@@ -493,7 +484,7 @@ class Flay
493
484
  if option[:summary] then
494
485
  io.puts
495
486
 
496
- self.summary.sort_by { |_,v| -v }.each do |file, score|
487
+ self.summary.sort_by { |f,v| [-v, f] }.each do |file, score|
497
488
  io.puts "%8.2f: %s" % [score, file]
498
489
  end
499
490
 
data/lib/flay_erb.rb CHANGED
@@ -1,8 +1,5 @@
1
- #!/usr/bin/ruby
2
-
3
- require "rubygems"
4
1
  require "flay"
5
- require "erubis"
2
+ require "erubi"
6
3
 
7
4
  class Flay
8
5
 
@@ -13,7 +10,8 @@ class Flay
13
10
  def process_erb file
14
11
  erb = File.read file
15
12
 
16
- ruby = Erubis.new(erb).src
13
+ ruby = Erubi.new(erb).src
14
+
17
15
  begin
18
16
  RubyParser.new.process(ruby, file)
19
17
  rescue => e
@@ -22,22 +20,67 @@ class Flay
22
20
  end
23
21
  end
24
22
 
25
- class Erubis < ::Erubis::Eruby # :nodoc:
26
- BLOCK_EXPR = /\s+(do|\{)(\s*\|[^|]*\|)?\s*\Z/
23
+ # stolen (and munged) from lib/action_view/template/handlers/erb/erubi.rb
24
+ # this is also in the debride-erb gem, update both!
25
+ class Erubi < ::Erubi::Engine
26
+ # :nodoc: all
27
+ def initialize(input, properties = {})
28
+ @newline_pending = 0
29
+
30
+ properties[:postamble] = "_buf.to_s"
31
+ properties[:bufvar] = "_buf"
32
+ properties[:freeze_template_literals] = false
33
+
34
+ super
35
+ end
36
+
37
+ def add_text(text)
38
+ return if text.empty?
27
39
 
28
- def add_expr_literal(src, code)
29
- if code =~ BLOCK_EXPR
30
- src << '@output_buffer.append= ' << code
40
+ if text == "\n"
41
+ @newline_pending += 1
31
42
  else
32
- src << '@output_buffer.append=(' << code << ');'
43
+ src << "_buf.safe_append='"
44
+ src << "\n" * @newline_pending if @newline_pending > 0
45
+ src << text.gsub(/['\\]/, '\\\\\&')
46
+ src << "';"
47
+
48
+ @newline_pending = 0
33
49
  end
34
50
  end
35
51
 
36
- def add_expr_escaped(src, code)
37
- if code =~ BLOCK_EXPR
38
- src << "@output_buffer.safe_append= " << code
52
+ BLOCK_EXPR = /\s*((\s+|\))do|\{)(\s*\|[^|]*\|)?\s*\Z/
53
+
54
+ def add_expression(indicator, code)
55
+ flush_newline_if_pending(src)
56
+
57
+ if (indicator == "==") || @escape
58
+ src << "_buf.safe_expr_append="
39
59
  else
40
- src << "@output_buffer.safe_append=(" << code << ");"
60
+ src << "_buf.append="
61
+ end
62
+
63
+ if BLOCK_EXPR.match?(code)
64
+ src << " " << code
65
+ else
66
+ src << "(" << code << ");"
67
+ end
68
+ end
69
+
70
+ def add_code(code)
71
+ flush_newline_if_pending(src)
72
+ super
73
+ end
74
+
75
+ def add_postamble(_)
76
+ flush_newline_if_pending(src)
77
+ super
78
+ end
79
+
80
+ def flush_newline_if_pending(src)
81
+ if @newline_pending > 0
82
+ src << "_buf.safe_append='#{"\n" * @newline_pending}';"
83
+ @newline_pending = 0
41
84
  end
42
85
  end
43
86
  end
data/lib/flay_task.rb CHANGED
@@ -45,7 +45,7 @@ class FlayTask < Rake::TaskLib
45
45
  desc "Analyze for code duplication in: #{dirs.join(", ")}"
46
46
  task name do
47
47
  require "flay"
48
- flay = Flay.run
48
+ flay = Flay.run(dirs)
49
49
  flay.report if verbose
50
50
 
51
51
  raise "Flay total too high! #{flay.total} > #{threshold}" if
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flay
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.1
4
+ version: 2.13.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBAzANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDPjCCAiagAwIBAgIBCDANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZG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8uF6B8JbZOO8QfalW+CoNBliefOTcn2
27
+ bg5IOP7UoGM5lC174/cbDJrJnRG9bzig5FAP0mvsgA8zgTRXQzIUAZEo92D5K7p4
28
+ B4/O998ho6BSOgYBI9Yk1ttdCtti6Y+8N9+fZESsjtWMykA+WXWeGUScHqiU+gH8
29
+ S7043fq9EbQdBr2AXdj92+CDwuTfHI6/Hj5FVBDULufrJaan4xUgL70Hvc6pTTeW
30
+ deKfBjgVAq7EYHu1AczzlUly
31
31
  -----END CERTIFICATE-----
32
- date: 2019-10-09 00:00:00.000000000 Z
32
+ date: 2024-05-22 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: sexp_processor
@@ -60,19 +60,19 @@ dependencies:
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.0'
62
62
  - !ruby/object:Gem::Dependency
63
- name: erubis
63
+ name: erubi
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 2.7.0
68
+ version: '1.10'
69
69
  type: :runtime
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 2.7.0
75
+ version: '1.10'
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: path_expander
78
78
  requirement: !ruby/object:Gem::Requirement
@@ -141,14 +141,14 @@ dependencies:
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '3.18'
144
+ version: '4.2'
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '3.18'
151
+ version: '4.2'
152
152
  description: |-
153
153
  Flay analyzes code for structural similarities. Differences in literal
154
154
  values, variable, class, method names, whitespace, programming style,
@@ -176,8 +176,10 @@ files:
176
176
  homepage: http://ruby.sadi.st/
177
177
  licenses:
178
178
  - MIT
179
- metadata: {}
180
- post_install_message:
179
+ metadata:
180
+ homepage_uri: http://ruby.sadi.st/
181
+ source_code_uri: https://github.com/seattlerb/flay
182
+ post_install_message:
181
183
  rdoc_options:
182
184
  - "--main"
183
185
  - README.rdoc
@@ -194,8 +196,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
196
  - !ruby/object:Gem::Version
195
197
  version: '0'
196
198
  requirements: []
197
- rubygems_version: 3.0.6
198
- signing_key:
199
+ rubygems_version: 3.5.3
200
+ signing_key:
199
201
  specification_version: 4
200
202
  summary: Flay analyzes code for structural similarities
201
203
  test_files: []
metadata.gz.sig CHANGED
Binary file