ElixirProjectChecklist

ElixirProjectChecklist Is a checklist to follow to create new Elixir projects to add things like, formating, versioning, debuging, documentation, code coverage, package publishing, testing etc. You can follow the checklist in project or clone the project if your creating a barebose project.

Please contribute

Source:

Documentation:

IMPORTANT

Installation

If available in Hex, the package can be installed by adding elixir_project_checklist to your list of dependencies in mix.exs:

def deps do
[
{:elixir_project_checklist, "~> 0.1.0"}
]
end

Quick Start

make # see all commands
make setup # setup project
make build # build project

Core Checklist

See more below

TODO

Optional Checklist

setup README checklist

setup LICENSE checklist

automated build checklist

build configuration checklist

# make sure you use tags for MAJOR.MINOR versions
# e.g. git tag --annotate v1.4 --message v1.4
# this goes in your mix.exs
def app_version do
# get suffix
build_number = System.get_env("BUILD_NUMBER")
suffix = if build_number, do: ".build-#{build_number}", else: build_number # => .build-443
# get git version
{git_desc, 0} = System.cmd("git", ~w[describe --long])
["v" <> major_minor, patch, git_commit_id] = git_desc |> String.trim |> String.split("-") # => ["v1.4", "270", "fa78ab71e"]
"#{major_minor}.#{patch}+ref-#{git_commit_id}#{suffix}" # => 1.4.270+ref-fa78ab71e.build-443
end
defp aliases do
[
help_make: "cmd make"
]
end

code formatter checklist

[
inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"]
]

style check checklist

static analysis checklist

Test makefile build

project documentation checklist

### --
# all configuration required by ex_doc to configure the generation of documents
### --
defp docs do
[
main: "ModuleName_or_Page",
logo: "guides/assets/image.png_or_jpg",
extras: ["README.md": [filename: "readme", title: "README"]],
extra_section: "GUIDES",
groups_for_extras: [
Introduction: Path.wildcard("guides/introduction/*.md")
],
# Ungrouped Modules:
#
# OtherModules
groups_for_modules: [
Controllers: [
Module.Name
]
]
]
end

code coverage checklist

publish the package

defp package() do
[
# This option is only needed when you don't want to use the OTP application name
name: "package_name",
organization: "hexpm",
# These are the default files included in the package
files: ["lib", "priv", "mix.exs", "README*", "readme*", "LICENSE*", "license*"],
licenses: ["GNU 3.0"],
links: %{"GitHub" => "https://github.com/USERNAME/PROJECTNAME", "HexDocs" => "https://hexdocs.pm/PACKAGE/"},
maintainers: ["NAME and EMAIL"]
]
end

deployment package checklist

version_check.exs

try do
# if no args submitted and exception is raised
if hd(System.argv()) =~ ~r{^(\d+\.)(\d+\.)(\d+)$} do
System.stop(0)
else
System.stop(1)
end
rescue
# if exception it's a invalid version
_ -> System.stop(1)
end
# Believe the receive block prevents the race condition so
# that halt will work correctly
receive do
{:hello, msg} -> msg
after
10_000 -> "nothing after 1s"
end

benchmarking setup checklist

sample.exs

# https://github.com/PragTob/benchee
map_fun = fn(i) -> i + 1 end
inputs = %{
"Small (1 Thousand)" => Enum.to_list(1..1_000),
"Middle (100 Thousand)" => Enum.to_list(1..100_000),
"Big (10 Million)" => Enum.to_list(1..10_000_000),
}
Benchee.run %{
"flat_map" => fn(_) -> 1+1 end,
"map.flatten" => fn(list) -> list |> IO.inspect |> Enum.map(map_fun) |> List.flatten end
}, time: 15, warmup: 5, inputs: inputs, formatters: [
Benchee.Formatters.HTML,
Benchee.Formatters.Console
],
formatter_options: [html: [file: "_benchmarks/sample.html"]]

load testing setup checklist

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/elixir_project_checklist.

Core References

Optional Refrences

Contributors