flog 4.4.1 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25570bc5a9d0e4c1bd0be4066b82450fe306857a
4
- data.tar.gz: 4df978db752868708d195bb57717244542622374
3
+ metadata.gz: bbfedb8bc3e677559e32945d5b16595988bc1f34
4
+ data.tar.gz: 19b4cfb958495d27cc6af83f2702c233863db0e9
5
5
  SHA512:
6
- metadata.gz: c973cad9e58b768fe16978c12ba7f57d5c3f7d58c106396c658603e676ee5286f45439c5d3a713381fae1e641ec1c9388cd3f2216439a430b9d6b98750cd1f53
7
- data.tar.gz: de4f54a09feebedec996d743234d572744cab8805ccd84bb253bae815101efd586c19f1ff01f325b7165d757b69c8580d5e27565a347a46334d94cbfe10e5125
6
+ metadata.gz: c389b30f3fa2612ebdd0635455e9154458781aa82540dcd45376496aae5825a19994bf08aa7d28ab858c042c683c6ded6be87fc436c49ffd1eac8f26eaa6944c
7
+ data.tar.gz: a987ad2bb5949884237e3b69f2a6d120b5f2478632b0aee996917d07f410ba04190b02d7544d84de93c1058c3da6836669d05568f6c5813ddb12678d6f818398
@@ -1,3 +1,3 @@
1
- ��D"45��O�V�;��#�`%��1
2
- a�����Ɠ�r��v&�����?z�����Cr�7��>����G�m���D�jӃb�|� Z�_� �^hX�{*��Z��f�boK$k�ꋒ ������.��ṽ-��%�
3
- !st��������i*���H��Rdr+.��Y]$�����$p�X#Z?�;��Ư:7|�TZL�1vl�6��U̘4���T�d�k��fT��TJJ0�V�Z+C�!�
1
+ ���R��ԅaR{Nh�+�RLaQ�M��RmHxKl�s��B�H���s�A'�a�q��7۞�K�U$rD�u�/��% Ƙ����{����MU��W�0��k��S=�A�P������ls%�jY�V�u4�%��{)Y�+h�
2
+ ��,�Ye}H�uZ�&�z�k(ZxL
3
+ X5KV���g\J��(foFzǠUMr%&+��h)
data.tar.gz.sig CHANGED
@@ -1,2 +1 @@
1
- &�&�c��{���J���m bn���#}9bErBC԰@<�V��T�3hJG&=J��gK
2
- ^g�(އ�K%XN��Y�
1
+ T�����!u�U�[�Ňq���j��~aΧQ��<Ne�b�r�Q�Q�5X�ޝ�t͢e�|3_��5����&4���qVIi�=�h��ĤN�B����>٫6��Ar�<\�#���E�8bc������3vP$�{�c��Tc4&��u��v}�,X��ir����Fn��iT_p2��bC-�a� �
@@ -1,3 +1,11 @@
1
+ === 4.5.0 / 2017-01-19
2
+
3
+ * 3 minor enhancements:
4
+
5
+ * Added -t=N and --threshold N processing to FlogCLI.
6
+ * Added tweakable threshold to Flog (still defaults to 60%).
7
+ * Renamed Flog::THRESHOLD to Flog::DEFAULT_THRESHOLD (but kept an alias around).
8
+
1
9
  === 4.4.1 / 2017-01-13
2
10
 
3
11
  * 1 bug fix:
@@ -11,12 +11,14 @@ class File
11
11
  end
12
12
 
13
13
  class Flog < MethodBasedSexpProcessor
14
- VERSION = "4.4.1" # :nodoc:
14
+ VERSION = "4.5.0" # :nodoc:
15
15
 
16
16
  ##
17
17
  # Cut off point where the report should stop unless --all given.
18
18
 
19
- THRESHOLD = 0.60
19
+ DEFAULT_THRESHOLD = 0.60
20
+
21
+ THRESHOLD = DEFAULT_THRESHOLD # :nodoc:
20
22
 
21
23
  ##
22
24
  # The scoring system hash. Maps node type to score.
@@ -98,6 +100,7 @@ class Flog < MethodBasedSexpProcessor
98
100
  attr_reader :calls, :option, :mass
99
101
  attr_reader :method_scores, :scores
100
102
  attr_reader :total_score, :totals
103
+ attr_writer :threshold
101
104
 
102
105
  # :startdoc:
103
106
 
@@ -233,6 +236,7 @@ class Flog < MethodBasedSexpProcessor
233
236
  @method_locations = {}
234
237
  @mass = {}
235
238
  @parser = nil
239
+ @threshold = option[:threshold] || DEFAULT_THRESHOLD
236
240
  self.auto_shift_type = true
237
241
  self.reset
238
242
  end
@@ -294,7 +298,7 @@ class Flog < MethodBasedSexpProcessor
294
298
  # Final threshold that is used for report
295
299
 
296
300
  def threshold
297
- option[:all] ? nil : total_score * THRESHOLD
301
+ option[:all] ? nil : total_score * @threshold
298
302
  end
299
303
 
300
304
  ##
@@ -120,6 +120,10 @@ class FlogCLI
120
120
  option[:score] = true
121
121
  end
122
122
 
123
+ opts.on("-tN", "--threshold=N", Integer, "Set the report cutoff threshold (def: 60%).") do |n|
124
+ option[:threshold] = n / 100.0
125
+ end
126
+
123
127
  opts.on("-v", "--verbose", "Display progress during processing.") do
124
128
  option[:verbose] = true
125
129
  end
@@ -527,7 +527,7 @@ class TestFlog < FlogTest
527
527
 
528
528
  def test_threshold
529
529
  test_flog
530
- assert_in_epsilon Flog::THRESHOLD * 1.6, @flog.threshold
530
+ assert_in_epsilon 0.6 * 1.6, @flog.threshold
531
531
  end
532
532
 
533
533
  def test_no_threshold
@@ -535,6 +535,13 @@ class TestFlog < FlogTest
535
535
  assert_nil @flog.threshold
536
536
  end
537
537
 
538
+ def test_threshold_custom
539
+ @flog.threshold = 0.33
540
+
541
+ test_flog
542
+ assert_in_epsilon 0.33 * 1.6, @flog.threshold
543
+ end
544
+
538
545
  def test_calculate
539
546
  setup_my_klass
540
547
 
@@ -37,10 +37,23 @@ class TestFlogCLI < FlogTest
37
37
  "--extended" => :extended,
38
38
  "-s" => :score,
39
39
  "--score" => :score,
40
+ "-t" => [:threshold, "75", 0.75],
41
+ "--threshold" => [:threshold, "75", 0.75],
40
42
  "-v" => :verbose,
41
43
  "--verbose" => :verbose,
42
- }.each do |key, val|
43
- assert_equal true, FlogCLI.parse_options(key)[val]
44
+ # TODO: (maybe)
45
+ # "-h", "--help", "Show this message."
46
+ # "-I dir1,dir2,dir3", Array, "Add to LOAD_PATH."
47
+ # "--18", "Use a ruby 1.8 parser."
48
+ # "--19", "Use a ruby 1.9 parser."
49
+ }.each do |args, key|
50
+ exp = true
51
+ if key.is_a? Array then
52
+ key, arg, exp = key
53
+ args = [args, arg]
54
+ end
55
+
56
+ assert_equal exp, FlogCLI.parse_options(args)[key]
44
57
  end
45
58
  end
46
59
 
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.4.1
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -30,7 +30,7 @@ cert_chain:
30
30
  E4oJcnPkJAr0rw504JGtlZtONZQblwmRJOIdXzolaE3NRGUzGVOUSptZppAKiavY
31
31
  fO6tdKQc/5RfA8oQEkg8hrxA5PQSz4TOFJGLpFvIapEk6tMruQ0bHgkhr9auXg==
32
32
  -----END CERTIFICATE-----
33
- date: 2017-01-13 00:00:00.000000000 Z
33
+ date: 2017-01-20 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: sexp_processor
metadata.gz.sig CHANGED
@@ -1,6 +1 @@
1
- |碬m��~;^�u��-�@��^�N�?$#�T'C�6&�f��|
2
- �qr�_�u�����J
3
- � �H�^7i
4
- �<{���&��`�@�'mr���T��
5
- [~J�� oH�f�C�(%�
6
- ��^��$�� �/
1
+ 5�̣˅�j"��k�0�-D�]�<۟E�nq\E�Y�0+κ]�~m�?%�R�:�x���ѝԷH���� [�]h�#�Y��y��P�^��LۗY�W�DxM複ߦ*/z��Set{�(���O5O�O���%����#�7=���&C ���|����2�@��ۣ�i X�,