"CollapseClauseToAssert" lint/suggestion #1362
Closed
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.
Inspired by the following code on
luau-lang.org
:https://luau-lang.org/2023/03/31/luau-recap-march-2023.html#:~:text=if%20not%20x%20then%20error(%27first%20argument%20is%20nil%27)%20end
master
Adds the
CollapseClauseToAssert
lint, which triggers in the following code:if
else
blockerror
cannot be given alevel
argument (change in behavior asassert
does not have alevel
parameter)error
callFor some reason, the string formatting wasn't working. I would have liked to have the message substitute the condition and error strings into the lint warning, but it's not too important.
Passed all tests w/ 0 errors, 0 skips (assuming I ran the tests correctly...)
Am I doing this right?