flog 4.7.0 → 4.8.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: bde1a28d5e030ce021a8f20e9d7e877714e2c91e030b7560c3da7337a8a1e916
4
- data.tar.gz: 6b4dffe1d2a47f688deb1665a0a31a4c9ef5b901add108aac37489c97cb8f7ee
3
+ metadata.gz: ad09cd2ae98738c0d08e2e366636604774c3ae81a38c15e1feec23220b392243
4
+ data.tar.gz: b5e85e4f01c0d0297a3c929c93bab48bf393d813a048e34a6808353c1f56cfaf
5
5
  SHA512:
6
- metadata.gz: 56c6a3005252c00d8d61257f35f6eb9bf3d07b232acb316ebf5807dee9144c6bc76f24478ba64a000885677e1ba04d3d0af5ad8677934f90a5f8a965a2227f87
7
- data.tar.gz: 876c48e4a05cf087fb924f5c10977870facdec0f07c3cabd09eccee03360fca82d19a3b5a708e2a9bd51cd57f109d525b29cc50d22399fac17df3062b0d3c272
6
+ metadata.gz: 51a2c880e819dc4e31e62a94b990176f2d83fb755b78c5e0c84dcefa95ee1a87b5f4a2e610ad5af2e0e9986921c01b5e528f0e452c788e3c940c579e1b6a0273
7
+ data.tar.gz: b01ab52f28fcf8ee2c57927586abfc8e7c36bbb982e1e4c0ab2a8a8c1c367c00a48b0bd81c1f1ba96425c39f57bca5923e8a5a0d365af2453fec8cc93e24f8bf
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,14 @@
1
+ === 4.8.0 / 2023-09-28
2
+
3
+ * 2 minor enhancements:
4
+
5
+ * Added ability to pass down option overrides through Flog.run.
6
+ * Removed ancient File.binread alias.
7
+
8
+ * 1 bug fix:
9
+
10
+ * Added missing rdoc.
11
+
1
12
  === 4.7.0 / 2023-07-18
2
13
 
3
14
  * 3 minor enhancements:
data/Rakefile CHANGED
@@ -40,17 +40,19 @@ task :debug do
40
40
  file = ENV["F"]
41
41
  ruby = ENV["R"]
42
42
  details = ENV["D"]
43
+ continue = ENV["C"]
43
44
 
44
45
  flog = FlogCLI.new :parser => RubyParser
45
46
 
46
47
  flog.option[:details] = true if details
48
+ flog.option[:continue] = true if continue
47
49
 
48
50
  if file then
49
51
  if File.directory? file then # quick hack to get directory scanning going
50
52
  argv = [file]
51
53
  argv.unshift "-v" if ENV["V"]
52
54
 
53
- FlogCLI.run argv
55
+ FlogCLI.run argv, flog.option
54
56
  exit 0
55
57
  end
56
58
  flog.flog file
data/lib/flog.rb CHANGED
@@ -2,16 +2,17 @@ require "sexp_processor"
2
2
  require "ruby_parser"
3
3
  require "timeout"
4
4
 
5
- class File
6
- RUBY19 = "<3".respond_to? :encoding unless defined? RUBY19 # :nodoc:
7
-
8
- class << self
9
- alias :binread :read unless RUBY19
10
- end
11
- end
5
+ ##
6
+ # Flog is a SexpProcessor that calculates a ABC (assignments,
7
+ # branches, conditionals) complexity metric with some ruby-aware
8
+ # enhancements and a compounding penalty for increasing depth.
9
+ #
10
+ # In essence, this calculates the most tortured code. The higher the
11
+ # score, the more pain the code is in and the harder it is to
12
+ # thoroughly test.
12
13
 
13
14
  class Flog < MethodBasedSexpProcessor
14
- VERSION = "4.7.0" # :nodoc:
15
+ VERSION = "4.8.0" # :nodoc:
15
16
 
16
17
  ##
17
18
  # Cut off point where the report should stop unless --all given.
