Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

## 0.7.2 - 2024/02/10

+ Fix `Recode.AST.alias_info` fot `alias __MODULE__, as: MyModule`.
+ Fix `Recode.AST.alias_info` for `alias __MODULE__, as: MyModule`.

## 0.7.1 - 2024/01/09

Expand All @@ -50,7 +50,7 @@

## 0.6.5 - 2023/10/09

+ Start `:recode` appliations in `mix recode` task.
+ Start `:recode` applications in `mix recode` task.

## 0.6.4 - 2023/09/15

Expand Down Expand Up @@ -135,7 +135,7 @@

## 0.3.0 - 2022/08/28

+ Rename `Recode.Taks.SameLine` to `Recode.Task.EnforceLineLength`.
+ Rename `Recode.Task.SameLine` to `Recode.Task.EnforceLineLength`.

## 0.2.0 - 2022/08/21

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Design tasks:
TagFIXME # Checker - Checks if there are FIXME tags in the sources.
TagTODO # Checker - Checks if there are TODO tags in the sources.
Readability tasks:
AliasExpansion # Corrector - Exapnds multi aliases to separate aliases.
AliasExpansion # Corrector - Expands multi aliases to separate aliases.
AliasOrder # Corrector - Checks if aliases are sorted alphabetically.
EnforceLineLength # Corrector - Forces expressions to one line.
Format # Corrector - Does the same as `mix format`.
Expand Down
2 changes: 1 addition & 1 deletion lib/mix/tasks/recode.help.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Mix.Tasks.Recode.Help do
@shortdoc "Lists recode tasks"

@moduledoc """
Lists all availbale recode tasks with a short description or prints the
Lists all available recode tasks with a short description or prints the
documentation for a given recode task.

To print the documentation of a task run `mix recode.help {task-name}`. As a
Expand Down
4 changes: 2 additions & 2 deletions lib/mix/tasks/recode.update.config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ defmodule Mix.Tasks.Recode.Update.Config do
@moduledoc """
#{@shortdoc}.

The task merges the exsiting config into the actual config and updates the
The task merges the existing config into the actual config and updates the
version. Using this task preserves changes in the actual config and adds new values.

The acutal default config:
The actual default config:
```elixir
#{Recode.Config.to_string()}
```
Expand Down
4 changes: 2 additions & 2 deletions lib/recode/ast.ex
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
defmodule Recode.AST do
@moduledoc """
This module provides functions to get informations from the AST and to
This module provides functions to get information from the AST and to
manipulate the AST.

Most of the functions in this module require an AST with additional
informations. This information is provided by `Sourceror` or
information. This information is provided by `Sourceror` or
`Code.string_to_quoted/2` with the options
```elixir
[
Expand Down
2 changes: 1 addition & 1 deletion lib/recode/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ defmodule Recode.Config do
end

@doc """
Reads the `Recode` cofiguration from the given `path`.
Reads the `Recode` configuration from the given `path`.
"""
@spec read(Path.t()) :: {:ok, config()} | {:error, :not_found}
def read(path \\ @config_filename) when is_binary(path) do
Expand Down
6 changes: 3 additions & 3 deletions lib/recode/runner/impl.ex
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ defmodule Recode.Runner.Impl do
)
end

# For now, all sources without a filetype Source.Ex are direclty excluded.
# For now, all sources without a filetype Source.Ex are directly excluded.
# For the Source.Ex sources we check whether the source is excluded.
defp exclude?(task, %Source{filetype: %Source.Ex{}} = source, config) do
config
Expand Down Expand Up @@ -246,10 +246,10 @@ defmodule Recode.Runner.Impl do

defp exclude_reading(config) do
config_file = get_cli_opts(config, :config, ".recode.exs")
config_timestemp = Timestamp.for_file(config_file)
config_timestamp = Timestamp.for_file(config_file)

case Manifest.read(config) do
{timestamp, ^config_file, paths} when timestamp > config_timestemp ->
{timestamp, ^config_file, paths} when timestamp > config_timestamp ->
fn path ->
cond do
path in paths -> false
Expand Down
2 changes: 1 addition & 1 deletion lib/recode/task/alias_expansion.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Recode.Task.AliasExpansion do
@shortdoc "Exapnds multi aliases to separate aliases."
@shortdoc "Expands multi aliases to separate aliases."

@moduledoc """
Multi aliases makes module uses harder to search for in large code bases.
Expand Down
2 changes: 1 addition & 1 deletion lib/recode/task/format.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule Recode.Task.Format do
"""

# The task can be configured like other tasks. This configuration is just for
# debuging and not part of the documentation.
# debugging and not part of the documentation.
#
# The default, formats code with Sourceror:
# {Recode.Task.Format, []},
Expand Down
2 changes: 1 addition & 1 deletion lib/recode/task/tag_fixme.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Recode.Task.TagFIXME do
@moduledoc """
#{@shortdoc}

