Skip to content

Commit

Permalink
Remove old TODO comments re: front-loading
Browse files Browse the repository at this point in the history
  • Loading branch information
rrrene committed Jan 2, 2024
1 parent 491f8d5 commit c30a1a5
Show file tree
Hide file tree
Showing 33 changed files with 1 addition and 42 deletions.
1 change: 0 additions & 1 deletion lib/credo/check/readability/function_names.ex
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ defmodule Credo.Check.Readability.FunctionNames do
end
end

# TODO: consider for experimental check front-loader (ast)
# NOTE: see above for how we want to avoid `sigil_X` definitions
for op <- @def_ops do
# Ignore variables named e.g. `defp`
Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/readability/large_numbers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ defmodule Credo.Check.Readability.LargeNumbers do
]

@doc false
# TODO: consider for experimental check front-loader (tokens)
def run(%SourceFile{} = source_file, params) do
min_number = Params.get(params, :only_greater_than, __MODULE__)
issue_meta = IssueMeta.for(source_file, Keyword.merge(params, only_greater_than: min_number))
Expand Down
2 changes: 0 additions & 2 deletions lib/credo/check/readability/max_line_length.ex
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ defmodule Credo.Check.Readability.MaxLineLength do
end)
end

# TODO: consider for experimental check front-loader (ast)
for op <- @def_ops do
defp find_definitions({unquote(op), meta, arguments} = ast, definitions)
when is_list(arguments) do
Expand All @@ -111,7 +110,6 @@ defmodule Credo.Check.Readability.MaxLineLength do
{ast, definitions}
end

# TODO: consider for experimental check front-loader (ast)
defp find_specs({:spec, meta, arguments} = ast, specs) when is_list(arguments) do
{ast, [meta[:line] | specs]}
end
Expand Down
2 changes: 0 additions & 2 deletions lib/credo/check/readability/module_attribute_names.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ defmodule Credo.Check.Readability.ModuleAttributeNames do
{ast, issues}
end

# TODO: consider for experimental check front-loader (ast)
# NOTE: see above how we want to exclude certain front-loads
defp traverse(
{:@, _meta, [{name, meta, _arguments}]} = ast,
issues,
Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/readability/multi_alias.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ defmodule Credo.Check.Readability.MultiAlias do
Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
end

# TODO: consider for experimental check front-loader (ast)
defp traverse(
{:alias, _, [{{_, _, [{alias, opts, _base_alias}, :{}]}, _, [multi_alias | _]}]} = ast,
issues,
Expand Down
2 changes: 1 addition & 1 deletion lib/credo/check/readability/parentheses_in_condition.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ defmodule Credo.Check.Readability.ParenthesesInCondition do

@doc false
@impl true
# TODO: consider for experimental check front-loader (tokens)

def run(%SourceFile{} = source_file, params) do
issue_meta = IssueMeta.for(source_file, params)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ defmodule Credo.Check.Readability.ParenthesesOnZeroArityDefs do
Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta, parens?))
end

# TODO: consider for experimental check front-loader (ast)
for op <- @def_ops do
# catch variables named e.g. `defp`
defp traverse({unquote(op), _, nil} = ast, issues, _issue_meta, _parens?) do
Expand Down
2 changes: 0 additions & 2 deletions lib/credo/check/readability/predicate_function_names.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ defmodule Credo.Check.Readability.PredicateFunctionNames do
Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
end

# TODO: consider for experimental check front-loader (ast)
# NOTE: see below for how we want to avoid `defp = "my_variable"` definitions
for op <- @def_ops do
# catch variables named e.g. `defp`
defp traverse({unquote(op), _meta, nil} = ast, issues, _issue_meta) do
Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/readability/prefer_implicit_try.ex
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ defmodule Credo.Check.Readability.PreferImplicitTry do
Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
end

