flog 4.8.0 → 4.9.0

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: 7262d5d6a50a7734f984039e83079bdd31f2b58f1c43325485b8a19288b1fe04
4
+ data.tar.gz: f4049fc93e849c6c3c9f08c0778dd5f0e46dece30a65bbb44ffa2aa4b07d15c7
5
5
  SHA512:
6
- metadata.gz: 51a2c880e819dc4e31e62a94b990176f2d83fb755b78c5e0c84dcefa95ee1a87b5f4a2e610ad5af2e0e9986921c01b5e528f0e452c788e3c940c579e1b6a0273
7
- data.tar.gz: b01ab52f28fcf8ee2c57927586abfc8e7c36bbb982e1e4c0ab2a8a8c1c367c00a48b0bd81c1f1ba96425c39f57bca5923e8a5a0d365af2453fec8cc93e24f8bf
6
+ metadata.gz: b6974339f191d9f1ac348707fd6e5efcf5fbf5bb453aa53d91d91f4933fe18f07f47cca5065a378da049c3703cc399edccc3ff621bc714c04e366d0da9036e62
7
+ data.tar.gz: 998f2be74a01618e3187d94340c97e0149dff71a02e5924dab23f6519fa5c905d601ba7cc7dfcdcb25fc4b39329bfaaf62a78fef672eea06a50f62cba9bd259d
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,10 @@
1
+ === 4.9.0 / 2025-12-11
2
+
3
+ * 2 minor enhancements:
4
+
5
+ * Bumped path_expander to 2.0.0.
6
+ * Switched to prism for ruby parsing. Use --legacy for RubyParser.
7
+
1
8
  === 4.8.0 / 2023-09-28
2
9
 
3
10
  * 2 minor enhancements:
data/Rakefile CHANGED
@@ -24,8 +24,8 @@ Hoe.spec 'flog' do
24
24
  license "MIT"
25
25
 
26
26
  dependency "sexp_processor", "~> 4.8"
27
- dependency "ruby_parser", ["~> 3.1", "> 3.1.0"]
28
- dependency "path_expander", "~> 1.0"
27
+ dependency "prism", "~> 1.5"
28
+ dependency "path_expander", "~> 2.0"
29
29
 
30
30
  dependency "minitest", "~> 5.0", :dev
31
31
  end
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,7 +1,13 @@
1
1
  require "sexp_processor"
2
- require "ruby_parser"
2
+ require "prism"
3
+ require "prism/translation/ruby_parser"
3
4
  require "timeout"
4
5
 
6
+ class Prism::Translation::RubyParser # compatibility layer
7
+ def process(ruby, file, timeout=nil) =
8
+ Timeout.timeout(timeout) { parse ruby, file }
9
+ end
10
+
5
11
  ##
6
12
  # Flog is a SexpProcessor that calculates a ABC (assignments,
7
13
  # branches, conditionals) complexity metric with some ruby-aware
@@ -12,7 +18,7 @@ require "timeout"
12
18
  # thoroughly test.
13
19
 
14
20
  class Flog < MethodBasedSexpProcessor
15
- VERSION = "4.8.0" # :nodoc:
21
+ VERSION = "4.9.0" # :nodoc:
16
22
 
17
23
  ##
18
24
  # Cut off point where the report should stop unless --all given.
@@ -209,7 +215,7 @@ class Flog < MethodBasedSexpProcessor
209
215
  # methods. Does not handle timeouts or syntax errors. See #flog_ruby.
210
216
 
211
217
  def flog_ruby! ruby, file="-", timeout = 10
212
- @parser = (option[:parser] || RubyParser).new
218
+ @parser = option[:parser].new
213
219
 
214
220
  warn "** flogging #{file}" if option[:verbose]
215
221
 
@@ -230,6 +236,7 @@ class Flog < MethodBasedSexpProcessor
230
236
  @mass = {}
231
237
  @parser = nil
232
238
  @threshold = option[:threshold] || DEFAULT_THRESHOLD
239
+ option[:parser] ||= Prism::Translation::RubyParser
233
240
  self.auto_shift_type = true
234
241
  self.reset
235
242
  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.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.0
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
+ GRYDY29tMB4XDTI1MDEwNjIzMjcwMVoXDTI2MDEwNjIzMjcwMVow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w5VZ2rRN6yes8jvFYwz9HR41wdj8
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,39 +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.5'
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.5'
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'
74
+ version: '2.0'
82
75
  - !ruby/object:Gem::Dependency
83
76
  name: minitest
84
77
  requirement: !ruby/object:Gem::Requirement
@@ -119,14 +112,14 @@ dependencies:
119
112
  requirements:
120
113
  - - "~>"
121
114
  - !ruby/object:Gem::Version
122
- version: '4.0'
115
+ version: '4.3'
123
116
  type: :development
124
117
  prerelease: false
125
118
  version_requirements: !ruby/object:Gem::Requirement
126
119
  requirements:
127
120
  - - "~>"
128
121
  - !ruby/object:Gem::Version
129
- version: '4.0'
122
+ version: '4.3'
130
123
  description: |-
131
124
  Flog reports the most tortured code in an easy to read pain
132
125
  report. The higher the score, the more pain the code is in.
@@ -158,7 +151,6 @@ licenses:
158
151
  metadata:
159
152
  homepage_uri: http://ruby.sadi.st/
160
153
  source_code_uri: https://github.com/seattlerb/flog
161
- post_install_message:
162
154
  rdoc_options:
163
155
  - "--main"
164
156
  - README.rdoc
@@ -175,8 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
167
  - !ruby/object:Gem::Version
176
168
  version: '0'
177
169
  requirements: []
178
- rubygems_version: 3.4.10
179
- signing_key:
170
+ rubygems_version: 3.7.2
180
171
  specification_version: 4
181
172
  summary: Flog reports the most tortured code in an easy to read pain report
182
173
  test_files: []
metadata.gz.sig CHANGED
Binary file