fix paths of symbols in stdlibs
Showing 1 of 2 files from the diff.
src/symbols.jl
changed.
Other files ignored by Codecov
Project.toml
has changed.
@@ -1,4 +1,4 @@
Loading
1 | - | using LibGit2 |
|
1 | + | using LibGit2, InteractiveUtils |
|
2 | 2 | ||
3 | 3 | mutable struct Server |
|
4 | 4 | storedir::String |
@@ -95,16 +95,43 @@
Loading
95 | 95 | exported::Bool |
|
96 | 96 | end |
|
97 | 97 | ||
98 | + | # adapted from https://github.com/timholy/CodeTracking.jl/blob/afc73a957f5034cc7f02e084a91283c47882f92b/src/utils.jl#L87-L122 |
|
98 | 99 | ||
99 | - | function clean_method_path(m::Method) |
|
100 | - | path = String(m.file) |
|
101 | - | if !isabspath(path) |
|
102 | - | path = Base.find_source_file(path) |
|
103 | - | if path === nothing |
|
104 | - | path = "" |
|
100 | + | """ |
|
101 | + | path = maybe_fix_path(path) |
|
102 | + | ||
103 | + | Return a normalized, absolute path for a source file `path`. |
|
104 | + | """ |
|
105 | + | function maybe_fix_path(file) |
|
106 | + | if !isabspath(file) |
|
107 | + | # This may be a Base or Core method |
|
108 | + | newfile = Base.find_source_file(file) |
|
109 | + | if isa(newfile, AbstractString) |
|
110 | + | file = normpath(newfile) |
|
105 | 111 | end |
|
106 | 112 | end |
|
107 | - | return normpath(path) |
|
113 | + | return maybe_fixup_stdlib_path(file) |
|
114 | + | end |
|
115 | + | ||
116 | + | safe_isfile(x) = try isfile(x); catch; false end |
|
117 | + | const BUILDBOT_STDLIB_PATH = dirname(abspath(joinpath(String((@which versioninfo()).file), "..", "..", ".."))) |
|
118 | + | replace_buildbot_stdlibpath(str::String) = replace(str, BUILDBOT_STDLIB_PATH => Sys.STDLIB) |
|
119 | + | """ |
|
120 | + | path = maybe_fixup_stdlib_path(path::String) |
|
121 | + | ||
122 | + | Return `path` corrected for julia issue [#26314](https://github.com/JuliaLang/julia/issues/26314) if applicable. |
|
123 | + | Otherwise, return the input `path` unchanged. |
|
124 | + | ||
125 | + | Due to the issue mentioned above, location info for methods defined one of Julia's standard libraries |
|
126 | + | are, for non source Julia builds, given as absolute paths on the worker that built the `julia` executable. |
|
127 | + | This function corrects such a path to instead refer to the local path on the users drive. |
|
128 | + | """ |
|
129 | + | function maybe_fixup_stdlib_path(path) |
|
130 | + | if !safe_isfile(path) |
|
131 | + | maybe_stdlib_path = replace_buildbot_stdlibpath(path) |
|
132 | + | safe_isfile(maybe_stdlib_path) && return maybe_stdlib_path |
|
133 | + | end |
|
134 | + | return path |
|
108 | 135 | end |
|
109 | 136 | ||
110 | 137 | const _global_method_cache = IdDict{Any,Vector{Any}}() |
@@ -138,7 +165,8 @@
Loading
138 | 165 | ind_of_method_w_kws = Int[] # stores the index of methods with kws. |
|
139 | 166 | i = 1 |
|
140 | 167 | for m in methods0 |
|
141 | - | MS = MethodStore(m[3].name, nameof(m[3].module), clean_method_path(m[3]), m[3].line, [], Symbol[], FakeTypeName(Any)) |
|
168 | + | file = maybe_fix_path(String(m[3].file)) |
|
169 | + | MS = MethodStore(m[3].name, nameof(m[3].module), file, m[3].line, [], Symbol[], FakeTypeName(Any)) |
|
142 | 170 | # Get signature |
|
143 | 171 | sig = Base.unwrap_unionall(m[1]) |
|
144 | 172 | argnames = getargnames(m[3]) |
@@ -551,4 +579,3 @@
Loading
551 | 579 | ||
552 | 580 | get_all_modules() = let allms = Base.IdSet{Module}(); apply_to_everything(x->if x isa Module push!(allms, x) end); allms end |
|
553 | 581 | get_used_modules(M, allms = get_all_modules()) = [m for m in allms if usedby(M, m)] |
|
554 | - |
Files | Coverage |
---|---|
src | 76.76% |
Project Totals (5 files) | 76.76% |
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.