# TODO: consider for experimental check front-loader (ast)
for op <- @def_ops do
defp traverse(
{unquote(op), _, [{_, _, _}, [do: {:try, meta, _}]]} = ast,
Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/readability/prefer_unquoted_atoms.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ defmodule Credo.Check.Readability.PreferUnquotedAtoms do

@doc false
@impl true
# TODO: consider for experimental check front-loader (tokens)
def run(%SourceFile{} = source_file, params) do
issue_meta = IssueMeta.for(source_file, params)

Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/readability/redundant_blank_lines.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ defmodule Credo.Check.Readability.RedundantBlankLines do
alias Credo.Code.Strings

@doc false
# TODO: consider for experimental check front-loader (text)
def run(%SourceFile{} = source_file, params) do
issue_meta = IssueMeta.for(source_file, params)

Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/readability/semicolons.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ defmodule Credo.Check.Readability.Semicolons do

@doc false
@impl true
# TODO: consider for experimental check front-loader (tokens)
def run(%SourceFile{} = source_file, params) do
issue_meta = IssueMeta.for(source_file, params)

Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/readability/space_after_commas.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ defmodule Credo.Check.Readability.SpaceAfterCommas do

@doc false
@impl true
# TODO: consider for experimental check front-loader (text)
def run(%SourceFile{} = source_file, params) do
issue_meta = IssueMeta.for(source_file, params)

Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/readability/specs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ defmodule Credo.Check.Readability.Specs do
{ast, issues}
end

# TODO: consider for experimental check front-loader (ast)
defp traverse(
{keyword, meta, [{:when, _, def_ast} | _]},
issues,
Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/readability/unnecessary_alias_expansion.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ defmodule Credo.Check.Readability.UnnecessaryAliasExpansion do
Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
end

# TODO: consider for experimental check front-loader (ast)
defp traverse(
{:alias, _, [{{:., _, [_, :{}]}, _, [{:__aliases__, opts, [child]}]}]} = ast,
issues,
Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/readability/with_single_clause.ex
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ defmodule Credo.Check.Readability.WithSingleClause do
Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
end

# TODO: consider for experimental check front-loader (ast)
defp traverse({:with, meta, [_, _ | _] = clauses_and_body} = ast, issues, issue_meta)
when is_list(clauses_and_body) do
# If clauses_and_body is a list with at least two elements in it, we think
Expand Down
2 changes: 0 additions & 2 deletions lib/credo/check/refactor/abc_size.ex
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ defmodule Credo.Check.Refactor.ABCSize do
{ast, issues}
end

# TODO: consider for experimental check front-loader (ast)
# NOTE: see above how we want to exclude certain front-loads
for op <- @def_ops do
defp traverse(
{unquote(op), meta, arguments} = ast,
Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/refactor/append_single_item.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ defmodule Credo.Check.Refactor.AppendSingleItem do
end

# [a] ++ b is OK
# TODO: consider for experimental check front-loader (ast)
defp traverse({:++, _, [[_], _]} = ast, issues, _issue_meta) do
{ast, issues}
end
Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/refactor/case_trivial_matches.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ defmodule Credo.Check.Refactor.CaseTrivialMatches do
Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
end

# TODO: consider for experimental check front-loader (ast)
defp traverse({:case, meta, arguments} = ast, issues, issue_meta) do
cases =
arguments
Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/refactor/cond_statements.ex
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ defmodule Credo.Check.Refactor.CondStatements do
Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
end

# TODO: consider for experimental check front-loader (ast)
defp traverse({:cond, meta, arguments} = ast, issues, issue_meta) do
conditions =
arguments
Expand Down
2 changes: 0 additions & 2 deletions lib/credo/check/refactor/cyclomatic_complexity.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ defmodule Credo.Check.Refactor.CyclomaticComplexity do
{ast, issues}
end

# TODO: consider for experimental check front-loader (ast)
# NOTE: see above how we want to exclude certain front-loads
for op <- @def_ops do
defp traverse(
{unquote(op), meta, arguments} = ast,
Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/refactor/function_arity.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ defmodule Credo.Check.Refactor.FunctionArity do
)
end

# TODO: consider for experimental check front-loader (ast)
for op <- @def_ops do
defp traverse(
{unquote(op) = op, meta, arguments} = ast,
Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/refactor/long_quote_blocks.ex
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ defmodule Credo.Check.Refactor.LongQuoteBlocks do
)
end

# TODO: consider for experimental check front-loader (ast)
defp traverse(
{:quote, meta, arguments} = ast,
issues,
Expand Down
2 changes: 0 additions & 2 deletions lib/credo/check/refactor/match_in_condition.ex
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ defmodule Credo.Check.Refactor.MatchInCondition do
{ast, issues}
end

# TODO: consider for experimental check front-loader (ast)
# NOTE: we have to exclude the cases matching the above
for op <- @condition_ops do
defp traverse({unquote(op), _meta, arguments} = ast, issues, allow_tagged_tuples, issue_meta) do
# remove do/else blocks
Expand Down
2 changes: 0 additions & 2 deletions lib/credo/check/refactor/negated_conditions_in_unless.ex
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ defmodule Credo.Check.Refactor.NegatedConditionsInUnless do
{nil, issues}
end

# TODO: consider for experimental check front-loader (ast)
# NOTE: we have to exclude the cases matching the above clause!
defp traverse({:unless, _meta, arguments} = ast, issues, issue_meta)
when is_list(arguments) do
issue = issue_for_first_condition(List.first(arguments), issue_meta)
Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/refactor/negated_conditions_with_else.ex
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ defmodule Credo.Check.Refactor.NegatedConditionsWithElse do
Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
end

# TODO: consider for experimental check front-loader (ast)
defp traverse({:if, meta, arguments} = ast, issues, issue_meta) do
if negated_condition?(arguments) && Credo.Code.Block.else_block?(ast) do

Check warning on line 52 in lib/credo/check/refactor/negated_conditions_with_else.ex

View workflow job for this annotation

GitHub Actions / [26.1/1.15.7] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 52 in lib/credo/check/refactor/negated_conditions_with_else.ex

View workflow job for this annotation

GitHub Actions / [26.2/1.16.0] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 52 in lib/credo/check/refactor/negated_conditions_with_else.ex

View workflow job for this annotation

GitHub Actions / [25.3/1.15.7] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 52 in lib/credo/check/refactor/negated_conditions_with_else.ex

View workflow job for this annotation

GitHub Actions / [25.3/1.13.4] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 52 in lib/credo/check/refactor/negated_conditions_with_else.ex

View workflow job for this annotation

GitHub Actions / [24.3/1.13.4] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 52 in lib/credo/check/refactor/negated_conditions_with_else.ex

View workflow job for this annotation

GitHub Actions / [24.3/1.14.5] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 52 in lib/credo/check/refactor/negated_conditions_with_else.ex

View workflow job for this annotation

GitHub Actions / [24.3/1.12.3] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 52 in lib/credo/check/refactor/negated_conditions_with_else.ex

View workflow job for this annotation

GitHub Actions / [24.3/1.11.4] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 52 in lib/credo/check/refactor/negated_conditions_with_else.ex

View workflow job for this annotation

GitHub Actions / [23.3/1.14.5] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 52 in lib/credo/check/refactor/negated_conditions_with_else.ex

View workflow job for this annotation

GitHub Actions / [23.3/1.13.4] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 52 in lib/credo/check/refactor/negated_conditions_with_else.ex

View workflow job for this annotation

GitHub Actions / [23.3/1.12.3] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 52 in lib/credo/check/refactor/negated_conditions_with_else.ex

View workflow job for this annotation

GitHub Actions / [23.3/1.11.4] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.
new_issue = issue_for(issue_meta, meta[:line], "!")
Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/refactor/nesting.ex
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ defmodule Credo.Check.Refactor.Nesting do
Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta, max_nesting))
end

# TODO: consider for experimental check front-loader (ast)
for op <- @def_ops do
defp traverse(
{unquote(op) = op, meta, arguments} = ast,
Expand Down
2 changes: 0 additions & 2 deletions lib/credo/check/refactor/perceived_complexity.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ defmodule Credo.Check.Refactor.PerceivedComplexity do
{ast, issues}
end

# TODO: consider for experimental check front-loader (ast)
# NOTE: see above for how we want to exclude `__using__` macros
for op <- @def_ops do
defp traverse(
{unquote(op), meta, arguments} = ast,
Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/refactor/pipe_chain_start.ex
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ defmodule Credo.Check.Refactor.PipeChainStart do
)
end

# TODO: consider for experimental check front-loader (ast)
defp traverse(
{:|>, _, [{:|>, _, _} | _]} = ast,
issues,
Expand Down
2 changes: 0 additions & 2 deletions lib/credo/check/refactor/unless_with_else.ex
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ defmodule Credo.Check.Refactor.UnlessWithElse do
{nil, issues}
end

# TODO: consider for experimental check front-loader (ast)
# NOTE: we have to exclude the cases matching the above clause!
defp traverse({:unless, meta, _arguments} = ast, issues, issue_meta) do
new_issue = issue_for_else_block(Credo.Code.Block.else_block_for!(ast), meta, issue_meta)

Check warning on line 50 in lib/credo/check/refactor/unless_with_else.ex

View workflow job for this annotation

GitHub Actions / [26.1/1.15.7] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 50 in lib/credo/check/refactor/unless_with_else.ex

View workflow job for this annotation

GitHub Actions / [26.2/1.16.0] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 50 in lib/credo/check/refactor/unless_with_else.ex

View workflow job for this annotation

GitHub Actions / [25.3/1.15.7] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 50 in lib/credo/check/refactor/unless_with_else.ex

View workflow job for this annotation

GitHub Actions / [25.3/1.13.4] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 50 in lib/credo/check/refactor/unless_with_else.ex

View workflow job for this annotation

GitHub Actions / [24.3/1.13.4] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 50 in lib/credo/check/refactor/unless_with_else.ex

View workflow job for this annotation

GitHub Actions / [24.3/1.14.5] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 50 in lib/credo/check/refactor/unless_with_else.ex

View workflow job for this annotation

GitHub Actions / [24.3/1.12.3] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 50 in lib/credo/check/refactor/unless_with_else.ex

View workflow job for this annotation

GitHub Actions / [24.3/1.11.4] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 50 in lib/credo/check/refactor/unless_with_else.ex

View workflow job for this annotation

GitHub Actions / [23.3/1.14.5] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 50 in lib/credo/check/refactor/unless_with_else.ex

View workflow job for this annotation

GitHub Actions / [23.3/1.13.4] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 50 in lib/credo/check/refactor/unless_with_else.ex

View workflow job for this annotation

GitHub Actions / [23.3/1.12.3] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Check warning on line 50 in lib/credo/check/refactor/unless_with_else.ex

View workflow job for this annotation

GitHub Actions / [23.3/1.11.4] CI Tests on Credo [OTP/Elixir]

Nested modules could be aliased at the top of the invoking module.

Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/refactor/with_clauses.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ defmodule Credo.Check.Refactor.WithClauses do
Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
end

# TODO: consider for experimental check front-loader (ast)
defp traverse({:with, meta, [_, _ | _] = clauses_and_body} = ast, issues, issue_meta)
when is_list(clauses_and_body) do
# If clauses_and_body is a list with at least two elements in it, we think
Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/warning/operation_on_same_values.ex
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ defmodule Credo.Check.Warning.OperationOnSameValues do
Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
end

# TODO: consider for experimental check front-loader (ast)
for op <- @def_ops do
# exclude def arguments for operators
defp traverse(
Expand Down
1 change: 0 additions & 1 deletion lib/credo/check/warning/raise_inside_rescue.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ defmodule Credo.Check.Warning.RaiseInsideRescue do
Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
end

# TODO: consider for experimental check front-loader (ast)
defp traverse({:try, _meta, _arguments} = ast, issues, issue_meta) do
case Block.rescue_block_for(ast) do
{:ok, ast} ->
Expand Down

0 comments on commit c30a1a5

Please sign in to comment.