ExSlop.Check.Readability.NarratorComment (ExSlop v0.3.0)

Copy Markdown View Source

Basics

This check is disabled by default.

Learn how to enable it via .credo.exs.

This check has a base priority of low and works with any version of Elixir.

Explanation

Inline comments that narrate code in first-person plural ("we") or with "Let's" / "Here we" are a hallmark of LLM-generated code. They add no value — either delete them or replace with a comment that explains WHY.

# bad
# Here we fetch the user from the database
user = Repo.get!(User, id)

# Now we validate the input
changeset = User.changeset(user, attrs)

# Let's create a new changeset
changeset = change(user)

# good — no comment needed, the code is clear

# good — explains WHY
# Bypass validation for admin imports (they're pre-validated upstream)
Repo.insert!(changeset, skip_validations: true)

Check-Specific Parameters

There are no specific parameters for this check.

General Parameters

Like with all checks, general params can be applied.

Parameters can be configured via the .credo.exs config file.