flog 4.8.0 → 4.9.1

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: ad09cd2ae98738c0d08e2e366636604774c3ae81a38c15e1feec23220b392243
4
- data.tar.gz: b5e85e4f01c0d0297a3c929c93bab48bf393d813a048e34a6808353c1f56cfaf
3
+ metadata.gz: '07738fae525db950a36908c105a3ea7f4ef2735ad8ec39621332bb12dff927b8'
4
+ data.tar.gz: 0506b7754237f626888a17e8e17f9b54a74683a093ae24440fe6275cdc4fa6c0
5
5
  SHA512:
6
- metadata.gz: 51a2c880e819dc4e31e62a94b990176f2d83fb755b78c5e0c84dcefa95ee1a87b5f4a2e610ad5af2e0e9986921c01b5e528f0e452c788e3c940c579e1b6a0273
7
- data.tar.gz: b01ab52f28fcf8ee2c57927586abfc8e7c36bbb982e1e4c0ab2a8a8c1c367c00a48b0bd81c1f1ba96425c39f57bca5923e8a5a0d365af2453fec8cc93e24f8bf
6
+ metadata.gz: c6f3379c0fa7795f344bcc2d45bbbef81de04a6cc54ea77219651cb7215b4e402e3814265be85208c2ab174b220a150be1d63489ececed98c97683b15da5dfa5
7
+ data.tar.gz: '0493e8b1fcaa2868e2cd9f39cbe75dc51a2d196e78cf4cac8c94faadbff0c7494e18805dc0058a6a2488d6ceda7dad16015253d0b4d6e5f2bc1b8bdc915e57e8'
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,19 @@
1
+ === 4.9.1 / 2025-12-20
2
+
3
+ * 4 bug fixes:
4
+
5
+ * Bumped dependency to prism to get some upstreamed fixes.
6
+ * Dropped ruby_parser dependency (now considered soft dep for --legacy flag).
7
+ * Minor cleanup of some of the upstreamed fixes.
8
+ * Re-add ruby_parser dependency until I can get a patch into prism to loosen it up.
9
+
10
+ === 4.9.0 / 2025-12-11
11
+
12
+ * 2 minor enhancements:
13
+
14
+ * Bumped path_expander to 2.0.0.
15
+ * Switched to prism for ruby parsing. Use --legacy for RubyParser.
16
+
1
17
  === 4.8.0 / 2023-09-28
2
18
 
3
19
  * 2 minor enhancements:
data/Rakefile CHANGED
@@ -3,9 +3,7 @@
3
3
  require 'rubygems'
4
4
  require 'hoe'
5
5
 
