flay 2.14.1 → 2.14.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f275c561e9ea5560f62973a4dbc4be004a2b00fa3fc8e219e05c5e1a5bb15c2
4
- data.tar.gz: 60ab58da19978d367f25415b658fbe50c137934aee7933bcd3e77bb47f75c085
3
+ metadata.gz: '0796aba130c20f61f7558524c865ae0abc87502218ee9e6bbdb348b9b9f1b80e'
4
+ data.tar.gz: a3a06b20c0ccd6358c4937cd0cfa267fcd435870f804afc799fe24f70a2bd664
5
5
  SHA512:
6
- metadata.gz: 3aef7416ffb1852e68ee9b4da66935bdbe1726171b71ea52982e14c752446cdcb52b409856f742f875a954800585199e36dec1e675ed88aed794bca9e2c1ccee
7
- data.tar.gz: 330b6986a40592d54a9d318850cbd3ce334578820be31bec868b9e3e4e9112213e495eaca518f4e5c5632a9c0aa91b01ab60d8f97c4a472e1b3f44ff0e1378c7
6
+ metadata.gz: 62f49813a8d3f8a08a6727330b229f333389ad9394c75a4777d7818a1b7c689d392617c6bd011ceca46eaca8d3009ed88ce0fc9ae3556d2d65f86d9307cb8f32
7
+ data.tar.gz: d6c5ebdd419d2623989b907cbc3fb89dd07404d702d7860ebebfa0db2d92ecab1e1d10a98ec57536d3b35b8e81f3ee5e5a72c9a50019fabe4df3dac3f21479f2
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,16 @@
1
+ === 2.4.3 / 2026-03-23
2
+
3
+ * 2 bug fixes:
4
+
5
+ * Fix Sexp#[] to return a Sexp to ensure process_fuzzy can sort sub-sexps.
6
+ * Make Sexp#[] return a single element if integer is used.
7
+
8
+ === 2.14.2 / 2026-01-06
9
+
10
+ * 1 bug fix:
11
+
12
+ * Namespace NotRubyParser to avoid problems with bundler's horrid eager loading. (nateberkopec)
13
+
1
14
  === 2.14.1 / 2025-12-20
2
15
 
3
16
  * 3 bug fixes:
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ Hoe::add_include_dirs("../../sexp_processor/dev/lib",
10
10
  "lib")
11
11
 
12
12
  Hoe.plugin :seattlerb
13
- Hoe.plugin :isolate
13
+ Hoe.plugin :isolate_binaries
14
14
  Hoe.plugin :rdoc
15
15
  Hoe.plugin :bundler
16
16
 
data/lib/flay.rb CHANGED
@@ -8,10 +8,10 @@ require "zlib"
8
8
  require "prism"
9
9
  require "prism/translation/ruby_parser"
10
10
 
11
- NotRubyParser = Class.new Prism::Translation::RubyParser # compatibility layer
12
-
13
11
  class Flay
14
- VERSION = "2.14.1" # :nodoc:
12
+ VERSION = "2.14.3" # :nodoc:
13
+
14
+ NotRubyParser = Class.new Prism::Translation::RubyParser # compatibility layer :nodoc:
15
15
 
16
16
  class Item < Struct.new(:structural_hash, :name, :bonus, :mass, :locations)
17
17
  alias identical? bonus
@@ -584,14 +584,8 @@ class Sexp
584
584
  alias :[] :[] # needed for STRICT_SEXP
585
585
 
586
586
  def [] a # :nodoc:
587
- # TODO: figure out a way to make this STRICT_SEXP happy
588
- s = super
589
- if Sexp === s then
590
- s.file = self.file
591
- s.line = self.line
592
- s.modified = self.modified
593
- end
594
- s
587
+ return super if Integer === a
588
+ self.new._concat super
595
589
  end
596
590
 
597
591
  def + o # :nodoc:
data/test/test_flay.rb CHANGED
@@ -62,6 +62,8 @@ class TestSexp < Minitest::Test
62
62
  assert_equal expected, x.sort.uniq
63
63
  end
64
64
 
65
+ NotRubyParser = Flay::NotRubyParser
66
+
65
67
  DOG_AND_CAT = NotRubyParser.new.process <<~RUBY
66
68
  ##
67
69
  # I am a dog.
@@ -227,6 +229,76 @@ class TestSexp < Minitest::Test
227
229
  assert_equal exp.gsub(/\d+/, "N"), out.gsub(/\d+/, "N")
