flay 2.13.0 → 2.13.2

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: ae1c2d1ab38f3aa6a03b5d110f00f5548d661de7380373ae9d61265f682b6976
4
- data.tar.gz: bf0dd5d5f85d35c4eb953e634071c5499e622c17ca11e9fa4089d2a7bc9f3964
3
+ metadata.gz: de2d236dadc0340897219bba93297f0075b425a8ed67bf942ec858652622c188
4
+ data.tar.gz: 0647f0f3e5f11b90ebd3487c0b8a0fcd90ebfc0251596525f7c06623ce8ab045
5
5
  SHA512:
6
- metadata.gz: 81c6471ba30b5d57ff3d1698d4920d3b94fa3161e4f36d2ce8ca22c42ab8476bb02a23a9884261e742c2d3e1efa8380c4f3995bd2c216634de695338848f79ef
7
- data.tar.gz: 8daaba1c53636b86d1682606750bfd07b27590c34eb19799f267d6c76a0dd8dfff53ecbe14e3211a3b094751e25df44ffb3de4bf518d0970272edd53ad6f97df
6
+ metadata.gz: '0083c27a6b5861262235ae4199cdf85a60c2851d939927fafad7a77714ae660a5a38b783403273dea51b59579438eab41bb95239a48e73587ea2cfb84746b99f'
7
+ data.tar.gz: 8c7d1e26acc0f02751930d56de8f8972a849b750dcefbea11cfdd873ad1bc7f2f9338bfe1d6e1d487fcd00ed7f7dc6e4b557555fa430777b3e7ceda7c4b70da6
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,15 @@
1
+ === 2.13.2 / 2024-02-05
2
+
3
+ * 1 bug fix:
4
+
5
+ * Pass dirs to Flay.run in FlayTask. (adam12)
6
+
7
+ === 2.13.1 / 2023-07-20
8
+
9
+ * 1 minor enhancement:
10
+
11
+ * Brought in action_view erubi hacks to enable block calls w/ <%= forms.
12
+
1
13
  === 2.13.0 / 2022-04-09
2
14
 
3
15
  * 1 minor enhancement:
data/lib/flay.rb CHANGED
@@ -8,7 +8,7 @@ require "timeout"
8
8
  require "zlib"
9
9
 
10
10
  class Flay
11
- VERSION = "2.13.0" # :nodoc:
11
+ VERSION = "2.13.2" # :nodoc:
12
12
 
13
13
  class Item < Struct.new(:structural_hash, :name, :bonus, :mass, :locations)
14
14
  alias identical? bonus
data/lib/flay_erb.rb CHANGED
@@ -10,7 +10,8 @@ class Flay
10
10
  def process_erb file
11
11
  erb = File.read file
12
12
 
13
- ruby = Erubi::Engine.new(erb).src
13
+ ruby = Erubi.new(erb).src
14
+
14
15
  begin
15
16
  RubyParser.new.process(ruby, file)
16
17
  rescue => e
@@ -18,4 +19,69 @@ class Flay
18
19
  raise e
19
20
  end
20
21
  end
22
+
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?
39
+
40
+ if text == "\n"
41
+ @newline_pending += 1
42
+ else
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
49
+ end
50
+ end
51
+
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="
59
+ else
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
84
+ end
85
+ end
86
+ end
21
87
  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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flay
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.0
4
+ version: 2.13.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -10,9 +10,9 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBBjANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDPjCCAiagAwIBAgIBCDANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTIxMTIyMzIzMTkwNFoXDTIyMTIyMzIzMTkwNFowRTETMBEGA1UE
15
+ GRYDY29tMB4XDTI0MDEwMjIxMjEyM1oXDTI1MDEwMTIxMjEyM1owRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
17
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
18
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -22,14 +22,14 @@ cert_chain:
22
22
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
23
  gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
24
24
  HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
25
- AQCKB5jfsuSnKb+t/Wrh3UpdkmX7TrEsjVmERC0pPqzQ5GQJgmEXDD7oMgaKXaAq
26
- x2m+KSZDrqk7c8uho5OX6YMqg4KdxehfSLqqTZGoeV78qwf/jpPQZKTf+W9gUSJh
27
- zsWpo4K50MP+QtdSbKXZwjAafpQ8hK0MnnZ/aeCsW9ov5vdXpYbf3dpg6ADXRGE7
28
- lQY2y1tJ5/chqu6h7dQmnm2ABUqx9O+JcN9hbCYoA5i/EeubUEtFIh2w3SpO6YfB
29
- JFmxn4h9YO/pVdB962BdBNNDia0kgIjI3ENnkLq0dKpYU3+F3KhEuTksLO0L6X/V
30
- YsuyUzsMz6GQA4khyaMgKNSD
25
+ AQCygvpmncmkiSs9r/Kceo4bBPDszhTv6iBi4LwMReqnFrpNLMOWJw7xi8x+3eL2
26
+ XS09ZPNOt2zm70KmFouBMgOysnDY4k2dE8uF6B8JbZOO8QfalW+CoNBliefOTcn2
27
+ bg5IOP7UoGM5lC174/cbDJrJnRG9bzig5FAP0mvsgA8zgTRXQzIUAZEo92D5K7p4
28
+ B4/O998ho6BSOgYBI9Yk1ttdCtti6Y+8N9+fZESsjtWMykA+WXWeGUScHqiU+gH8
29
+ S7043fq9EbQdBr2AXdj92+CDwuTfHI6/Hj5FVBDULufrJaan4xUgL70Hvc6pTTeW
30
+ deKfBjgVAq7EYHu1AczzlUly
31
31
  -----END CERTIFICATE-----
32
- date: 2022-04-09 00:00:00.000000000 Z
32
+ date: 2024-02-05 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: sexp_processor
@@ -141,14 +141,14 @@ dependencies:
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '3.23'
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.23'
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,
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
196
  - !ruby/object:Gem::Version
197
197
  version: '0'
198
198
  requirements: []
199
- rubygems_version: 3.3.3
199
+ rubygems_version: 3.5.3
200
200
  signing_key:
201
201
  specification_version: 4
202
202
  summary: Flay analyzes code for structural similarities
metadata.gz.sig CHANGED
Binary file