6
- Hoe.add_include_dirs("../../ruby_parser/dev/lib",
7
- "../../RubyInline/dev/lib",
8
- "../../sexp_processor/dev/lib",
6
+ Hoe.add_include_dirs("../../sexp_processor/dev/lib",
9
7
  "../../ZenTest/dev/lib",
10
8
  "../../path_expander/dev/lib",
11
9
  "lib")
@@ -24,10 +22,8 @@ Hoe.spec 'flog' do
24
22
  license "MIT"
25
23
 
26
24
  dependency "sexp_processor", "~> 4.8"
27
- dependency "ruby_parser", ["~> 3.1", "> 3.1.0"]
28
- dependency "path_expander", "~> 1.0"
29
-
30
- dependency "minitest", "~> 5.0", :dev
25
+ dependency "prism", "~> 1.7"
26
+ dependency "path_expander", "~> 2.0"
31
27
  end
32
28
 
33
29
  task :debug do
data/bin/flog CHANGED
@@ -1,6 +1,6 @@
1
- #!/usr/local/bin/ruby -w
1
+ #!/usr/bin/env -S ruby -w
2
2
 
3
- require "flog_cli"
3
+ require_relative "../lib/flog_cli"
4
4
 
5
5
  FlogCLI.run
6
6
 
data/lib/flog.rb CHANGED
@@ -1,6 +1,10 @@
1
1
  require "sexp_processor"
2
- require "ruby_parser"
2
+ require "prism"
3
+ require "prism/translation/ruby_parser"
3
4
  require "timeout"
5
+ require "racc" # for Racc::ParseError
6
+
7
+ NotRubyParser = Class.new Prism::Translation::RubyParser
4
8
 
5
9
  ##
6
10
  # Flog is a SexpProcessor that calculates a ABC (assignments,
@@ -12,7 +16,7 @@ require "timeout"
12
16
  # thoroughly test.
13
17
 
14
18
  class Flog < MethodBasedSexpProcessor
15
- VERSION = "4.8.0" # :nodoc:
19
+ VERSION = "4.9.1" # :nodoc:
16
20
 
17
21
  ##
18
22
  # Cut off point where the report should stop unless --all given.
@@ -209,7 +213,7 @@ class Flog < MethodBasedSexpProcessor
209
213
  # methods. Does not handle timeouts or syntax errors. See #flog_ruby.
210
214
 
211
215
  def flog_ruby! ruby, file="-", timeout = 10
212
- @parser = (option[:parser] || RubyParser).new
216
+ @parser = option[:parser].new
213
217
 
214
218
  warn "** flogging #{file}" if option[:verbose]
215
219
 
@@ -230,6 +234,7 @@ class Flog < MethodBasedSexpProcessor
230
234
  @mass = {}
231
235
  @parser = nil
232
236
  @threshold = option[:threshold] || DEFAULT_THRESHOLD
237
+ option[:parser] ||= NotRubyParser
233
238
  self.auto_shift_type = true
234
239
  self.reset
235
240
  end
data/lib/flog_cli.rb CHANGED
@@ -24,7 +24,7 @@ class FlogCLI
24
24
  load_plugins
25
25
 
26
26
  expander = PathExpander.new args, "**/*.{rb,rake}"
27
- files = expander.process
27
+ files = expander.process.to_a
28
28
 
29
29
  options = parse_options args, extra
30
30
 
@@ -77,7 +77,7 @@ class FlogCLI
77
77
  option = {
78
78
  :quiet => false,
79
79
  :continue => false,
80
- :parser => RubyParser,
80
+ :parser => nil,
81
81
  }.merge extra_options
82
82
 
83
83
  OptionParser.new do |opts|
@@ -130,6 +130,11 @@ class FlogCLI
130
130
  option[:score] = true
131
131
  end
132
132
 
133
+ opts.on "--legacy" "Use RubyParser for parsing." do
134
+ require "ruby_parser"
135
+ option[:parser] = RubyParser
136
+ end
137
+
133
138
  opts.on("-tN", "--threshold=N", Integer, "Set the report cutoff threshold (def: 60%).") do |n|
134
139
  option[:threshold] = n / 100.0
135
140
  end
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 => RubyParser
22
+ @flog = Flog.new parser: NotRubyParser
23
23
  end
24
24
 
25
25
  def test_add_to_score
@@ -9,7 +9,7 @@ end
9
9
 
10
10
  class TestFlogCLI < FlogTest
11
11
  def setup
12
- @flog = FlogCLI.new :parser => RubyParser
12
+ @flog = FlogCLI.new parser: NotRubyParser
13
13
  end
14
14
 
15
15
  def test_cls_parse_options
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,18 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flog
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.8.0
4
+ version: 4.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain:
11
10
  - |
12
11
  -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBBzANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
12
+ MIIDPjCCAiagAwIBAgIBCTANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
14
13
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTIzMDEwMTA3NTExN1oXDTI0MDEwMTA3NTExN1owRTETMBEGA1UE
14
+ GRYDY29tMB4XDTI1MDEwNjIzMjcwMVoXDTI2MDEwNjIzMjcwMVowRTETMBEGA1UE
16
15
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
16
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
17
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -22,14 +21,14 @@ cert_chain:
22
21
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
22
  gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
24
23
  HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
25
- AQAkg3y+PBnBAPWdxxITm5sPHqdWQgSyCpRA20o4LTuWr8BWhSXBkfQNa7cY6fOn
26
- xyM34VPzBFbExv6XOGDfOMFBVaYTHuN9peC/5/umL7kLl+nflXzL2QA7K6LYj5Bg
27
- sM574Onr0dZDM6Vn69bzQ7rBIFDfK/OhlPzqKZad4nsdcsVH8ODCiT+ATMIZyz5K
28
- WCnNtqlyiWXI8tdTpahDgcUwfcN/oN7v4K8iU5IbLJX6HQ5DKgmKjfb6XyMth16k
29
- ROfWo9Uyp8ba/j9eVG14KkYRaLydAY1MNQk2yd3R5CGfeOpD1kttxjoypoUJ2dOG
30
- nsNBRuQJ1UfiCG97a6DNm+Fr
24
+ AQAC0WQJcPOWPFwkojhzweilRVjTJ19UiLhiBTw3C1wJO3LVdBkWDmnnhAmKuX4D
25
+ r7vjQvESlABGIPdutI1Yl7mrHQzTkfLfXvNN6MT0nLChPyIYauT6SZZxubwJrUfA
26
+ 7R0c2CJTIboZ0XaGpLsXqHEF1c29H7TV1QvVuqKAN2mCjh4N82QVn+ZKtys28AwT
27
+ 6GfQX2fqLoi4KSc7xIzHKaNzqxeOICmJofk9w5VZ2rRN6yes8jvFYwz9HR41wdj8
28
+ bwfinv7Yp5fA6AysuZLhCykyfDuZVRrUp0Vb68YCKsLjJly/Theak+euNTxvHsB+
29
+ al9oSgPPHICMEX65qvLywitx
31
30
  -----END CERTIFICATE-----
32
- date: 2023-09-28 00:00:00.000000000 Z
31
+ date: 1980-01-02 00:00:00.000000000 Z
33
32
  dependencies:
34
33
  - !ruby/object:Gem::Dependency
35
34
  name: sexp_processor
@@ -46,53 +45,33 @@ dependencies:
46
45
  - !ruby/object:Gem::Version
47
46
  version: '4.8'
48
47
  - !ruby/object:Gem::Dependency
49
- name: ruby_parser
48
+ name: prism
50
49
  requirement: !ruby/object:Gem::Requirement
51
50
  requirements:
52
51
  - - "~>"
53
52
  - !ruby/object:Gem::Version
54
- version: '3.1'
55
- - - ">"
56
- - !ruby/object:Gem::Version
57
- version: 3.1.0
53
+ version: '1.7'
58
54
  type: :runtime
59
55
  prerelease: false
60
56
  version_requirements: !ruby/object:Gem::Requirement
61
57
  requirements:
62
58
  - - "~>"
63
59
  - !ruby/object:Gem::Version
64
- version: '3.1'
65
- - - ">"
66
- - !ruby/object:Gem::Version
67
- version: 3.1.0
60
+ version: '1.7'
68
61
  - !ruby/object:Gem::Dependency
69
62
  name: path_expander
70
63
  requirement: !ruby/object:Gem::Requirement
71
64
  requirements:
72
65
  - - "~>"
73
66
  - !ruby/object:Gem::Version
74
- version: '1.0'
67
+ version: '2.0'
75
68
  type: :runtime
76
69
  prerelease: false
77
70
  version_requirements: !ruby/object:Gem::Requirement
78
71
  requirements:
79
72
  - - "~>"
80
73
  - !ruby/object:Gem::Version
81
- version: '1.0'
82
- - !ruby/object:Gem::Dependency
83
- name: minitest
84
- requirement: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '5.0'
89
- type: :development
90
- prerelease: false
91
- version_requirements: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - "~>"
94
- - !ruby/object:Gem::Version
95
- version: '5.0'
74
+ version: '2.0'
96
75
  - !ruby/object:Gem::Dependency
97
76
  name: rdoc
98
77
  requirement: !ruby/object:Gem::Requirement
@@ -119,14 +98,14 @@ dependencies:
119
98
  requirements:
120
99
  - - "~>"
121
100
  - !ruby/object:Gem::Version
122
- version: '4.0'
101
+ version: '4.3'
123
102
  type: :development
124
103
  prerelease: false
125
104
  version_requirements: !ruby/object:Gem::Requirement
126
105
  requirements:
127
106
  - - "~>"
128
107
  - !ruby/object:Gem::Version
129
- version: '4.0'
108
+ version: '4.3'
130
109
  description: |-
131
110
  Flog reports the most tortured code in an easy to read pain
132
111
  report. The higher the score, the more pain the code is in.
@@ -158,7 +137,6 @@ licenses:
158
137
  metadata:
159
138
  homepage_uri: http://ruby.sadi.st/
160
139
  source_code_uri: https://github.com/seattlerb/flog
161
- post_install_message:
162
140
  rdoc_options:
163
141
  - "--main"
164
142
  - README.rdoc
@@ -175,8 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
153
  - !ruby/object:Gem::Version
176
154
  version: '0'
177
155
  requirements: []
178
- rubygems_version: 3.4.10
179
- signing_key:
156
+ rubygems_version: 3.7.2
180
157
  specification_version: 4
181
158
  summary: Flog reports the most tortured code in an easy to read pain report
182
159
  test_files: []
metadata.gz.sig CHANGED
@@ -1,3 +1 @@
1
- &&���I[���W��nCf<�������Lf(�/J���ЮY���uI��S�ީI�V�Һ����RJ?�
2
- "�l)�,*IS8�`J��+Ҙ���r�Q�O�Fh` 
3
- �0�r��:�a7����1��A�w���`?�P��T��}��h�D*�NU� Iu�f*ק@e)s�04
1
+ Qh�K� ��!Ԯ�6+���~R�26�)M�GK���#٠J��>4p������q;�z�W���)��q�(�w}i��=�wyC�6���\ڱ΀��(��a,��3[����#s�����,��&18���� j[��A�~� a�Ri��~��~�I����AI��[d����X�C���(�3#|�<�ݨ0�u"����0�Nbu�e"�Y���̃�p�v<��/��