flog 4.4.1 → 4.5.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 +4 -4
- checksums.yaml.gz.sig +3 -3
- data.tar.gz.sig +1 -2
- data/History.rdoc +8 -0
- data/lib/flog.rb +7 -3
- data/lib/flog_cli.rb +4 -0
- data/test/test_flog.rb +8 -1
- data/test/test_flog_cli.rb +15 -2
- metadata +2 -2
- metadata.gz.sig +1 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbfedb8bc3e677559e32945d5b16595988bc1f34
|
4
|
+
data.tar.gz: 19b4cfb958495d27cc6af83f2702c233863db0e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c389b30f3fa2612ebdd0635455e9154458781aa82540dcd45376496aae5825a19994bf08aa7d28ab858c042c683c6ded6be87fc436c49ffd1eac8f26eaa6944c
|
7
|
+
data.tar.gz: a987ad2bb5949884237e3b69f2a6d120b5f2478632b0aee996917d07f410ba04190b02d7544d84de93c1058c3da6836669d05568f6c5813ddb12678d6f818398
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
���R��ԅa�R{Nh�+�RL�aQ�M��RmHx�Kl�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
|
+
�X5�KV���g\J��(fo�FzǠUM�r%&+��h)
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
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����F�n��iT_p2��bC-�a��
|
data/History.rdoc
CHANGED
@@ -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:
|
data/lib/flog.rb
CHANGED
@@ -11,12 +11,14 @@ class File
|
|
11
11
|
end
|
12
12
|
|
13
13
|
class Flog < MethodBasedSexpProcessor
|
14
|
-
VERSION = "4.
|
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
|
-
|
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 *
|
301
|
+
option[:all] ? nil : total_score * @threshold
|
298
302
|
end
|
299
303
|
|
300
304
|
##
|
data/lib/flog_cli.rb
CHANGED
@@ -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
|
data/test/test_flog.rb
CHANGED
@@ -527,7 +527,7 @@ class TestFlog < FlogTest
|
|
527
527
|
|
528
528
|
def test_threshold
|
529
529
|
test_flog
|
530
|
-
assert_in_epsilon
|
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
|
|
data/test/test_flog_cli.rb
CHANGED
@@ -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
|
-
|
43
|
-
|
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
|
+
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-
|
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