neiam
/lambent_ex
Lambent Aether 5
public · Issues · Pulls 1 · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
CI: Credo, as a warning
6c7da73 · gmorell · 2026-11-04 20:20
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 pkg-config libssl-dev | |
| 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
@@ -39,6 +39,7 @@ defmodule LambentEx.MixProject do
| 39 | 39 | # Type `mix help deps` for examples and options. |
| 40 | 40 | defp deps do |
| 41 | 41 | [ |
| 42 | + {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, | |
| 42 | 43 | {:phoenix, "~> 1.7", override: true}, |
| 43 | 44 | {:phoenix_html, "~> 3.0"}, |
| 44 | 45 | {:phoenix_live_reload, "~> 1.2", only: :dev}, |
modified
mix.lock
+2
−0
@@ -1,9 +1,11 @@
| 1 | 1 | %{ |
| 2 | + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, | |
| 2 | 3 | "castore": {:hex, :castore, "1.0.21", "0a0e8330dc267a40a3b7ad86d39302764bb71758172904e6a59d5ad6443ce307", [:mix], [], "hexpm", "e42e22723e25dbd46876d056a03f685513d6e98f6b5e555dc551321decd76c5c"}, |
| 3 | 4 | "cc_precompiler": {:hex, :cc_precompiler, "0.1.11", "8c844d0b9fb98a3edea067f94f616b3f6b29b959b6b3bf25fee94ffe34364768", [:mix], [{:elixir_make, "~> 0.7", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "3427232caf0835f94680e5bcf082408a70b48ad68a5f5c0b02a3bea9f3a075b9"}, |
| 4 | 5 | "cowboy": {:hex, :cowboy, "2.18.0", "bff388eb4d6356cb3f88c26e65b515976bf04b401b805d31550c3e60eba8fe18", [:make, :rebar3], [{:cowlib, ">= 2.19.0 and < 3.0.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, ">= 1.8.0 and < 3.0.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "62d0b26abcf455054972b0da242389c69d5982ce5914afb8c344517f667b9600"}, |
| 5 | 6 | "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"}, |
| 6 | 7 | "cowlib": {:hex, :cowlib, "2.21.0", "3ea757c79784bdbdebac7857ce3adf2290af6b8680d4248c75e40ced2e98c89e", [:make, :rebar3], [], "hexpm", "0960248773762a5319b3c17285028bc76f54f58ef0f9451367401bdf67b46274"}, |
| 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 | "decimal": {:hex, :decimal, "3.2.0", "f1235f05d841a211fda78a08fdb9777f2ff51a71f18455233fae186ff76187c6", [:mix], [], "hexpm", "190bca80580ce61aa69bb0eacadd7677710205c770225c2c2c07e32a5c31b234"}, |
| 8 | 10 | "ecto": {:hex, :ecto, "3.13.6", "352135b474f91d1ab99a1b502171d207e9db60421c9e3d0ecab4c7ab96b24d14", [:mix], [{:decimal, "~> 2.0 or ~> 3.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "8afa059bc16cd2c94739ec0a11e3e5df69d828125119109bef35f20a21a76af2"}, |
| 9 | 11 | "elixir_make": {:hex, :elixir_make, "0.10.0", "16577e2583a79bb79237bbff349619ef5d80afffc07eac6e4faf0d00e2ddaf7d", [:mix], [], "hexpm", "dc1f09fb7fa68866b886abd5f0f3c83553b1a19a52359a899e92af1bb3b31982"}, |
Parents: 6d07770