From 634d861b902c5432511c32804f0ae869903ec102 Mon Sep 17 00:00:00 2001 From: Ilya Averyanov Date: Fri, 18 Feb 2022 13:42:51 +0300 Subject: [PATCH] chore(codestyle): add formatting check for Elixir code --- .github/workflows/code_style_check.yaml | 12 ++++++++++++ apps/emqx_authn/include/emqx_authn.hrl | 2 +- apps/emqx_authz/include/emqx_authz.hrl | 2 +- mix.exs | 4 ++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/code_style_check.yaml b/.github/workflows/code_style_check.yaml index fae85baa2..c469a1996 100644 --- a/.github/workflows/code_style_check.yaml +++ b/.github/workflows/code_style_check.yaml @@ -4,7 +4,16 @@ on: [pull_request] jobs: build: + strategy: + matrix: + otp: + - 24.1.5-4 + elixir: + - 1.13.2 + os: + - ubuntu20.04 runs-on: ubuntu-20.04 + container: "ghcr.io/emqx/emqx-builder/5.0-5:${{ matrix.elixir}}-${{ matrix.otp }}-${{ matrix.os }}" steps: - uses: actions/checkout@v2 with: @@ -15,3 +24,6 @@ jobs: - name: Check line-break at EOF run: | ./scripts/check-nl-at-eof.sh + - name: Check Elixir code formatting + run: | + mix format --check-formatted diff --git a/apps/emqx_authn/include/emqx_authn.hrl b/apps/emqx_authn/include/emqx_authn.hrl index a1be787c3..ce313fd35 100644 --- a/apps/emqx_authn/include/emqx_authn.hrl +++ b/apps/emqx_authn/include/emqx_authn.hrl @@ -36,4 +36,4 @@ -endif. --define(RESOURCE_GROUP, <<"emqx_authn">>). \ No newline at end of file +-define(RESOURCE_GROUP, <<"emqx_authn">>). diff --git a/apps/emqx_authz/include/emqx_authz.hrl b/apps/emqx_authz/include/emqx_authz.hrl index e71b67284..89fb97f82 100644 --- a/apps/emqx_authz/include/emqx_authz.hrl +++ b/apps/emqx_authz/include/emqx_authz.hrl @@ -72,4 +72,4 @@ , count => 1 }). --define(RESOURCE_GROUP, <<"emqx_authz">>). \ No newline at end of file +-define(RESOURCE_GROUP, <<"emqx_authz">>). diff --git a/mix.exs b/mix.exs index 5b392d0fc..5a9f7fe2c 100644 --- a/mix.exs +++ b/mix.exs @@ -553,7 +553,7 @@ defmodule EMQXUmbrella.MixProject do emqx_machine_boot_apps: emqx_machine_boot_app_list(edition_type), built_on_arch: built_on(), is_elixir: "yes", - is_enterprise: (if edition_type == :enterprise, do: "yes", else: "no") + is_enterprise: if(edition_type == :enterprise, do: "yes", else: "no") ] end @@ -581,7 +581,7 @@ defmodule EMQXUmbrella.MixProject do emqx_schema_mod: emqx_schema_mod(edition_type), emqx_machine_boot_apps: emqx_machine_boot_app_list(edition_type), is_elixir: "yes", - is_enterprise: (if edition_type == :enterprise, do: "yes", else: "no") + is_enterprise: if(edition_type == :enterprise, do: "yes", else: "no") ] end