FIXME tags in comments and docs are used as a reminder and should be handeld in
FIXME tags in comments and docs are used as a reminder and should be handled in
the near future.

## Examples
Expand Down
2 changes: 1 addition & 1 deletion lib/recode/task/tag_todo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Recode.Task.TagTODO do
@moduledoc """
#{@shortdoc}

TODO tags in comments and docs are used as a reminder and should be handeld in
TODO tags in comments and docs are used as a reminder and should be handled in
the near future.

## Examples
Expand Down
10 changes: 5 additions & 5 deletions lib/recode/task/unnecessary_if_unless.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Recode.Task.UnnecessaryIfUnless do
@shortdoc "Removes redundant booleans"

@moduledoc """
Redudant booleans make code needlesly verbose.
Redundant booleans make code needlessly verbose.

# preferred
foo == bar
Expand All @@ -29,13 +29,13 @@ defmodule Recode.Task.UnnecessaryIfUnless do
|> Source.get(:quoted)
|> Zipper.zip()
|> Zipper.traverse([], fn zipper, issues ->
remove_unecessary_if_unless(zipper, issues, opts[:autocorrect])
remove_unnecessary_if_unless(zipper, issues, opts[:autocorrect])
end)

update_source(source, opts, quoted: zipper, issues: issues)
end

