Current section

Files

Jump to
go_over src go_over@sources.erl
Raw

src/go_over@sources.erl

-module(go_over@sources).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/go_over/sources.gleam").
-export([get_vulnerable_warnings/2, get_retired_warnings/2, get_hex_warnings/2]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(false).
-file("src/go_over/sources.gleam", 13).
?DOC(false).
-spec get_vulnerable_warnings(
list(go_over@packages:package()),
go_over@config:config()
) -> list(go_over@warning:warning()).
get_vulnerable_warnings(Pkgs, Conf) ->
_pipe = go_over@advisories@advisories:check_for_advisories(Pkgs),
_pipe@1 = gleam@list:map(
_pipe,
fun(P) ->
gxyz@tuple:map2_1(
P,
fun(_capture) ->
go_over@config:filter_advisory_ids(Conf, _capture)
end
)
end
),
_pipe@2 = gxyz@list:reject_tap(
_pipe@1,
fun gleam@pair:second/1,
fun gleam@list:is_empty/1
),
gleam@list:flat_map(
_pipe@2,
fun(_capture@1) ->
gxyz@tuple:apply_from2(
_capture@1,
fun go_over@warning:adv_to_warning/2
)
end
).
-file("src/go_over/sources.gleam", 23).
?DOC(false).
-spec get_retired_warnings(
list(go_over@packages:package()),
go_over@config:config()
) -> list(go_over@warning:warning()).
get_retired_warnings(Pkgs, Conf) ->
_pipe = Pkgs,
_pipe@2 = gleam@list:map(
_pipe,
fun(Pkg) ->
_pipe@1 = go_over@hex@retired:check_retired(
erlang:element(9, Conf),
Pkg
),
gleam@option:map(
_pipe@1,
fun(_capture) -> gleam@pair:new(Pkg, _capture) end
)
end
),
_pipe@3 = gleam@option:values(_pipe@2),
gleam@list:map(
_pipe@3,
fun(_capture@1) ->
gxyz@tuple:apply_from2(
_capture@1,
fun go_over@warning:retired_to_warning/2
)
end
).
-file("src/go_over/sources.gleam", 36).
?DOC(false).
-spec get_hex_warnings(
list(go_over@packages:package()),
go_over@config:config()
) -> list(go_over@warning:warning()).
get_hex_warnings(Pkgs, Conf) ->
Check_licenses = not gleam@list:is_empty(erlang:element(10, Conf)),
Outdated = erlang:element(3, Conf),
Allowed_licenses = erlang:element(10, Conf),
_pipe = gleam@list:flat_map(
Pkgs,
fun(Pkg) ->
Sources = go_over@hex@hex:get_hex_info(
erlang:element(9, Conf),
Pkg,
Allowed_licenses
),
gleam@list:map(
Sources,
fun(Source) -> case {Source, Outdated, Check_licenses} of
{{outdated, New_version}, true, _} ->
{some,
go_over@warning:outdated_to_warning(
Pkg,
New_version
)};
{{rejected_license, Name}, _, true} ->
{some,
go_over@warning:rejected_license_to_warning(
Pkg,
Name
)};
{_, _, _} ->
none
end end
)
end
),
gleam@option:values(_pipe).