Skip to content

Commit

Permalink
fix up comments re = in variable name...
Browse files Browse the repository at this point in the history
  • Loading branch information
novaugust committed Jan 16, 2024
1 parent 5d56617 commit 1b8ed29
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/style/speedo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,9 @@ defmodule Styler.Speedo do
{zipper, Map.update!(ctx, :errors, &[[pascal | errors] | &1])}
end

# TODO all sorts of problems here. mostly, doesn't detect variable creation in case / cond / fn head etc.
# Credo.Check.Readability.VariableNames

def run({{assignment_op, _, [lhs, _]}, _} = zipper, ctx) when assignment_op in ~w(<- ->)a do
# the `=` here will double report when nested in a case. need to move it to its own clause w/ "in block"
def run({{assignment_op, _, [lhs, _]}, _} = zipper, ctx) when assignment_op in ~w(= <- ->)a do
{_, errors} = lhs |> Zipper.zip() |> Zipper.traverse([], &find_vars_with_bad_names(&1, &2, ctx.file))
{zipper, Map.update!(ctx, :errors, &[errors | &1])}
end
Expand Down Expand Up @@ -143,12 +142,14 @@ defmodule Styler.Speedo do
def naughtyFun(naughtyParam) do
IO.inspect(@badName)

naughtyAssignment = :ok

Check warning on line 145 in lib/style/speedo.ex

View workflow job for this annotation

GitHub Actions / Ex1.14.2/OTP25.1.2

variable "naughtyAssignment" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 145 in lib/style/speedo.ex

View workflow job for this annotation

GitHub Actions / Ex1.15.7/OTP25.1.2

variable "naughtyAssignment" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 145 in lib/style/speedo.ex

View workflow job for this annotation

GitHub Actions / Ex1.15.7/OTP25.1.2

variable "naughtyAssignment" is unused (if the variable is not meant to be used, prefix it with an underscore)

with {:ugh, naughtyVar} <- {:ugh, naughtyParam} do
naughtyVar
end
end

def foo(naughtyVar, %{bar: :x = naughtyVar}) do
def foo(naughtyParam2, %{bar: :x = naughtyParam3}) do

Check warning on line 152 in lib/style/speedo.ex

View workflow job for this annotation

GitHub Actions / Ex1.14.2/OTP25.1.2

variable "naughtyParam2" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 152 in lib/style/speedo.ex

View workflow job for this annotation

GitHub Actions / Ex1.14.2/OTP25.1.2

variable "naughtyParam3" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 152 in lib/style/speedo.ex

View workflow job for this annotation

GitHub Actions / Ex1.15.7/OTP25.1.2

variable "naughtyParam2" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 152 in lib/style/speedo.ex

View workflow job for this annotation

GitHub Actions / Ex1.15.7/OTP25.1.2

variable "naughtyParam3" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 152 in lib/style/speedo.ex

View workflow job for this annotation

GitHub Actions / Ex1.15.7/OTP25.1.2

variable "naughtyParam2" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 152 in lib/style/speedo.ex

View workflow job for this annotation

GitHub Actions / Ex1.15.7/OTP25.1.2

variable "naughtyParam3" is unused (if the variable is not meant to be used, prefix it with an underscore)
end

defexception [:foo]
Expand Down

0 comments on commit 1b8ed29

Please sign in to comment.