diff --git a/.dialyzer_ignore.exs b/.dialyzer_ignore.exs new file mode 100644 index 0000000..4bfacfa --- /dev/null +++ b/.dialyzer_ignore.exs @@ -0,0 +1,3 @@ +[ + {"lib/absinthe/plug/graphiql/assets.ex", :pattern_match_cov, 80} +] diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml index aab2f5c..12e0a5e 100644 --- a/.github/workflows/elixir.yml +++ b/.github/workflows/elixir.yml @@ -14,22 +14,31 @@ jobs: strategy: fail-fast: false matrix: + elixir: + - "1.13" + - "1.14" + - "1.15" + otp: + - "24" + - "25" + - "26" include: - - pair: - elixir: 1.10.4 - otp: 21.3 - - pair: - elixir: 1.13.3 - otp: 24.2.1 - lint: lint + - elixir: "1.15" + otp: "26" + format: true + exclude: + - elixir: "1.13" + otp: "26" + - elixir: "1.14" + otp: "26" steps: - uses: actions/checkout@v2 - uses: erlef/setup-beam@v1 with: - otp-version: ${{matrix.pair.otp}} - elixir-version: ${{matrix.pair.elixir}} + otp-version: ${{matrix.otp}} + elixir-version: ${{matrix.elixir}} - name: Restore deps cache uses: actions/cache@v2 @@ -47,6 +56,7 @@ jobs: - name: Check code format run: mix format --check-formatted + if: ${{ matrix.format }} - name: Compile dependencies run: mix compile @@ -55,3 +65,16 @@ jobs: - name: Run unit tests run: mix test + + - name: Cache/uncache PLTs + uses: actions/cache@v3 + with: + path: | + priv/plts + key: "${{ runner.os }}-\ + erlang-${{ matrix.otp }}-\ + elixir-${{ matrix.elixir }}-\ + ${{ hashFiles('mix.lock') }}" + + - name: Run Dialyzer + run: mix dialyzer diff --git a/.gitignore b/.gitignore index 42881f9..2ef81b4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ erl_crash.dump *.ez .DS_Store .tool-versions -.elixir_ls \ No newline at end of file +.elixir_ls +priv/plts diff --git a/config/config.exs b/config/config.exs index 66f611d..102c269 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,6 +1,6 @@ # This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. -use Mix.Config +import Config # This configuration is loaded before any dependency and is restricted # to this project. If another project depends on this project, this @@ -18,7 +18,7 @@ use Mix.Config # # Or configure a 3rd-party app: # -config :logger, level: :warn +config :logger, level: :warning # # It is also possible to import configuration files, relative to this diff --git a/lib/absinthe/plug/graphiql/graphiql_playground.html.eex b/lib/absinthe/plug/graphiql/graphiql_playground.html.eex index 35c75d9..52e608e 100644 --- a/lib/absinthe/plug/graphiql/graphiql_playground.html.eex +++ b/lib/absinthe/plug/graphiql/graphiql_playground.html.eex @@ -58,9 +58,7 @@ add "&raw" to the end of the URL within a browser. var options = {}; var protocol = window.location.protocol === "https:" ? "wss:" : "ws:"; - <%= if default_url do %> - options.endpoint = <%= default_url %>; - <% end %> + options.endpoint = <%= default_url %>; <%= if socket_url do %> options.subscriptionEndpoint = <%= socket_url %>; diff --git a/lib/absinthe/plug/request/query.ex b/lib/absinthe/plug/request/query.ex index 2a377de..0f01b99 100644 --- a/lib/absinthe/plug/request/query.ex +++ b/lib/absinthe/plug/request/query.ex @@ -146,7 +146,7 @@ defmodule Absinthe.Plug.Request.Query do # DOCUMENT PROVIDERS # - @spec calculate_document_providers(map) :: [Absinthe.Plug.DocumentProvider.t(), ...] + @spec calculate_document_providers(map) :: [Absinthe.Plug.DocumentProvider.t()] defp calculate_document_providers(%{document_providers: {module, fun}} = config) when is_atom(fun) do apply(module, fun, [config]) diff --git a/mix.exs b/mix.exs index 02082de..708462e 100644 --- a/mix.exs +++ b/mix.exs @@ -14,7 +14,12 @@ defmodule Absinthe.Plug.Mixfile do package: package(), source_url: "https://github.com/absinthe-graphql/absinthe_plug", docs: [source_ref: "v#{@version}", main: "Absinthe.Plug"], - deps: deps() + deps: deps(), + dialyzer: [ + plt_add_apps: [:mix], + plt_add_deps: :apps_direct, + plt_file: {:no_warn, "priv/plts/project.plt"} + ] ] end @@ -42,10 +47,11 @@ defmodule Absinthe.Plug.Mixfile do defp deps do [ - {:absinthe, "~> 1.5"}, + {:absinthe, "~> 1.7"}, {:plug, "~> 1.4"}, {:jason, ">= 0.0.0", only: [:dev, :test]}, - {:ex_doc, "~> 0.20", only: :dev} + {:ex_doc, "~> 0.20", only: :dev}, + {:dialyxir, "~> 1.3", only: [:dev, :test], runtime: false} ] end end diff --git a/mix.lock b/mix.lock index ea71c6d..dcd0e60 100644 --- a/mix.lock +++ b/mix.lock @@ -1,14 +1,16 @@ %{ - "absinthe": {:hex, :absinthe, "1.7.2", "40e40ad9965e469f052264e47370a77365c1ff8810d68dae2bfb2dab462df2dd", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 1.2.2 or ~> 1.3.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:opentelemetry_process_propagator, "~> 0.2.1", [hex: :opentelemetry_process_propagator, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "cb849c6eae613257191f200864301e5f3bc3bdf8d2792c165839e64b7c5a26b9"}, + "absinthe": {:hex, :absinthe, "1.7.3", "128f9de8d8feab761a50483011c2652074de0a670316d0e24a4979daeb460c8f", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 1.2.2 or ~> 1.3.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:opentelemetry_process_propagator, "~> 0.2.1", [hex: :opentelemetry_process_propagator, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "6def91514f023832dbb3433baa166366881648932211f2e8146f9792b08b7bb3"}, + "dialyxir": {:hex, :dialyxir, "1.3.0", "fd1672f0922b7648ff9ce7b1b26fcf0ef56dda964a459892ad15f6b4410b5284", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "00b2a4bcd6aa8db9dcb0b38c1225b7277dca9bc370b6438715667071a304696f"}, "earmark": {:hex, :earmark, "1.4.4", "4821b8d05cda507189d51f2caeef370cf1e18ca5d7dfb7d31e9cafe6688106a4", [:mix], [], "hexpm", "1f93aba7340574847c0f609da787f0d79efcab51b044bb6e242cae5aca9d264d"}, "earmark_parser": {:hex, :earmark_parser, "1.4.10", "6603d7a603b9c18d3d20db69921527f82ef09990885ed7525003c7fe7dc86c56", [:mix], [], "hexpm", "8e2d5370b732385db2c9b22215c3f59c84ac7dda7ed7e544d7c459496ae519c0"}, + "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, "ex_doc": {:hex, :ex_doc, "0.23.0", "a069bc9b0bf8efe323ecde8c0d62afc13d308b1fa3d228b65bca5cf8703a529d", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "f5e2c4702468b2fd11b10d39416ddadd2fcdd173ba2a0285ebd92c39827a5a16"}, "jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"}, "makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"}, "makeup_elixir": {:hex, :makeup_elixir, "0.14.1", "4f0e96847c63c17841d42c08107405a005a2680eb9c7ccadfd757bd31dabccfb", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f2438b1a80eaec9ede832b5c41cd4f373b38fd7aa33e3b22d9db79e640cbde11"}, - "mime": {:hex, :mime, "1.4.0", "5066f14944b470286146047d2f73518cf5cca82f8e4815cf35d196b58cf07c47", [:mix], [], "hexpm", "75fa42c4228ea9a23f70f123c74ba7cece6a03b1fd474fe13f6a7a85c6ea4ff6"}, + "mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"}, "nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"}, - "plug": {:hex, :plug, "1.11.0", "f17217525597628298998bc3baed9f8ea1fa3f1160aa9871aee6df47a6e4d38e", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "2d9c633f0499f9dc5c2fd069161af4e2e7756890b81adcbb2ceaa074e8308876"}, - "plug_crypto": {:hex, :plug_crypto, "1.2.0", "1cb20793aa63a6c619dd18bb33d7a3aa94818e5fd39ad357051a67f26dfa2df6", [:mix], [], "hexpm", "a48b538ae8bf381ffac344520755f3007cc10bd8e90b240af98ea29b69683fc2"}, - "telemetry": {:hex, :telemetry, "0.4.3", "a06428a514bdbc63293cd9a6263aad00ddeb66f608163bdec7c8995784080818", [:rebar3], [], "hexpm", "eb72b8365ffda5bed68a620d1da88525e326cb82a75ee61354fc24b844768041"}, + "plug": {:hex, :plug, "1.14.2", "cff7d4ec45b4ae176a227acd94a7ab536d9b37b942c8e8fa6dfc0fff98ff4d80", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "842fc50187e13cf4ac3b253d47d9474ed6c296a8732752835ce4a86acdf68d13"}, + "plug_crypto": {:hex, :plug_crypto, "1.2.5", "918772575e48e81e455818229bf719d4ab4181fcbf7f85b68a35620f78d89ced", [:mix], [], "hexpm", "26549a1d6345e2172eb1c233866756ae44a9609bd33ee6f99147ab3fd87fd842"}, + "telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"}, }