Просмотр исходного кода

Merge pull request #7059 from savonarola/elixir-stylecheck

chore(codestyle): add formatting check for Elixir code
Ilya Averyanov 4 лет назад
Родитель
Сommit
2aeb1bc0e8

+ 12 - 0
.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

+ 1 - 1
apps/emqx_authn/include/emqx_authn.hrl

@@ -36,4 +36,4 @@
 
 -endif.
 
--define(RESOURCE_GROUP, <<"emqx_authn">>).
+-define(RESOURCE_GROUP, <<"emqx_authn">>).

+ 1 - 1
apps/emqx_authz/include/emqx_authz.hrl

@@ -72,4 +72,4 @@
                                  , count => 1
                                  }).
 
--define(RESOURCE_GROUP, <<"emqx_authz">>).
+-define(RESOURCE_GROUP, <<"emqx_authz">>).

+ 2 - 2
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