Add boolean operator guidance to Elixir usage rules#6625
Closed
Vitaly-A-Ivanov wants to merge 1 commit intophoenixframework:mainfrom
Closed
Add boolean operator guidance to Elixir usage rules#6625Vitaly-A-Ivanov wants to merge 1 commit intophoenixframework:mainfrom
Vitaly-A-Ivanov wants to merge 1 commit intophoenixframework:mainfrom
Conversation
Author
|
Added this to make the |
Member
|
Thank you but our general guidance with the AGENTS.md is that we only add rules that the Phoenix team runs into. This is because if we were to collect everyone's input, even though they are appreciated, they would quickly run out of control. As most things generated by Phoenix, they are a starting point, so please expand them based on your needs! Thanks! |
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.
Summary
Adds guidance to
usage-rules/elixir.mdfor choosing&&/||versusand/or.What changed
&&and||are usually safer in Elixirandandorare still appropriatenil, and changeset/database-style flowsWhy
Elixir’s
andandorrequire a boolean left-hand side, which can raise when used with values like structs ornil. This rule makes that distinction explicit and gives contributors a consistent default.Notes