defp remove_unecessary_if_unless(
defp remove_unnecessary_if_unless(
%Zipper{node: {conditional, meta, body}} = zipper,
issues,
true
Expand All @@ -52,7 +52,7 @@ defmodule Recode.Task.UnnecessaryIfUnless do
end
end

defp remove_unecessary_if_unless(
defp remove_unnecessary_if_unless(
%Zipper{node: {conditional, meta, body}} = zipper,
issues,
false
Expand All @@ -72,7 +72,7 @@ defmodule Recode.Task.UnnecessaryIfUnless do
{zipper, issues}
end

defp remove_unecessary_if_unless(zipper, issues, _autocorrect), do: {zipper, issues}
defp remove_unnecessary_if_unless(zipper, issues, _autocorrect), do: {zipper, issues}

defp extract(
[
Expand Down
4 changes: 2 additions & 2 deletions test/recode/context_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ defmodule Recode.ContextTest do
assert output =~ ~r/^234: requirements:.*Traverse.Pluto/m
end

test "traveses script with vars named alias, import, etc.." do
test "traverses script with vars named alias, import, etc.." do
src = File.read!("test/fixtures/context/vars.exs")

output =
Expand All @@ -216,7 +216,7 @@ defmodule Recode.ContextTest do
assert output == File.read!("test/fixtures/context/vars.exs.output")
end

test "traveses module with vars named alias, import, etc.." do
test "traverses module with vars named alias, import, etc.." do
src = File.read!("test/fixtures/context/vars.ex")

output =
Expand Down
30 changes: 15 additions & 15 deletions test/recode/task/enforce_line_length_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defmodule Recode.Task.EnforceLineLengthTest do
foo: 42
}

assert formated?(code)
assert formatted?(code)

code
|> run_task(EnforceLineLength, autocorrect: true)
Expand Down Expand Up @@ -62,7 +62,7 @@ defmodule Recode.Task.EnforceLineLengthTest do
[:a, :b, :c]
"""

assert formated?(code)
assert formatted?(code)

code
|> run_task(EnforceLineLength, autocorrect: true)
Expand All @@ -80,7 +80,7 @@ defmodule Recode.Task.EnforceLineLengthTest do
true and false and x
"""

assert formated?(code)
assert formatted?(code)

code
|> run_task(EnforceLineLength, autocorrect: true)
Expand All @@ -101,7 +101,7 @@ defmodule Recode.Task.EnforceLineLengthTest do
1 + 2 - 3 / 4 * 5 + 6
"""

assert formated?(code)
assert formatted?(code)

code
|> run_task(EnforceLineLength, autocorrect: true)
Expand All @@ -127,7 +127,7 @@ defmodule Recode.Task.EnforceLineLengthTest do
end
"""

assert formated?(code)
assert formatted?(code)

code
|> run_task(EnforceLineLength, autocorrect: true)
Expand All @@ -148,7 +148,7 @@ defmodule Recode.Task.EnforceLineLengthTest do
end
"""

assert formated?(code)
assert formatted?(code)

code
|> run_task(EnforceLineLength, autocorrect: true)
Expand Down Expand Up @@ -176,7 +176,7 @@ defmodule Recode.Task.EnforceLineLengthTest do
end
"""

assert formated?(code)
assert formatted?(code)

code
|> run_task(EnforceLineLength, autocorrect: true)
Expand Down Expand Up @@ -211,7 +211,7 @@ defmodule Recode.Task.EnforceLineLengthTest do
end
"""

assert formated?(code)
assert formatted?(code)

code
|> run_task(EnforceLineLength, autocorrect: true)
Expand Down Expand Up @@ -247,7 +247,7 @@ defmodule Recode.Task.EnforceLineLengthTest do
end
"""

assert formated?(code)
assert formatted?(code)

code
|> run_task(EnforceLineLength, autocorrect: true)
Expand All @@ -265,7 +265,7 @@ defmodule Recode.Task.EnforceLineLengthTest do
fn x -> {:ok, x} end
"""

assert formated?(code)
assert formatted?(code)

code
|> run_task(EnforceLineLength, autocorrect: true)
Expand Down Expand Up @@ -298,7 +298,7 @@ defmodule Recode.Task.EnforceLineLengthTest do
fn x -> {:ok, x} end
"""

assert formated?(code)
assert formatted?(code)

code
|> run_task(EnforceLineLength, autocorrect: true)
Expand Down Expand Up @@ -336,7 +336,7 @@ defmodule Recode.Task.EnforceLineLengthTest do
end
"""

assert formated?(code)
assert formatted?(code)

code
|> run_task(EnforceLineLength, ignore: [:fn], autocorrect: true)
Expand Down Expand Up @@ -367,7 +367,7 @@ defmodule Recode.Task.EnforceLineLengthTest do
end
"""

assert formated?(code)
assert formatted?(code)

code
|> run_task(EnforceLineLength, autocorrect: true)
Expand Down Expand Up @@ -400,7 +400,7 @@ defmodule Recode.Task.EnforceLineLengthTest do
end
"""

assert formated?(code)
assert formatted?(code)

code
|> run_task(EnforceLineLength, ignore: [:fn], autocorrect: true)
Expand Down Expand Up @@ -436,7 +436,7 @@ defmodule Recode.Task.EnforceLineLengthTest do
end
"""

assert formated?(code)
assert formatted?(code)

code
|> run_task(EnforceLineLength, skip: [:assert_raise], autocorrect: true)
Expand Down
4 changes: 2 additions & 2 deletions test/recode/task/filter_count_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ defmodule Recode.Task.FilterCountTest do
|> assert_code(expected)
end

test "corrects code when Enum.count gets a pipline ending with Enum.filter as argument" do
test "corrects code when Enum.count gets a pipeline ending with Enum.filter as argument" do
code = """
def foo(arg) do
Enum.count(arg |> Enum.reverse() |> Enum.filter(fn x -> rem(x, 2) == 0 end))
Expand Down Expand Up @@ -361,7 +361,7 @@ defmodule Recode.Task.FilterCountTest do
|> assert_issue()
end

test "reports issue when Enum.count gets a pipline ending with Enum.filter as argument" do
test "reports issue when Enum.count gets a pipeline ending with Enum.filter as argument" do
"""
def foo(arg) do
Enum.count(arg |> Enum.reverse() |> Enum.filter(fn x -> rem(x, 2) == 0 end))
Expand Down
2 changes: 1 addition & 1 deletion test/recode/task/moduledoc_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Recode.Task.ModuledocTest do
alias Recode.Task.Moduledoc

describe "run/1 not raises an issue" do
test "when no defmodule is availabel" do
test "when no defmodule is available" do
"""
def foo(x) do
{:ok, x}
Expand Down
Loading
Loading