Skip to content

Conversation

jeparlefrancais
Copy link
Contributor

@jeparlefrancais jeparlefrancais commented Nov 26, 2023

Closes #2

Add a new rule remove_assertions that remove calls to the assert global functions

  • add entry to the changelog

Copy link

Coverage after merging remove-assert-call-rule into main will be

87.02%

Coverage Report for Changed Files
FileStmtsBranchesFuncsLinesUncovered Lines
src/rules
   mod.rs89.14%100%77.78%90.60%110–112, 116, 126–128, 146–148, 150, 181–183, 273, 314–315, 350–352, 415–417, 71
   remove_assertions.rs92.68%100%86.67%94.03%14, 34

@matthargett
Copy link

If removing the assert() results in an empty block, will that block be removed? If there's a simple boolean expression gating the block, will that also be removed?

@jeparlefrancais
Copy link
Contributor Author

If removing the assert() results in an empty block, will that block be removed? If there's a simple boolean expression gating the block, will that also be removed?

Hey Matt 👋 The idea is that the empty do block is being removed by the remove_empty_do rule after in the process sequence. And by a boolean gating the block, do you mean something like this:

if someCondition() then
    assert(...) -- that would get converted to a `do end`
end

That would still leave an empty if statement right now. That gives me an idea for a rule I could make that could restructure empty control flow statements though. Something that takes empty ifs and loops and flattens them into do block that preserves potential side effects. I need to think about this 🤔

@jeparlefrancais jeparlefrancais merged commit df51a96 into main Nov 27, 2023
@jeparlefrancais jeparlefrancais deleted the remove-assert-call-rule branch November 27, 2023 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove assert call
2 participants