-
-
Notifications
You must be signed in to change notification settings - Fork 101
feat(linter): add rule for no assignment in function parameters #821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
azjezz
merged 7 commits into
carthage-software:main
from
chrisopperwall-qz:add-no-assignment-in-function-parameters
Dec 23, 2025
Merged
feat(linter): add rule for no assignment in function parameters #821
azjezz
merged 7 commits into
carthage-software:main
from
chrisopperwall-qz:add-no-assignment-in-function-parameters
Dec 23, 2025
Conversation
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
f8ba47b to
b39bb3a
Compare
azjezz
requested changes
Dec 23, 2025
Member
azjezz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Member
|
You can use |
Contributor
Author
|
Thanks, @azjezz! I'll address those comments soon |
azjezz
reviewed
Dec 23, 2025
Member
|
Thank you @chrisopperwall-qz ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Priority: Medium
This issue may be useful and needs attention.
Subject: Linter
An issue or PR related to the linter.
Type: Enhancement
Request for additions or changes that improve existing functionality.
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.
📌 What Does This PR Do?
This PR adds a no_assign_in_argument rule to lint similar use cases to no_assign_in_condition, where an assignment expression within a function call argument is not allowed.
🔍 Context & Motivation
This rule would be helpful to warn or error in cases where it's clearer to assign a variable in its own statement, and then use that variable in the function call, instead of nesting the assignment expression in the function call argument.
🛠️ Summary of Changes
correctness/no_assign_in_argumentrule.📂 Affected Areas
🔗 Related Issues or PRs
📝 Notes for Reviewers
The inspiration for this change is this hhast-lint rule which discourages assignment expressions in function call arguments because
https://github.com/hhvm/hhast/blob/v3.27.4/src/Linters/NoBasicAssignmentFunctionParameterLinter.php
I'm a little new to rust, so I mostly followed the example of
correctness/no_assign_in_condition, so if there's any feedback I'm happy to make changes!