-
Notifications
You must be signed in to change notification settings - Fork 0
/
types-analyze.jl
executable file
·68 lines (58 loc) · 1.8 KB
/
types-analyze.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env julia
#######################################################################
# TODO
###############################
#
# $
#
# FIXME: reload
#######################################################################
#--------------------------------------------------
# Imports
#--------------------------------------------------
using JuliaSub
using ArgParse
#--------------------------------------------------
# Command line arguments
#--------------------------------------------------
# → Dict (arguments)
function parse_command_line_args()
argsStr = ArgParseSettings(
description = "Collects type annotations from Julia source files"
)
@add_arg_table! argsStr begin
"pkginfos"
help = "directory of folders with collected type annotations for packages"
arg_type = String
required = true
#=
"--reload", "-r"
help = "flag specifying if analysis files should be rewritten"
action = :store_true
=#
end
parse_args(argsStr)
end
# All script parameters
const PARAMS = parse_command_line_args()
#--------------------------------------------------
# Main
#--------------------------------------------------
printResult(resultStats) = begin
for (k,v) in resultStats
!(k in [:statnames, :statsums]) &&
@info "Total $k:" v
end
for i in 1:length(resultStats[:statnames])
@info "Total $(resultStats[:statnames][i]):\n $(resultStats[:statsums][i])"
end
end
@info "Initiating type annotations analysis..."
rslt = analyzePkgTypesAndSave2CSV(PARAMS["pkginfos"])
if rslt !== nothing
(resultStatsTA, resultStatsTD) = rslt
@info "*** TYPE ANNOTATIONS\n"
printResult(resultStatsTA)
@info "\n*** TYPE DECLARATIONS\n"
printResult(resultStatsTD)
end