neiam
/oh-my-ex-oh-ircd
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
CI: Credo, as a warning
97f137f · 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 | |
| 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.4.1" | |
| 42 | + ELIXIR_VERSION: "1.19.5" | |
| 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 OhMyExOhIrcd.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
+2
−0
@@ -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 | "delta_crdt": {:hex, :delta_crdt, "0.6.5", "c7bb8c2c7e60f59e46557ab4e0224f67ba22f04c02826e273738f3dcc4767adc", [:mix], [{:merkle_map, "~> 0.2.0", [hex: :merkle_map, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c6ae23a525d30f96494186dd11bf19ed9ae21d9fe2c1f1b217d492a7cc7294ae"}, |
Parents: a9adf33