From 28bd5172b6469f0d921cc04a988159e39def27c6 Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Mon, 3 Jan 2022 20:02:56 +0800 Subject: [PATCH] Fix typos --- CONTRIBUTING.md | 2 +- lib/knigge/options.ex | 18 ++++-------------- lib/knigge/warnings.ex | 4 +--- .../with_defdefault_for_open_module_test.exs | 4 +--- test/knigge/options_test.exs | 2 +- test/knigge/verification_test.exs | 2 +- 6 files changed, 9 insertions(+), 23 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 28cb46a..863c2ec 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ Make sure to follow the following guidelines when doing so. * Write [good commit messages](https://chris.beams.io/posts/git-commit/). * Use the same coding conventions as the rest of the project. * Commit and push until you are happy with your contribution. -* Make sure to add tests for it. So we can avoid that it breaks accidentially in the future. +* Make sure to add tests for it. So we can avoid that it breaks accidentally in the future. * Add an entry to the [Changelog](./CHANGELOG.md) accordingly. See [changelog entry format](#changelog-entry-format). * Open a [pull request](https://help.github.com/articles/about-pull-requests) that relates to *only* one subject with a clear title and description in grammatically correct, complete sentences. diff --git a/lib/knigge/options.ex b/lib/knigge/options.ex index a8e5bee..7d0544d 100644 --- a/lib/knigge/options.ex +++ b/lib/knigge/options.ex @@ -46,7 +46,7 @@ defmodule Knigge.Options do __Default__: `nil`; `Knigge` will raise an error when no implementation is configured. ### `delegate_at_runtime?` - A switch to move delegation to runtime, by defauly `Knigge` does as much work as possible at compile time. + A switch to move delegation to runtime, by default `Knigge` does as much work as possible at compile time. Accepts: - a boolean (`true` always delegate at runtime | `false` always at compile time) @@ -54,9 +54,7 @@ defmodule Knigge.Options do - `[only: ]` - equivalent to the option above - `[except: ]` - only delegates at runtime if the current environment is __not__ contained in the list - __Default__: `Application.get_env(:knigge, :delegate_at_runtime?, #{ - inspect(@defaults[:delegate_at_runtime?]) - })` + __Default__: `Application.get_env(:knigge, :delegate_at_runtime?, #{inspect(@defaults[:delegate_at_runtime?])})` ### `do_not_delegate` A keyword list defining callbacks for which no delegation should happen. @@ -156,9 +154,7 @@ defmodule Knigge.Options do message when is_binary(message) -> IO.warn( - "Knigge encountered the deprecated option `#{key}`, this option is no longer supported; #{ - message - }." + "Knigge encountered the deprecated option `#{key}`, this option is no longer supported; #{message}." ) nil @@ -178,13 +174,7 @@ defmodule Knigge.Options do @doc """ Applies the defaults to the given options: - #{ - @defaults - |> Enum.map(fn {key, value} -> - " - #{key} = #{inspect(value)}" - end) - |> Enum.join("\n") - } + #{@defaults |> Enum.map(fn {key, value} -> " - #{key} = #{inspect(value)}" end) |> Enum.join("\n")} """ @spec with_defaults(raw()) :: raw() def with_defaults(opts) do diff --git a/lib/knigge/warnings.ex b/lib/knigge/warnings.ex index 9adf941..bac8848 100644 --- a/lib/knigge/warnings.ex +++ b/lib/knigge/warnings.ex @@ -27,9 +27,7 @@ defmodule Knigge.Warnings do There are two ways to resolve this warning: 1. move the behaviour into a separate module and `use Knigge, behaviour: MyBehaviour`; - this enables to compiler to finish compilation of `#{inspect(implementation)}` before compiling `#{ - inspect(module) - }` + this enables to compiler to finish compilation of `#{inspect(implementation)}` before compiling `#{inspect(module)}` 2. pass `delegate_at_runtime?: true` as option, this will move **all** delegation to runtime """) end diff --git a/test/behaviour/with_defdefault_for_open_module_test.exs b/test/behaviour/with_defdefault_for_open_module_test.exs index eeabaff..d532754 100644 --- a/test/behaviour/with_defdefault_for_open_module_test.exs +++ b/test/behaviour/with_defdefault_for_open_module_test.exs @@ -54,9 +54,7 @@ defmodule Behaviour.WithDefdefaultForOpenModuleTest do There are two ways to resolve this warning: 1. move the behaviour into a separate module and `use Knigge, behaviour: MyBehaviour`; - this enables to compiler to finish compilation of `#{inspect(implementation)}` before compiling `#{ - inspect(facade) - }` + this enables to compiler to finish compilation of `#{inspect(implementation)}` before compiling `#{inspect(facade)}` 2. pass `delegate_at_runtime?: true` as option, this will move **all** delegation to runtime """ ) diff --git a/test/knigge/options_test.exs b/test/knigge/options_test.exs index 24cc18f..89919be 100644 --- a/test/knigge/options_test.exs +++ b/test/knigge/options_test.exs @@ -32,7 +32,7 @@ defmodule Knigge.OptionsTest do "Knigge encountered the deprecated option `delegate_at`, please use `delegate_at_runtime?`." end - test "rasies an exception for an invalid `default` value" do + test "raises an exception for an invalid `default` value" do message = "Knigge received invalid value for `default`. Expected module but received: \"invalid\"" diff --git a/test/knigge/verification_test.exs b/test/knigge/verification_test.exs index 09b6e21..a352720 100644 --- a/test/knigge/verification_test.exs +++ b/test/knigge/verification_test.exs @@ -13,7 +13,7 @@ defmodule Knigge.VerificationTest do defmodule FacadeWithoutImpl do use Knigge, implementation: Does.Not.Exist, - # Surpresses some warnings + # Suppresses some warnings delegate_at_runtime?: true @callback some_function() :: :ok