data/lib/flog_cli.rb CHANGED
@@ -5,6 +5,10 @@ require "forwardable"
5
5
  require "path_expander"
6
6
  require "flog"
7
7
 
8
+ ##
9
+ # This is the CLI interface for Flog, responsible for processing
10
+ # options, finding files, loading plugins, and reporting results.
11
+
8
12
  class FlogCLI
9
13
  extend Forwardable
10
14
 
@@ -13,13 +17,16 @@ class FlogCLI
13
17
  def_delegators :@flog, :threshold, :total_score, :no_method, :calculate_total_scores
14
18
  def_delegators :@flog, :max_method
15
19
 
16
- def self.run args = ARGV
20
+ ##
21
+ # This kicks off the whole thing.
22
+
23
+ def self.run args = ARGV, extra = {}
17
24
  load_plugins
18
25
 
19
26
  expander = PathExpander.new args, "**/*.{rb,rake}"
20
27
  files = expander.process
21
28
 
22
- options = parse_options args
29
+ options = parse_options args, extra
23
30
 
24
31
  abort "no files or stdin (-) to process, aborting." if
25
32
  files.empty? and args.empty?
@@ -66,12 +73,12 @@ class FlogCLI
66
73
  ##
67
74
  # Parse options in +args+ (defaults to ARGV).
68
75
 
69
- def self.parse_options args = ARGV
76
+ def self.parse_options args = ARGV, extra_options = {}
70
77
  option = {
71
78
  :quiet => false,
72
79
  :continue => false,
73
80
  :parser => RubyParser,
74
- }
81
+ }.merge extra_options
75
82
 
76
83
  OptionParser.new do |opts|
77
84
  opts.separator "Standard options:"
data/lib/flog_task.rb CHANGED
@@ -1,5 +1,9 @@
1
1
  require 'rake/tasklib'
2
2
 
3
+ ##
4
+ # A rake front-end for flog, allowing task creation with options for
5
+ # verbosity, reporting, and a failure threshold.
6
+
3
7
  class FlogTask < Rake::TaskLib
4
8
  ##
5
9
  # The name of the task. Defaults to :flog
data.tar.gz.sig CHANGED
@@ -1 +1 @@
1
- ��k>`DQL�kߓO1�ߜ�=�2�w��ͺ�N�#���0${���CLw6��w���{�$z{pKOE5a ��pX֘)A<��} '<�y���=\d՚.������ɡ@ j+���m���<�TXBW5#��4�RuG��WhEN�T+�ۏ�>�����l���!5WUH�/�/�� �74̃)�&��1{[��L�+(`6AQ?��ZFP7�P~Rv��G�z�g�����1�#&�K�v1�ڔ��
1
+ 9Pe��:�:���2s:cd[&+:��u^j��: �r*��1���(nFp�ϭW�_ ���GJ=>�b"ٙ���QFϙ��-�< g"zXfx�I�UDϦ�h�]��2n0��p<�cO�/�YIP�rhD�u-�I�W��4�"y%�Q,r��S �U;��bW>��K�>��M��/ص)΢�O$zC�m�����i-x8���(�*sS�ƫ!����ʈ8ؾksJ^���tއ�oxb�\al�iz��
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.7.0
4
+ version: 4.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -29,7 +29,7 @@ cert_chain:
29
29
  ROfWo9Uyp8ba/j9eVG14KkYRaLydAY1MNQk2yd3R5CGfeOpD1kttxjoypoUJ2dOG
30
30
  nsNBRuQJ1UfiCG97a6DNm+Fr
31
31
  -----END CERTIFICATE-----
32
- date: 2023-07-18 00:00:00.000000000 Z
32
+ date: 2023-09-28 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: sexp_processor
metadata.gz.sig CHANGED
@@ -1 +1,3 @@
1
- a���M�˒zlm�e��h��ᱣ�{(�8�C���m��lJ%(ߞ%��J�#�دW(�{u`B��ĩ�o7�<q�Nr��D���"q
1
+ &&���I[ ���W��nCf<�������Lf(�/J���ЮY���uI��S�ީIV�Һ����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