flog 4.9.2 → 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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +13 -0
- data/Rakefile +1 -1
- data/lib/flog.rb +12 -5
- data/test/test_flog.rb +29 -2
- data/test/test_flog_cli.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +9 -9
- metadata.gz.sig +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9047c8b22acece9cd9e5c1dbb2e44d486fd903c40bd80967d1e4c257fa8669a9
|
|
4
|
+
data.tar.gz: 69a903441dcc41ab504399e173f8d231a242869ffbc5b6aebfa74e758822c4af
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 88c867edf9e72b5b1f392697f3de483dfd18234a620028eeb6a60527b5dbdc21e994afb103870fa2d79fd4d88a91301a35fc37c0d095b330d1469be72595b879
|
|
7
|
+
data.tar.gz: f57466932cb71074ae085276bb9dbc9f47e684f4da599ce52a33d2a94198d2e9d86b22a41094bf2f65f6a8afa3a3c4be369ded47f970bcaad21fe82d9e334dbd
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/History.rdoc
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
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
|
+
|
|
8
|
+
=== 4.9.3 / 2026-01-05
|
|
9
|
+
|
|
10
|
+
* 1 bug fix:
|
|
11
|
+
|
|
12
|
+
* Fixed bug caused by last release duplicating (frozen) options hash. (nateberkopec)
|
|
13
|
+
|
|
1
14
|
=== 4.9.2 / 2026-01-04
|
|
2
15
|
|
|
3
16
|
* 2 bug fixes:
|
data/Rakefile
CHANGED
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
|
-
|
|
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.
|
|
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
|
|
|
@@ -230,7 +237,7 @@ class Flog < MethodBasedSexpProcessor
|
|
|
230
237
|
|
|
231
238
|
def initialize option = {}
|
|
232
239
|
super()
|
|
233
|
-
@option = option.dup
|
|
240
|
+
@option = option = option.dup
|
|
234
241
|
@mass = {}
|
|
235
242
|
@parser = nil
|
|
236
243
|
@threshold = option[:threshold] || DEFAULT_THRESHOLD
|
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
|
|
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,
|
|
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
|
|
@@ -697,3 +712,15 @@ class TestFlog < FlogTest
|
|
|
697
712
|
@flog.add_to_score "blah", 42
|
|
698
713
|
end
|
|
699
714
|
end
|
|
715
|
+
|
|
716
|
+
class TestFlogDefaultOptions < Minitest::Test
|
|
717
|
+
def test_flog_with_default_options
|
|
718
|
+
# Regression test for issue #84
|
|
719
|
+
# Flog should work with default options (no explicit parser)
|
|
720
|
+
flog = Flog.new
|
|
721
|
+
flog.flog_ruby "2 + 3", "test.rb"
|
|
722
|
+
flog.calculate_total_scores
|
|
723
|
+
|
|
724
|
+
assert_in_epsilon 1.6, flog.total_score
|
|
725
|
+
end
|
|
726
|
+
end
|
data/test/test_flog_cli.rb
CHANGED
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.
|
|
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
|
-
|
|
12
|
+
MIIDPjCCAiagAwIBAgIBCjANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
|
|
13
13
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
|
14
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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:
|
metadata.gz.sig
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
o�Z��q��˧T4}P�E#?hO������r�v��eZ�Ԡ�lÛ�BwK4���G-�~���6`�ӥ4���EB� H:,,�u�Ac���x��M�A���Ǜ�j����v���� �k��2y<V,��$C0��-둴��s��#��;7�*���n�4RX��y;�����j�Gq�>L��z�}��|FG��r��l-���VH?9��;YQ�i��#,�}��0qPpyR��Fv3R ��18o����h0T'�
|