Skip to content

Commit 17d6244

Browse files
authored
Update system requirements. (#280)
* Update system requirements.
1 parent 5e7f99a commit 17d6244

File tree

103 files changed

+2675
-2525
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+2675
-2525
lines changed

.credo.exs

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
# This file contains the configuration for Credo and you are probably reading
2+
# this after creating it with `mix credo.gen.config`.
3+
#
4+
# If you find anything wrong or unclear in this file, please report an
5+
# issue on GitHub: https://github.com/rrrene/credo/issues
6+
#
7+
%{
8+
#
9+
# You can have as many configs as you like in the `configs:` field.
10+
configs: [
11+
%{
12+
#
13+
# Run any config using `mix credo -C <name>`. If no config name is given
14+
# "default" is used.
15+
#
16+
name: "default",
17+
#
18+
# These are the files included in the analysis:
19+
files: %{
20+
#
21+
# You can give explicit globs or simply directories.
22+
# In the latter case `**/*.{ex,exs}` will be used.
23+
#
24+
included: [
25+
"lib/",
26+
"src/",
27+
"test/",
28+
"web/",
29+
"apps/*/lib/",
30+
"apps/*/src/",
31+
"apps/*/test/",
32+
"apps/*/web/"
33+
],
34+
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
35+
},
36+
#
37+
# Load and configure plugins here:
38+
#
39+
plugins: [],
40+
#
41+
# If you create your own checks, you must specify the source files for
42+
# them here, so they can be loaded by Credo before running the analysis.
43+
#
44+
requires: [],
45+
#
46+
# If you want to enforce a style guide and need a more traditional linting
47+
# experience, you can change `strict` to `true` below:
48+
#
49+
strict: false,
50+
#
51+
# To modify the timeout for parsing files, change this value:
52+
#
53+
parse_timeout: 5000,
54+
#
55+
# If you want to use uncolored output by default, you can change `color`
56+
# to `false` below:
57+
#
58+
color: true,
59+
#
60+
# You can customize the parameters of any check by adding a second element
61+
# to the tuple.
62+
#
63+
# To disable a check put `false` as second element:
64+
#
65+
# {Credo.Check.Design.DuplicatedCode, false}
66+
#
67+
checks: %{
68+
enabled: [
69+
#
70+
## Consistency Checks
71+
#
72+
{Credo.Check.Consistency.ExceptionNames, []},
73+
{Credo.Check.Consistency.LineEndings, []},
74+
{Credo.Check.Consistency.ParameterPatternMatching, []},
75+
{Credo.Check.Consistency.SpaceAroundOperators, []},
76+
{Credo.Check.Consistency.SpaceInParentheses, []},
77+
{Credo.Check.Consistency.TabsOrSpaces, []},
78+
79+
#
80+
## Design Checks
81+
#
82+
# You can customize the priority of any check
83+
# Priority values are: `low, normal, high, higher`
84+
#
85+
{Credo.Check.Design.AliasUsage,
86+
[priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
87+
# You can also customize the exit_status of each check.
88+
# If you don't want TODO comments to cause `mix credo` to fail, just
89+
# set this value to 0 (zero).
90+
#
91+
{Credo.Check.Design.TagTODO, [exit_status: 2]},
92+
{Credo.Check.Design.TagFIXME, []},
93+
94+
#
95+
## Readability Checks
96+
#
97+
{Credo.Check.Readability.AliasOrder, []},
98+
{Credo.Check.Readability.FunctionNames, []},
99+
{Credo.Check.Readability.LargeNumbers, []},
100+
{Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
101+
{Credo.Check.Readability.ModuleAttributeNames, []},
102+
{Credo.Check.Readability.ModuleDoc, []},
103+
{Credo.Check.Readability.ModuleNames, []},
104+
{Credo.Check.Readability.ParenthesesInCondition, []},
105+
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
106+
{Credo.Check.Readability.PipeIntoAnonymousFunctions, []},
107+
{Credo.Check.Readability.PredicateFunctionNames, []},
108+
{Credo.Check.Readability.PreferImplicitTry, []},
109+
{Credo.Check.Readability.RedundantBlankLines, []},
110+
{Credo.Check.Readability.Semicolons, []},
111+
{Credo.Check.Readability.SpaceAfterCommas, []},
112+
{Credo.Check.Readability.StringSigils, []},
113+
{Credo.Check.Readability.TrailingBlankLine, []},
114+
{Credo.Check.Readability.TrailingWhiteSpace, []},
115+
{Credo.Check.Readability.UnnecessaryAliasExpansion, []},
116+
{Credo.Check.Readability.VariableNames, []},
117+
{Credo.Check.Readability.WithSingleClause, []},
118+
119+
#
120+
## Refactoring Opportunities
121+
#
122+
{Credo.Check.Refactor.Apply, []},
123+
{Credo.Check.Refactor.CondStatements, []},
124+
{Credo.Check.Refactor.CyclomaticComplexity, []},
125+
{Credo.Check.Refactor.FunctionArity, []},
126+
{Credo.Check.Refactor.LongQuoteBlocks, []},
127+
{Credo.Check.Refactor.MatchInCondition, []},
128+
{Credo.Check.Refactor.MapJoin, []},
129+
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
130+
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
131+
{Credo.Check.Refactor.Nesting, []},
132+
{Credo.Check.Refactor.UnlessWithElse, []},
133+
{Credo.Check.Refactor.WithClauses, []},
134+
{Credo.Check.Refactor.FilterFilter, []},
135+
{Credo.Check.Refactor.RejectReject, []},
136+
{Credo.Check.Refactor.RedundantWithClauseResult, []},
137+
138+
#
139+
## Warnings
140+
#
141+
{Credo.Check.Warning.ApplicationConfigInModuleAttribute, []},
142+
{Credo.Check.Warning.BoolOperationOnSameValues, []},
143+
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
144+
{Credo.Check.Warning.IExPry, []},
145+
{Credo.Check.Warning.IoInspect, []},
146+
{Credo.Check.Warning.OperationOnSameValues, []},
147+
{Credo.Check.Warning.OperationWithConstantResult, []},
148+
{Credo.Check.Warning.RaiseInsideRescue, []},
149+
{Credo.Check.Warning.SpecWithStruct, []},
150+
{Credo.Check.Warning.WrongTestFileExtension, []},
151+
{Credo.Check.Warning.UnusedEnumOperation, []},
152+
{Credo.Check.Warning.UnusedFileOperation, []},
153+
{Credo.Check.Warning.UnusedKeywordOperation, []},
154+
{Credo.Check.Warning.UnusedListOperation, []},
155+
{Credo.Check.Warning.UnusedPathOperation, []},
156+
{Credo.Check.Warning.UnusedRegexOperation, []},
157+
{Credo.Check.Warning.UnusedStringOperation, []},
158+
{Credo.Check.Warning.UnusedTupleOperation, []},
159+
{Credo.Check.Warning.UnsafeExec, []}
160+
],
161+
disabled: [
162+
#
163+
# Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`)
164+
165+
#
166+
# Controversial and experimental checks (opt-in, just move the check to `:enabled`
167+
# and be sure to use `mix credo --strict` to see low priority checks)
168+
#
169+
{Credo.Check.Consistency.MultiAliasImportRequireUse, []},
170+
{Credo.Check.Consistency.UnusedVariableNames, []},
171+
{Credo.Check.Design.DuplicatedCode, []},
172+
{Credo.Check.Design.SkipTestWithoutComment, []},
173+
{Credo.Check.Readability.AliasAs, []},
174+
{Credo.Check.Readability.BlockPipe, []},
175+
{Credo.Check.Readability.ImplTrue, []},
176+
{Credo.Check.Readability.MultiAlias, []},
177+
{Credo.Check.Readability.NestedFunctionCalls, []},
178+
{Credo.Check.Readability.SeparateAliasRequire, []},
179+
{Credo.Check.Readability.SingleFunctionToBlockPipe, []},
180+
{Credo.Check.Readability.SinglePipe, []},
181+
{Credo.Check.Readability.Specs, []},
182+
{Credo.Check.Readability.StrictModuleLayout, []},
183+
{Credo.Check.Readability.WithCustomTaggedTuple, []},
184+
{Credo.Check.Refactor.ABCSize, []},
185+
{Credo.Check.Refactor.AppendSingleItem, []},
186+
{Credo.Check.Refactor.DoubleBooleanNegation, []},
187+
{Credo.Check.Refactor.FilterReject, []},
188+
{Credo.Check.Refactor.IoPuts, []},
189+
{Credo.Check.Refactor.MapMap, []},
190+
{Credo.Check.Refactor.ModuleDependencies, []},
191+
{Credo.Check.Refactor.NegatedIsNil, []},
192+
{Credo.Check.Refactor.PipeChainStart, []},
193+
{Credo.Check.Refactor.RejectFilter, []},
194+
{Credo.Check.Refactor.VariableRebinding, []},
195+
{Credo.Check.Warning.LazyLogging, []},
196+
{Credo.Check.Warning.LeakyEnvironment, []},
197+
{Credo.Check.Warning.MapGetUnsafePass, []},
198+
{Credo.Check.Warning.MixEnv, []},
199+
{Credo.Check.Warning.UnsafeToAtom, []}
200+
201+
# {Credo.Check.Refactor.MapInto, []},
202+
203+
#
204+
# Custom checks can be created using `mix credo.gen.check`.
205+
#
206+
]
207+
}
208+
}
209+
]
210+
}

.devcontainer/Dockerfile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# syntax=docker/dockerfile:1
2+
3+
# Update the VARIANT arg in docker-compose.yml to pick an Elixir version: 1.9, 1.10, 1.10.4
4+
ARG VARIANT="1.19.1"
5+
FROM elixir:${VARIANT}
6+
7+
# This Dockerfile adds a non-root user with sudo access. Update the “remoteUser” property in
8+
# devcontainer.json to use it. More info: https://aka.ms/vscode-remote/containers/non-root-user.
9+
ARG USERNAME=vscode
10+
ARG USER_UID=1000
11+
ARG USER_GID=$USER_UID
12+
13+
# Options for common package install script
14+
ARG INSTALL_ZSH="true"
15+
ARG UPGRADE_PACKAGES="true"
16+
ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/common-debian.sh"
17+
ARG COMMON_SCRIPT_SHA="dev-mode"
18+
19+
# Optional Settings for Phoenix
20+
ARG PHOENIX_VERSION="1.7.19"
21+
22+
# [Optional] Setup nodejs
23+
# ARG NODE_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/node-debian.sh"
24+
# ARG NODE_SCRIPT_SHA="dev-mode"
25+
# [Optional, Choice] Node.js version: none, lts/*, 16, 14, 12, 10
26+
# ARG NODE_VERSION="none"
27+
# ENV NVM_DIR=/usr/local/share/nvm
28+
# ENV NVM_SYMLINK_CURRENT=true
29+
# ENV PATH=${NVM_DIR}/current/bin:${PATH}
30+
31+
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
32+
RUN apt-get update \
33+
&& export DEBIAN_FRONTEND=noninteractive \
34+
&& apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \
35+
&& curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \
36+
&& ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/common-setup.sh" | sha256sum -c -)) \
37+
&& /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
38+
#
39+
# [Optional] Install Node.js for use with web applications
40+
# && if [ "$NODE_VERSION" != "none" ]; then \
41+
# curl -sSL ${NODE_SCRIPT_SOURCE} -o /tmp/node-setup.sh \
42+
# && ([ "${NODE_SCRIPT_SHA}" = "dev-mode" ] || (echo "${NODE_SCRIPT_SHA} */tmp/node-setup.sh" | sha256sum -c -)) \
43+
# && /bin/bash /tmp/node-setup.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}"; \
44+
# fi \
45+
#
46+
# Install dependencies
47+
&& apt-get install -y build-essential inotify-tools \
48+
#
49+
# Clean up
50+
&& apt-get autoremove -y \
51+
&& apt-get clean -y \
52+
&& rm -rf /var/lib/apt/lists/* /tmp/common-setup.sh /tmp/node-setup.sh
53+
54+
RUN su ${USERNAME} -c "mix local.hex --force \
55+
&& mix local.rebar --force \
56+
&& mix archive.install --force hex phx_new ${PHOENIX_VERSION}"
57+
58+
# [Optional] Uncomment this section to install additional OS packages.
59+
# RUN apt-get update \
60+
# && export DEBIAN_FRONTEND=noninteractive \
61+
# && apt-get -y install --no-install-recommends <your-package-list-here>
62+
63+
# [Optional] Uncomment this line to install additional package.
64+
# RUN mix ...

.devcontainer/compose.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
services:
2+
elixir:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile
6+
args:
7+
# Elixir Version: 1.9, 1.10, 1.10.4, ...
8+
VARIANT: "1.19.1"
9+
# Phoenix Version: 1.4.17, 1.5.4, ...
10+
PHOENIX_VERSION: "1.7.21"
11+
# Node Version: 12, 14, ...
12+
# NODE_VERSION: "16"
13+
14+
volumes:
15+
- ..:/workspace:cached
16+
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
17+
network_mode: service:db
18+
19+
# Overrides default command so things don't shut down after the process ends.
20+
command: sleep infinity
21+
22+
db:
23+
image: postgres:16.4-bullseye
24+
restart: unless-stopped
25+
volumes:
26+
- postgres-data:/var/lib/postgresql/data
27+
environment:
28+
POSTGRES_USER: postgres
29+
POSTGRES_PASSWORD: postgres
30+
POSTGRES_DB: app
31+
32+
volumes:
33+
postgres-data:

.devcontainer/devcontainer.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/elixir-phoenix-postgres
3+
{
4+
"name": "Elixir, Phoenix, & PostgresSQL (Community)",
5+
"dockerComposeFile": "compose.yml",
6+
"service": "elixir",
7+
"workspaceFolder": "/workspace",
8+
// Configure tool-specific properties.
9+
"customizations": {
10+
// Configure properties specific to VS Code.
11+
"vscode": {
12+
// Add the IDs of extensions you want installed when the container is created.
13+
"extensions": [
14+
"jakebecker.elixir-ls",
15+
"phoenixframework.phoenix"
16+
],
17+
"settings": {
18+
// Based on Elixir formatter's style
19+
"editor.insertSpaces": true,
20+
// Provides smart completion for "do" and "fn ->" blocks. Does not run the Elixir formatter.
21+
"editor.formatOnType": true,
22+
// Note: While it is possible to override this in your VSCode configuration, the Elixir Formatter
23+
// does not support a configurable tab size, so if you override this then you should not use the
24+
// formatter.
25+
"editor.tabSize": 2,
26+
// ElixirLS extension for Elixir support, with the following (optional) VS Code settings:
27+
"elixirLS.dialyzerEnabled": true,
28+
"elixirLS.enableTestLenses": true,
29+
"elixirLS.fetchDeps": false,
30+
"elixirLS.signatureAfterComplete": false,
31+
"elixirLS.suggestSpecs": false,
32+
"emmet.includeLanguages": {
33+
"phoenix-heex": "html"
34+
},
35+
"files.autoSave": "afterDelay",
36+
"files.autoSaveDelay": 1000,
37+
"files.insertFinalNewline": true,
38+
"files.trimFinalNewlines": false,
39+
"files.trimTrailingWhitespace": true,
40+
// Misc
41+
"editor.wordBasedSuggestions": false,
42+
"editor.trimAutoWhitespace": false
43+
}
44+
}
45+
},
46+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
47+
// This can be used to network with other containers or with the host.
48+
"forwardPorts": [
49+
4000,
50+
4001,
51+
5432
52+
],
53+
// Use 'postCreateCommand' to run commands after the container is created.
54+
// "postCreateCommand": "mix do deps.get, deps.compile, ecto.setup",
55+
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
56+
"remoteUser": "vscode"
57+
}

0 commit comments

Comments
 (0)