flog 4.9.3 → 4.9.4

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: 8031dfa607d41e264121a14a84f9798425b87dffdce2a5bd8cabf15a6836e0f8
4
- data.tar.gz: 95a6b848cbe35d02bae912cf8bd4871998b94bb9faeedc9f92a099c8b565f06a
3
+ metadata.gz: 9047c8b22acece9cd9e5c1dbb2e44d486fd903c40bd80967d1e4c257fa8669a9
4
+ data.tar.gz: 69a903441dcc41ab504399e173f8d231a242869ffbc5b6aebfa74e758822c4af
5
5
  SHA512:
6
- metadata.gz: 0dc58926910d69b830974eeb0e9cac686fdcd8a49ee6f678e23f557daeb124d09568c7fe293d4b37cb5e6282de37f5ab6489b6d4ae0099b323445196511917d8
7
- data.tar.gz: c7b1ea584cad2c550c1020057fe22ebfb6ed449705de797d0313cb87a7b90e479003f59055dd4889102159a42ba1efd0dc532c972688d1a421436e17d8dc3fed
6
+ metadata.gz: 88c867edf9e72b5b1f392697f3de483dfd18234a620028eeb6a60527b5dbdc21e994afb103870fa2d79fd4d88a91301a35fc37c0d095b330d1469be72595b879
7
+ data.tar.gz: f57466932cb71074ae085276bb9dbc9f47e684f4da599ce52a33d2a94198d2e9d86b22a41094bf2f65f6a8afa3a3c4be369ded47f970bcaad21fe82d9e334dbd
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,10 @@
1
+ === 4.9.4 / 2026-01-06
2
+
3
+ * 2 bug fixes:
4
+
5
+ * Namespace NotRubyParser to avoid problems with bundler's horrid eager loading. (nateberkopec)
6
+ * Patch prism to recognize `it` as a local. (faisal)
7
+
1
8
  === 4.9.3 / 2026-01-05
2
9
 
3
10
  * 1 bug fix:
data/Rakefile CHANGED
@@ -38,7 +38,7 @@ task :debug do
38
38
  details = ENV["D"]
39
39
  continue = ENV["C"]
40
40
 
41
- flog = FlogCLI.new :parser => RubyParser
41
+ flog = FlogCLI.new
42
42
 
43
43
  flog.option[:details] = true if details
44
44
  flog.option[:continue] = true if continue
data/lib/flog.rb CHANGED
@@ -4,7 +4,14 @@ require "prism/translation/ruby_parser"
4
4
  require "timeout"
5
5
  require "racc" # for Racc::ParseError
6
6
 
7
- NotRubyParser = Class.new Prism::Translation::RubyParser
7
+ class Prism::Translation::RubyParser
8
+ module TweakIt
9
+ def visit_it_local_variable_read_node(node) # TODO: upstream
10
+ s(node, :lvar, :it)
11
+ end
12
+ end
13
+ Compiler.prepend TweakIt
14
+ end
8
15
 
9
16
  ##
10
17
  # Flog is a SexpProcessor that calculates a ABC (assignments,
@@ -16,15 +23,15 @@ NotRubyParser = Class.new Prism::Translation::RubyParser
16
23
  # thoroughly test.
17
24
 
18
25
  class Flog < MethodBasedSexpProcessor
19
- VERSION = "4.9.3" # :nodoc:
26
+ VERSION = "4.9.4" # :nodoc:
27
+
28
+ NotRubyParser = Class.new Prism::Translation::RubyParser # compatibility layer :nodoc:
20
29
 
21
30
  ##
22
31
  # Cut off point where the report should stop unless --all given.
23
32
 
24
33
  DEFAULT_THRESHOLD = 0.60
25
34
 
26
- THRESHOLD = DEFAULT_THRESHOLD # :nodoc:
27
-
28
35
  ##
29
36
  # The scoring system hash. Maps node type to score.
30
37
 
data/test/test_flog.rb CHANGED
@@ -19,7 +19,7 @@ end
19
19
 
20
20
  class TestFlog < FlogTest
21
21
  def setup
22
- @flog = Flog.new parser: NotRubyParser
22
+ @flog = Flog.new
23
23
  end
24
24
 
25
25
  def test_add_to_score
@@ -344,6 +344,17 @@ class TestFlog < FlogTest
344
344
  assert_process sexp, 2.326, :loop => 1.0, :branch => 1.1, :block_call => 1
345
345
  end
346
346
 
347
+ def test_process_iter__it
348
+ ruby = "blah { puts it }"
349
+ sexp = s(:iter,
350
+ s(:call, nil, :blah), 0,
351
+ s(:call, nil, :puts, s(:lvar, :it)))
352
+
353
+ assert_parse sexp, ruby
354
+
355
+ assert_process sexp, 2.326, blah: 1, block_call: 1, puts: 1.1
356
+ end
357
+
347
358
  def test_process_iter_dsl
348
359
  # task :blah do
349
360
  # something
@@ -465,7 +476,7 @@ class TestFlog < FlogTest
465
476
  end
466
477
 
467
478
  def test_process_lit_complex
468
- sexp = s(:lit, (0+1i))
479
+ sexp = eval 's(:lit, 0+1i)' # stupid emacs is borking on the complex
469
480
  assert_process sexp, 0.25
470
481
  end
471
482
 
@@ -571,6 +582,10 @@ class TestFlog < FlogTest
571
582
  end
572
583
  end
573
584
 
585
+ def assert_parse sexp, ruby
586
+ assert_equal sexp, Flog::NotRubyParser.new.process(ruby)
587
+ end
588
+
574
589
  def assert_process sexp, score = -1, hash = {}
575
590
  setup
576
591
  @flog.process sexp
@@ -9,7 +9,7 @@ end
9
9
 
10
10
  class TestFlogCLI < FlogTest
11
11
  def setup
12
- @flog = FlogCLI.new parser: NotRubyParser
12
+ @flog = FlogCLI.new
13
13
  end
14
14
 
15
15
  def test_cls_parse_options
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flog
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.3
4
+ version: 4.9.4
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
+ GRYDY29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
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:
metadata.gz.sig CHANGED
Binary file