File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,13 @@ func main() {
59
59
false ,
60
60
"calculate the number of unique lines of code (ULOC) for the project" ,
61
61
)
62
+ flags .BoolVarP (
63
+ & processor .Dryness ,
64
+ "dryness" ,
65
+ "a" ,
66
+ false ,
67
+ "calculate the dryness/wetness of the project (implies --uloc)" ,
68
+ )
62
69
flags .BoolVar (
63
70
& processor .DisableCheckBinary ,
64
71
"binary" ,
Original file line number Diff line number Diff line change @@ -1077,6 +1077,10 @@ func fileSummarizeShort(input chan *FileJob) string {
1077
1077
1078
1078
if UlocMode {
1079
1079
str .WriteString (fmt .Sprintf (tabularShortUlocGlobalFormatBody , len (ulocGlobalCount )))
1080
+ if Dryness {
1081
+ dryness := float64 (len (ulocGlobalCount )) / float64 (sumLines )
1082
+ str .WriteString (fmt .Sprintf ("DRYness %% %30.2f\n " , dryness ))
1083
+ }
1080
1084
str .WriteString (getTabularShortBreak ())
1081
1085
}
1082
1086
Original file line number Diff line number Diff line change @@ -105,6 +105,9 @@ var DisableCheckBinary = false
105
105
// UlocMode toggles checking for binary files using NUL bytes
106
106
var UlocMode = false
107
107
108
+ // Dryness toggles checking for binary files using NUL bytes
109
+ var Dryness = false
110
+
108
111
// SortBy sets which column output in formatter should be sorted by
109
112
var SortBy = ""
110
113
@@ -467,6 +470,10 @@ func processFlags() {
467
470
Generated = true
468
471
}
469
472
473
+ if Dryness {
474
+ UlocMode = true
475
+ }
476
+
470
477
if Debug {
471
478
printDebug (fmt .Sprintf ("Path Deny List: %v" , PathDenyList ))
472
479
printDebug (fmt .Sprintf ("Sort By: %s" , SortBy ))
@@ -481,6 +488,8 @@ func processFlags() {
481
488
printDebug (fmt .Sprintf ("Minified/Generated Detection: %t/%t" , Minified , Generated ))
482
489
printDebug (fmt .Sprintf ("Ignore Minified/Generated: %t/%t" , IgnoreMinified , IgnoreGenerated ))
483
490
printDebug (fmt .Sprintf ("IncludeSymLinks: %t" , IncludeSymLinks ))
491
+ printDebug (fmt .Sprintf ("Uloc: %t" , UlocMode ))
492
+ printDebug (fmt .Sprintf ("Dryness: %t" , Dryness ))
484
493
}
485
494
}
486
495
You can’t perform that action at this time.
0 commit comments