228
230
  end
229
231
 
232
+ def test__fuzzy__idx
233
+ sexp = NotRubyParser.new.parse "def x(n); n + 1; end"
234
+
235
+ assert_equal :defn, sexp[0]
236
+ assert_equal s(:defn), sexp[0..0]
237
+ assert_equal s(:defn, :x), sexp[0..1]
238
+ end
239
+
240
+ def test__fuzzy__split_at
241
+ # def x(n); n + 1; end
242
+ sexp = s(:defn, :x, s(:args, :n), s(:call, s(:lvar, :n), :+, s(:lit, 1)))
243
+ sexp = NotRubyParser.new.parse "def x(n); n + 1; end"
244
+
245
+ a, b = sexp.split_at 2
246
+
247
+ assert_equal s(:defn, :x, s(:args, :n)), a
248
+ assert_equal s(s(:call, s(:lvar, :n), :+, s(:lit, 1))), b
249
+ end
250
+
251
+ def test__fuzzy__split_code
252
+ # def x(n); n + 1; end
253
+ sexp = s(:defn, :x, s(:args, :n), s(:call, s(:lvar, :n), :+, s(:lit, 1)))
254
+ sexp = NotRubyParser.new.parse "def x(n); n + 1; end"
255
+
256
+ a, b = sexp.split_code
257
+
258
+ assert_equal s(:defn, :x, s(:args, :n)), a
259
+ assert_equal s(s(:call, s(:lvar, :n), :+, s(:lit, 1))), b
260
+ end
261
+
262
+ FUZZY_CODE = NotRubyParser.new.process <<-RUBY
263
+ def a
264
+ f1; f2; f3; f4; f5; f6
265
+ end
266
+
267
+ def b
268
+ f2; f3; f4; f5; f6
269
+ end
270
+
271
+ def c
272
+ f2; f3; f4; f5; f6; f7
273
+ end
274
+ RUBY
275
+
276
+ def test_report__fuzzy
277
+ flay = Flay.new OPTS.merge(fuzzy: 1, mass: 5)
278
+
279
+ flay.process_sexp FUZZY_CODE.deep_clone
280
+
281
+ out, err = capture_io do
282
+ flay.report
283
+ end
284
+
285
+ exp = <<~END
286
+ Total score (lower is better) = 37
287
+
288
+ 1) Similar code found in :defn (mass = 21)
289
+ (string):1 (FUZZY)
290
+ (string):5
291
+ (string):9 (FUZZY)
292
+
293
+ 2) Similar code found in :defn (mass = 16)
294
+ (string):1
295
+ (string):9
296
+ END
297
+
298
+ assert_equal "", err
299
+ assert_equal exp.gsub(/\d+/, "N"), out.gsub(/\d+/, "N")
300
+ end
301
+
230
302
  def test_report_io
231
303
  out = StringIO.new
232
304
  flay = Flay.new OPTS
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.14.1
4
+ version: 2.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -9,9 +9,9 @@ bindir: bin
9
9
  cert_chain:
10
10
  - |
11
11
  -----BEGIN CERTIFICATE-----
12
- MIIDPjCCAiagAwIBAgIBCTANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
12
+ MIIDPjCCAiagAwIBAgIBCjANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
13
13
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
14
- GRYDY29tMB4XDTI1MDEwNjIzMjcwMVoXDTI2MDEwNjIzMjcwMVowRTETMBEGA1UE
14
+ GRYDY29tMB4XDTI2MDEwNzAxMDkxNFoXDTI3MDEwNzAxMDkxNFowRTETMBEGA1UE
15
15
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
16
16
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
17
17
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -21,12 +21,12 @@ cert_chain:
21
21
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
22
22
  gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
23
23
  HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
24
- AQAC0WQJcPOWPFwkojhzweilRVjTJ19UiLhiBTw3C1wJO3LVdBkWDmnnhAmKuX4D
25
- r7vjQvESlABGIPdutI1Yl7mrHQzTkfLfXvNN6MT0nLChPyIYauT6SZZxubwJrUfA
26
- 7R0c2CJTIboZ0XaGpLsXqHEF1c29H7TV1QvVuqKAN2mCjh4N82QVn+ZKtys28AwT
27
- 6GfQX2fqLoi4KSc7xIzHKaNzqxeOICmJofk9w5VZ2rRN6yes8jvFYwz9HR41wdj8
28
- bwfinv7Yp5fA6AysuZLhCykyfDuZVRrUp0Vb68YCKsLjJly/Theak+euNTxvHsB+
29
- al9oSgPPHICMEX65qvLywitx
24
+ AQA/X8/PKTTc/IkYQEUL6XWtfK8fAfbuLJzmLcz6f2ZWrtBvPsYvqRuwI1bWUtil
25
+ 2ibJEfIuSIHX6BsUTX18+hlaIussf6EWq/YkE7e2BKmgQE42vSOZMce0kCEAPbx0
26
+ rQtqonfWTHQ8UbQ7GqCL3gDQ0QDD2B+HUlb4uaCZ2icxqa/eOtxMvHC2tj+h0xKY
27
+ xL84ipM5kr0bHGf9/MRZJWcw51urueNycBXu1Xh+pEN8qBmYsFRR4SIODLClybAO
28
+ 6cbm2PyPQgKNiqE4H+IQrDVHd9bJs1XgLElk3qoaJBWXc/5fy0J1imYb25UqmiHG
29
+ snGe1hrppvBRdcyEzvhfIPjI
30
30
  -----END CERTIFICATE-----
31
31
  date: 1980-01-02 00:00:00.000000000 Z
32
32
  dependencies:
@@ -120,38 +120,60 @@ dependencies:
120
120
  requirements:
121
121
  - - ">="
122
122
  - !ruby/object:Gem::Version
123
- version: '4.0'
123
+ version: '6.0'
124
124
  - - "<"
125
125
  - !ruby/object:Gem::Version
126
- version: '7'
126
+ version: '8'
127
127
  type: :development
128
128
  prerelease: false
129
129
  version_requirements: !ruby/object:Gem::Requirement
130
130
  requirements:
131
131
  - - ">="
132
132
  - !ruby/object:Gem::Version
133
- version: '4.0'
133
+ version: '6.0'
134
134
  - - "<"
135
135
  - !ruby/object:Gem::Version
136
- version: '7'
136
+ version: '8'
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: hoe
139
139
  requirement: !ruby/object:Gem::Requirement
140
140
  requirements:
141
141
  - - "~>"
142
142
  - !ruby/object:Gem::Version
143
- version: '4.3'
143
+ version: '4.6'
144
144
  type: :development
145
145
  prerelease: false
146
146
  version_requirements: !ruby/object:Gem::Requirement
147
147
  requirements:
148
148
  - - "~>"
149
149
  - !ruby/object:Gem::Version
150
- version: '4.3'
150
+ version: '4.6'
151
151
  description: |-
152
152
  Flay analyzes code for structural similarities. Differences in literal
153
153
  values, variable, class, method names, whitespace, programming style,
154
154
  braces vs do/end, etc are all ignored. Making this totally rad.
155
+
156
+ == Features/Problems:
157
+
158
+ * Reports differences at any level of code.
159
+ * Adds a score multiplier to identical nodes.
160
+ * Differences in literal values, variable, class, and method names are ignored.
161
+ * Differences in whitespace, programming style, braces vs do/end, etc are ignored.
162
+ * Works across files.
163
+ * Add the flay-persistent plugin to work across large/many projects.
164
+ * Run --diff to see an N-way diff of the code.
165
+ * Provides conservative (default) and --liberal pruning options.
166
+ * Provides --fuzzy duplication detection.
167
+ * Language independent: Plugin system allows other languages to be flayed.
168
+ * Ships with .rb and .erb.
169
+ * javascript and others will be available separately.
170
+ * Includes FlayTask for Rakefiles.
171
+ * Uses path_expander, so you can use:
172
+ * dir_arg -- expand a directory automatically
173
+ * @file_of_args -- persist arguments in a file
174
+ * -path_to_subtract -- ignore intersecting subsets of files/directories
175
+ * Skips files matched via patterns in .flayignore (subset format of .gitignore).
176
+ * Totally rad.
155
177
  email:
156
178
  - ryand-ruby@zenspider.com
157
179
  executables:
@@ -178,6 +200,7 @@ licenses:
178
200
  metadata:
179
201
  homepage_uri: http://ruby.sadi.st/
180
202
  source_code_uri: https://github.com/seattlerb/flay
203
+ documentation_uri: http://docs.seattlerb.org/flay/
181
204
  rdoc_options:
182
205
  - "--main"
183
206
  - README.rdoc
metadata.gz.sig CHANGED
Binary file