CI: Credo, as a warning

0efc71d · gmorell · 2026-11-04 20:20

6 files +91 -1
Message
{commit_body(@commit)}

Files changed

added .credo.exs
+27 −0
@@ -0,0 +1,27 @@
1 +# Credo's default checks, with two changes: functions may nest one level
2 +# deeper than the default, and @moduledoc isn't required.
3 +# CI runs `mix credo` as a warning (.forgejo/workflows/credo.yml).
4 +%{
5 + configs: [
6 + %{
7 + name: "default",
8 + files: %{
9 + included: [
10 + "lib/",
11 + "src/",
12 + "test/",
13 + "web/",
14 + "apps/*/lib/",
15 + "apps/*/src/",
16 + "apps/*/test/",
17 + "apps/*/web/"
18 + ],
19 + excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
20 + },
21 + checks: %{
22 + extra: [{Credo.Check.Refactor.Nesting, [max_nesting: 3]}],
23 + disabled: [{Credo.Check.Readability.ModuleDoc, []}]
24 + }
25 + }
26 + ]
27 +}
added .forgejo/workflows/credo.yml
+60 −0
@@ -0,0 +1,60 @@
1 +name: credo
2 +# Credo's static analysis (.credo.exs), as a warning: the job runs under
3 +# `continue-on-error`, so what Credo finds marks the run ⚠ rather than
4 +# failing it.
5 +on:
6 + push:
7 + branches: [master]
8 + pull_request:
9 + workflow_dispatch:
10 +
11 +permissions:
12 + contents: read
13 +
14 +# A newer push supersedes this run: on a branch or PR the run in
15 +# progress is cancelled; on master it finishes, and only a run still
16 +# waiting is replaced.
17 +concurrency:
18 + group: ${{ github.workflow }}-${{ github.ref }}
19 + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
20 +
21 +jobs:
22 + credo:
23 + runs-on: self-hosted
24 + continue-on-error: true
25 + steps:
26 + - uses: actions/checkout@v4
27 +
28 + # `mix credo` compiles every dependency (not the app), so what the
29 + # Dockerfile's builder has for their NIFs.
30 + - name: Build dependencies
31 + run: |
32 + sudo apt-get update -q
33 + sudo apt-get install -y -q --no-install-recommends build-essential git
34 +
35 + # OTP and Elixir from builds.hex.pm, the builds setup-beam would
36 + # fetch — taken directly, since setup-beam chooses one by ImageOS,
37 + # which this runner sets to "selfhosted" over anything a workflow
38 + # says.
39 + - name: OTP and Elixir
40 + env:
41 + OTP_VERSION: "28.5.0.8"
42 + ELIXIR_VERSION: "1.20.4"
43 + run: |
44 + ubuntu=$(. /etc/os-release && echo "$VERSION_ID")
45 + curl -sSfL "https://builds.hex.pm/builds/otp/ubuntu-${ubuntu}/OTP-${OTP_VERSION}.tar.gz" | tar xz -C /tmp
46 + # Installed where it's unpacked: Install's root is its own directory.
47 + (cd "/tmp/OTP-${OTP_VERSION}" && ./Install -minimal "/tmp/OTP-${OTP_VERSION}" > /dev/null)
48 + curl -sSfL -o /tmp/elixir.zip "https://builds.hex.pm/builds/elixir/v${ELIXIR_VERSION}-otp-${OTP_VERSION%%.*}.zip"
49 + unzip -q -d /tmp/elixir /tmp/elixir.zip
50 + echo "/tmp/OTP-${OTP_VERSION}/bin" >> "$GITHUB_PATH"
51 + echo /tmp/elixir/bin >> "$GITHUB_PATH"
52 +
53 + - name: Dependencies
54 + run: |
55 + mix local.hex --force
56 + mix local.rebar --force
57 + mix deps.get
58 +
59 + - name: Credo
60 + run: mix credo
modified mix.exs
+1 −0
@@ -40,6 +40,7 @@ defmodule FeedPug.MixProject do
40 40 # Type `mix help deps` for examples and options.
41 41 defp deps do
42 42 [
43 + {:credo, "~> 1.7", only: [:dev, :test], runtime: false},
43 44 {:bcrypt_elixir, "~> 3.0"},
44 45 {:phoenix, "~> 1.8.5"},
45 46 {:phoenix_ecto, "~> 4.5"},
modified mix.lock
+3 −1
@@ -1,9 +1,11 @@
1 1 %{
2 2 "bandit": {:hex, :bandit, "1.14.1", "5fb450e2360faf03d9b9fb45cfe52e14197f62d376c34781219bec0f9bc7ca06", [:mix], [{:hpax, "~> 1.1", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.18", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:thousand_island, "~> 1.6", [hex: :thousand_island, repo: "hexpm", optional: false]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "87c7ee5e08fb5f22d4e072e681e1101266a21432889b08ef8d0cb0c1450f8bba"},
3 3 "bcrypt_elixir": {:hex, :bcrypt_elixir, "3.3.2", "d50091e3c9492d73e17fc1e1619a9b09d6a5ef99160eb4d736926fd475a16ca3", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "471be5151874ae7931911057d1467d908955f93554f7a6cd1b7d804cac8cef53"},
4 + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
4 5 "castore": {:hex, :castore, "1.0.22", "a01978e6a5d42fa3a34143630588f92036e7d90e2309ecdd466722d1279a2213", [:mix], [], "hexpm", "c2a4d42723b4affbc1c3e15d8f6df3f7d8f1f627c84de643383634cce58493d5"},
5 6 "cc_precompiler": {:hex, :cc_precompiler, "0.1.11", "8c844d0b9fb98a3edea067f94f616b3f6b29b959b6b3bf25fee94ffe34364768", [:mix], [{:elixir_make, "~> 0.7", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "3427232caf0835f94680e5bcf082408a70b48ad68a5f5c0b02a3bea9f3a075b9"},
6 7 "comeonin": {:hex, :comeonin, "5.5.1", "5113e5f3800799787de08a6e0db307133850e635d34e9fab23c70b6501669510", [:mix], [], "hexpm", "65aac8f19938145377cee73973f192c5645873dcf550a8a6b18187d17c13ccdb"},
8 + "credo": {:hex, :credo, "1.7.19", "cc52129665fc7c15143d47838fda0f9cd6dac9ceced7bf4da6f85fcbfe64b12a", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "2d8bc95d5a7bb99dd2613621d4f08c6a3575c3fd4b62e6a2b48a100352a557b8"},
7 9 "db_connection": {:hex, :db_connection, "2.10.2", "ae391e803a5adff104da913c2fc1c0c14a37f8b10001dcef568796e1fb7bf95c", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "510b14482330f1af6490a2fa0efd8d4f1435d1529b165647df22ac0f2df0fa93"},
8 10 "decimal": {:hex, :decimal, "3.2.0", "f1235f05d841a211fda78a08fdb9777f2ff51a71f18455233fae186ff76187c6", [:mix], [], "hexpm", "190bca80580ce61aa69bb0eacadd7677710205c770225c2c2c07e32a5c31b234"},
9 11 "dns_cluster": {:hex, :dns_cluster, "0.2.0", "aa8eb46e3bd0326bd67b84790c561733b25c5ba2fe3c7e36f28e88f384ebcb33", [:mix], [], "hexpm", "ba6f1893411c69c01b9e8e8f772062535a4cf70f3f35bcc964a324078d8c8240"},
@@ -47,7 +49,7 @@
47 49 "ranch": {:hex, :ranch, "2.3.0", "7de7b041a9a6a5091a3aa5898d66c0564be671d87db4f9d63b1b5ee775b097df", [:make, :rebar3], [], "hexpm", "6168ec49409d982f7cfbd83dd083144f6cbe67caa4036551d2f0a3ad67c9d023"},
48 50 "req": {:hex, :req, "0.7.5", "0c3293cbf7717aba20b1b1b3ea13fe8d3fdf6f1557490f390c3f1ef6dd9db955", [:mix], [{:brotli, "~> 0.3.1", [hex: :brotli, repo: "hexpm", optional: true]}, {:finch, "~> 0.21", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 2.0.6 or ~> 2.1", [hex: :mime, repo: "hexpm", optional: false]}, {:nimble_csv, "~> 1.0", [hex: :nimble_csv, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "576853c4bf403faa3c1fa5d093e0759227083b78f8a6864c67d62c0a9c45514d"},
49 51 "rustler_precompiled": {:hex, :rustler_precompiled, "0.9.0", "3a052eda09f3d2436364645cc1f13279cf95db310eb0c17b0d8f25484b233aa0", [:mix], [{:rustler, "~> 0.23", [hex: :rustler, repo: "hexpm", optional: true]}], "hexpm", "471d97315bd3bf7b64623418b3693eedd8e47de3d1cb79a0ac8f9da7d770d94c"},
50 − "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.8", "5a1f8141a804262914345209f6f3d861e6b0b305f5c38257d99c77deec711c83", [], [], "hexpm", "004014f4927a8e463fece26b2b942df6578385b3e2f77c28b8dcf0bd7e9f36c7"},
52 + "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.8", "5a1f8141a804262914345209f6f3d861e6b0b305f5c38257d99c77deec711c83", [:make, :mix, :rebar3], [], "hexpm", "004014f4927a8e463fece26b2b942df6578385b3e2f77c28b8dcf0bd7e9f36c7"},
51 53 "swoosh": {:hex, :swoosh, "1.29.0", "b938791267d8a55415344018aa0421d214f9bc36c93cbe27305d3284a853785c", [:mix], [{:bandit, ">= 1.0.0", [hex: :bandit, repo: "hexpm", optional: true]}, {: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.0 and < 5.0.0", [hex: :hackney, repo: "hexpm", optional: true]}, {:idna, ">= 6.0.0 and < 8.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {: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]}, {:mua, "~> 0.2.3", [hex: :mua, repo: "hexpm", optional: true]}, {:multipart, "~> 0.4", [hex: :multipart, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: true]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:req, "~> 0.5.10 or ~> 0.6 or ~> 1.0", [hex: :req, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d23ea419c6c67604628c0e93a8d5c6d13bcc442137870671e1b05325b2956a13"},
52 54 "tailwind": {:hex, :tailwind, "0.5.1", "35435b13158c90d37da11e1cfc808755fca1d7b6c5ab87b1b19c5de87e2f0a10", [:mix], [], "hexpm", "c4e26302a59fec72abc5610ecb6ad2116d9aa31f31aab2d4b8eb6e95d25a689c"},
53 55 "telemetry": {:hex, :telemetry, "1.4.2", "a0cb522801dffb1c49fe6e30561badffc7b6d0e180db1300df759faa22062855", [:rebar3], [], "hexpm", "928f6495066506077862c0d1646609eed891a4326bee3126ba54b60af61febb1"},

Parents: 9d237f0