mirror of
https://github.com/kieraneglin/pinchflat.git
synced 2026-01-23 02:24:24 +00:00
Improve dev tooling (#30)
* added ex_check and got it passing * Set up ex_check to run in test env * Added static code analysis * Updated actions file * Updated dockerfile
This commit is contained in:
parent
01042ebd1b
commit
e3f1b409b9
8 changed files with 73 additions and 19 deletions
41
.check.exs
Normal file
41
.check.exs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
[
|
||||
## don't run tools concurrently
|
||||
# parallel: false,
|
||||
|
||||
## don't print info about skipped tools
|
||||
skipped: false,
|
||||
|
||||
## always run tools in fix mode (put it in ~/.check.exs locally, not in project config)
|
||||
fix: true,
|
||||
|
||||
## don't retry automatically even if last run resulted in failures
|
||||
# retry: false,
|
||||
|
||||
## list of tools (see `mix check` docs for a list of default curated tools)
|
||||
tools: [
|
||||
{:compiler, env: %{"MIX_ENV" => "test"}},
|
||||
{:formatter, env: %{"MIX_ENV" => "test"}},
|
||||
{:sobelow, "mix sobelow --config"},
|
||||
# TODO: delete these and replace them with builtin ex_unit and formatter tools
|
||||
# once Elixir 1.16.2 is released (see: https://github.com/karolsluszniak/ex_check/issues/41#issuecomment-1921390413)
|
||||
{:elixir_tests, "mix test"},
|
||||
{:elixir_formatting, "mix format --check-formatted", fix: "mix format"},
|
||||
{:prettier_formatting, "yarn run prettier . --check", fix: "yarn run prettier . --write"}
|
||||
|
||||
## curated tools may be disabled (e.g. the check for compilation warnings)
|
||||
# {:compiler, false},
|
||||
|
||||
## ...or have command & args adjusted (e.g. enable skip comments for sobelow)
|
||||
# {:sobelow, "mix sobelow --exit --skip"},
|
||||
|
||||
## ...or reordered (e.g. to see output from dialyzer before others)
|
||||
# {:dialyzer, order: -1},
|
||||
|
||||
## ...or reconfigured (e.g. disable parallel execution of ex_unit in umbrella)
|
||||
# {:ex_unit, umbrella: [parallel: false]},
|
||||
|
||||
## custom new tools may be added (Mix tasks or arbitrary commands)
|
||||
# {:my_task, "mix my_task", env: %{"MIX_ENV" => "prod"}},
|
||||
# {:my_tool, ["my_tool", "arg with spaces"]}
|
||||
]
|
||||
]
|
||||
17
.github/workflows/lint_and_test.yml
vendored
17
.github/workflows/lint_and_test.yml
vendored
|
|
@ -21,10 +21,6 @@ jobs:
|
|||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Create and populate ENV file
|
||||
run: |
|
||||
echo MIX_ENV=test >> .env
|
||||
|
||||
- name: Pull prebuilt images
|
||||
run: docker compose pull
|
||||
|
||||
|
|
@ -55,14 +51,5 @@ jobs:
|
|||
docker compose exec -T phx mix ecto.create
|
||||
docker compose exec -T phx mix ecto.migrate
|
||||
|
||||
- name: Check JS formatting
|
||||
run: docker compose exec -T phx yarn run prettier . --check
|
||||
|
||||
- name: Check Elixir formatting
|
||||
run: docker compose exec -T phx mix format --check-formatted
|
||||
|
||||
- name: Check Credo
|
||||
run: docker compose exec -T phx mix credo
|
||||
|
||||
- name: Run Elixir tests
|
||||
run: docker compose exec -T phx mix test
|
||||
- name: Run code checks
|
||||
run: docker compose exec -T phx mix check --no-fix --no-retry
|
||||
|
|
|
|||
15
.sobelow-conf
Normal file
15
.sobelow-conf
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[
|
||||
verbose: false,
|
||||
private: false,
|
||||
skip: false,
|
||||
router: nil,
|
||||
exit: :medium,
|
||||
format: "txt",
|
||||
out: nil,
|
||||
threshold: :low,
|
||||
# All of these are ignorable because this app is intended to be single-user and self-hosted.
|
||||
# There is an expectation that the user won't intentionally run a FS Traversal on themselves
|
||||
ignore: ["CI.System", "Traversal.FileModule", "Config.HTTPS", "Config.CSP"],
|
||||
ignore_files: [],
|
||||
version: false
|
||||
]
|
||||
|
|
@ -18,7 +18,7 @@ RUN mix local.rebar --force
|
|||
|
||||
# Download YT-DLP
|
||||
# NOTE: If you're seeing weird issues, consider using the FFMPEG released by yt-dlp
|
||||
RUN python3 -m pip install -U --pre yt-dlp
|
||||
RUN python3 -m pip install -U --pre yt-dlp --break-system-packages
|
||||
|
||||
# Create app directory and copy the Elixir projects into it.
|
||||
WORKDIR /app
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ services:
|
|||
build:
|
||||
context: .
|
||||
dockerfile: dev.Dockerfile
|
||||
environment:
|
||||
- MIX_ENV=test
|
||||
volumes:
|
||||
- '.:/app'
|
||||
ports:
|
||||
|
|
|
|||
2
ideas.md
2
ideas.md
|
|
@ -2,3 +2,5 @@
|
|||
- Use a UUID for the media database ID (or at least alongside it)
|
||||
- Look into this and its recommended plugins https://hexdocs.pm/ex_check/readme.html
|
||||
- Add output template option for the source's friendly name
|
||||
- TODO: Install Elixir 1.16.2 when available to fix bug with `ex_check` https://github.com/karolsluszniak/ex_check/issues/41#issuecomment-1921390413
|
||||
- delete `{:elixir_tests, "mix test"}` and formatting check
|
||||
|
|
|
|||
10
mix.exs
10
mix.exs
|
|
@ -9,7 +9,11 @@ defmodule Pinchflat.MixProject do
|
|||
elixirc_paths: elixirc_paths(Mix.env()),
|
||||
start_permanent: Mix.env() == :prod,
|
||||
aliases: aliases(),
|
||||
deps: deps()
|
||||
deps: deps(),
|
||||
preferred_cli_env: [
|
||||
check: :test,
|
||||
credo: :test
|
||||
]
|
||||
]
|
||||
end
|
||||
|
||||
|
|
@ -55,7 +59,9 @@ defmodule Pinchflat.MixProject do
|
|||
{:nimble_parsec, "~> 1.4"},
|
||||
{:mox, "~> 1.0", only: :test},
|
||||
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
|
||||
{:faker, "~> 0.17", only: :test}
|
||||
{:ex_check, "~> 0.14.0", only: [:dev, :test], runtime: false},
|
||||
{:faker, "~> 0.17", only: :test},
|
||||
{:sobelow, "~> 0.13", only: [:dev, :test], runtime: false}
|
||||
]
|
||||
end
|
||||
|
||||
|
|
|
|||
3
mix.lock
3
mix.lock
|
|
@ -14,6 +14,7 @@
|
|||
"ecto_sqlite3": {:hex, :ecto_sqlite3, "0.15.1", "40f2fbd9e246455f8c42e7e0a77009ef806caa1b3ce6f717b2a0a80e8432fcfd", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.11", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.11", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:exqlite, "~> 0.19", [hex: :exqlite, repo: "hexpm", optional: false]}], "hexpm", "28b16e177123c688948357176662bf9ff9084daddf950ef5b6baf3ee93707064"},
|
||||
"elixir_make": {:hex, :elixir_make, "0.7.8", "505026f266552ee5aabca0b9f9c229cbb496c689537c9f922f3eb5431157efc7", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.0", [hex: :certifi, repo: "hexpm", optional: true]}], "hexpm", "7a71945b913d37ea89b06966e1342c85cfe549b15e6d6d081e8081c493062c07"},
|
||||
"esbuild": {:hex, :esbuild, "0.8.1", "0cbf919f0eccb136d2eeef0df49c4acf55336de864e63594adcea3814f3edf41", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "25fc876a67c13cb0a776e7b5d7974851556baeda2085296c14ab48555ea7560f"},
|
||||
"ex_check": {:hex, :ex_check, "0.14.0", "d6fbe0bcc51cf38fea276f5bc2af0c9ae0a2bb059f602f8de88709421dae4f0e", [:mix], [], "hexpm", "8a602e98c66e6a4be3a639321f1f545292042f290f91fa942a285888c6868af0"},
|
||||
"expo": {:hex, :expo, "0.5.1", "249e826a897cac48f591deba863b26c16682b43711dd15ee86b92f25eafd96d9", [:mix], [], "hexpm", "68a4233b0658a3d12ee00d27d37d856b1ba48607e7ce20fd376958d0ba6ce92b"},
|
||||
"exqlite": {:hex, :exqlite, "0.19.0", "0f3ee29e35bed38552dd0ed59600aa81c78f867f5b5ff0e17d330148e0465483", [:make, :mix], [{:cc_precompiler, "~> 0.1", [hex: :cc_precompiler, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.7", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "55a8fbb0443f03d4a256e3458bd1203eff5037a6624b76460eaaa9080f462b06"},
|
||||
"faker": {:hex, :faker, "0.17.0", "671019d0652f63aefd8723b72167ecdb284baf7d47ad3a82a15e9b8a6df5d1fa", [:mix], [], "hexpm", "a7d4ad84a93fd25c5f5303510753789fc2433ff241bf3b4144d3f6f291658a6a"},
|
||||
|
|
@ -41,8 +42,8 @@
|
|||
"plug": {:hex, :plug, "1.15.3", "712976f504418f6dff0a3e554c40d705a9bcf89a7ccef92fc6a5ef8f16a30a97", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "cc4365a3c010a56af402e0809208873d113e9c38c401cabd88027ef4f5c01fd2"},
|
||||
"plug_cowboy": {:hex, :plug_cowboy, "2.6.1", "9a3bbfceeb65eff5f39dab529e5cd79137ac36e913c02067dba3963a26efe9b2", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "de36e1a21f451a18b790f37765db198075c25875c64834bcc82d90b309eb6613"},
|
||||
"plug_crypto": {:hex, :plug_crypto, "2.0.0", "77515cc10af06645abbfb5e6ad7a3e9714f805ae118fa1a70205f80d2d70fe73", [:mix], [], "hexpm", "53695bae57cc4e54566d993eb01074e4d894b65a3766f1c43e2c61a1b0f45ea9"},
|
||||
"postgrex": {:hex, :postgrex, "0.17.4", "5777781f80f53b7c431a001c8dad83ee167bcebcf3a793e3906efff680ab62b3", [:mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "6458f7d5b70652bc81c3ea759f91736c16a31be000f306d3c64bcdfe9a18b3cc"},
|
||||
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
|
||||
"sobelow": {:hex, :sobelow, "0.13.0", "218afe9075904793f5c64b8837cc356e493d88fddde126a463839351870b8d1e", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "cd6e9026b85fc35d7529da14f95e85a078d9dd1907a9097b3ba6ac7ebbe34a0d"},
|
||||
"swoosh": {:hex, :swoosh, "1.14.4", "94e9dba91f7695a10f49b0172c4a4cb658ef24abef7e8140394521b7f3bbb2d4", [:mix], [{:cowboy, "~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:ex_aws, "~> 2.1", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:finch, "~> 0.6", [hex: :finch, repo: "hexpm", optional: true]}, {:gen_smtp, "~> 0.13 or ~> 1.0", [hex: :gen_smtp, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mail, "~> 0.2", [hex: :mail, repo: "hexpm", optional: true]}, {:mime, "~> 1.1 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: true]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:req, "~> 0.4 or ~> 1.0", [hex: :req, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "081c5a590e4ba85cc89baddf7b2beecf6c13f7f84a958f1cd969290815f0f026"},
|
||||
"tailwind": {:hex, :tailwind, "0.2.2", "9e27288b568ede1d88517e8c61259bc214a12d7eed271e102db4c93fcca9b2cd", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "ccfb5025179ea307f7f899d1bb3905cd0ac9f687ed77feebc8f67bdca78565c4"},
|
||||
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue