Support enabling check via {Credo.Check.*, true}#1281
Open
s3cur3 wants to merge 1 commit into
Open
Conversation
A common mistake I see a lot is folks (including myself) thinking you can modify this disabled check line in the config:
```elixir
{Credo.Check.Readability.ModuleDoc, false},
```
...by simply changing the `true` to `false`. If you do this on mainline Credo, it will crash when trying to operate on `{check_name, true}` with a fairly cryptic error:
```
** (Protocol.UndefinedError) protocol Enumerable not implemented for Atom
Got value:
true
(elixir 1.19.4) lib/enum.ex:5: Enumerable.impl_for!/1
(elixir 1.19.4) lib/enum.ex:170: Enumerable.reduce/3
(elixir 1.19.4) lib/enum.ex:4570: Enum.each/2
(elixir 1.19.4) lib/enum.ex:961: Enum."-each/2-lists^foreach/1-0-"/2
(credo 1.8.0-dev) lib/credo/execution/task/validate_config.ex:75: Credo.Execution.Task.ValidateConfig.validate_checks/1
(credo 1.8.0-dev) lib/credo/execution/task/validate_config.ex:12: Credo.Execution.Task.ValidateConfig.call/2
(credo 1.8.0-dev) lib/credo/execution/task.ex:132: Credo.Execution.Task.do_run/3
(elixir 1.19.4) lib/enum.ex:2520: Enum."-reduce/3-lists^foldl/2-0-"/3
```
With this change, the inferred behavior ("I should be able to change false to true to enable it") will now "just work."
rrrene
added a commit
that referenced
this pull request
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A common mistake I see a lot is folks (including myself) thinking you can modify a disabled check line in the config like:
...by simply changing the
truetofalse. If you do this on mainline Credo, it will crash with a fairly cryptic error (you can't tell from the stacktrace which check caused the problem):With this change, the inferred behavior ("I should be able to change false to true to enable it") will now "just work."