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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
defmodule Bench.GetModuledocs do
@moduledoc ~S"""
Compare runtime of line scanner amongst different branches
"""
@modules [
Access,
Agent,
Application,
ArgumentError,
ArithmeticError,
Atom,
BadArityError,
BadBooleanError,
BadMapError,
Base,
Bitwise,
Calendar,
Calendar.ISO,
Calendar.TimeZoneDatabase,
CaseClauseError,
Code,
Code.Fragment,
Code.LoadError,
Collectable,
CompileError,
CondClauseError,
Config,
Config.Provider,
Config.Reader,
Date,
Date.Range,
DateTime,
Duration,
DynamicSupervisor,
Enum,
Enum.EmptyError,
Enum.OutOfBoundsError,
Enumerable,
Exception,
File,
File.CopyError,
File.Error,
File.LinkError,
File.RenameError,
File.Stat,
File.Stream,
Float,
Function,
FunctionClauseError,
GenServer,
IO,
IO.ANSI,
IO.Stream,
Inspect,
Inspect.Algebra,
Inspect.Error,
Inspect.Opts,
Integer,
JSON,
JSON.DecodeError,
JSON.Encoder,
Kernel.ParallelCompiler,
Kernel.TypespecError,
KeyError,
Keyword,
List,
List.Chars,
Macro,
Macro.Env,
Map,
MapSet,
MatchError,
MismatchedDelimiterError,
MissingApplicationsError,
Module,
NaiveDateTime,
Node,
OptionParser,
OptionParser.ParseError,
PartitionSupervisor,
Path,
Port,
Process,
Protocol,
Protocol.UndefinedError,
Range,
Record,
Regex,
Regex.CompileError,
Registry,
RuntimeError,
Stream,
String,
String.Chars,
StringIO,
Supervisor,
SyntaxError,
System,
System.EnvError,
SystemLimitError,
Task,
Task.Supervisor,
Time,
TokenMissingError,
TryClauseError,
Tuple,
URI,
URI.Error,
UndefinedFunctionError,
Version,
Version.InvalidRequirementError,
Version.InvalidVersionError,
Version.Requirement,
WithClauseError,
]
@doc ~S"""
Load all moduledocs of the elixir library
"""
def load_moduledocs do
@modules
|> Stream.flat_map(&load_moduledoc/1)
|> Enum.with_index
end
@eol ~r/\n\r?/
defp load_moduledoc(module) do
Code.ensure_loaded(module)
case Code.fetch_docs(module) do
{_, _, :elixir, "text/markdown", %{"en" => moduledoc}, _, _} -> moduledoc |> String.split(@eol)
_ ->
IO.puts(:stderr, "moduledoc for module '#{module}' not found, ignoring....")
[]
end
end
end
# SPDX-License-Identifier: Apache-2.0
|