Closed rakhimov closed 8 years ago
The implementation currently breaks the decorator based _state_imp
function design.
@terryyin , any hints how to integrate this PR gracefully?
@rakhimov thanks for the pull request. I get your idea:-)
Yeah, I've been refactoring the state-machine to make it more modularised. The new design isn't quite completed yet.
I'm thinking to implement it with an "extension" first for now...
Any way. Let me merge and then show you my idea.
I created a new extension (lizard_ext/lizardignoreassert.py), which can be used with:
lizard -EIgnoreAssert
https://github.com/terryyin/lizard/commit/5d23f3e08470d76703fe846357566971c357bdd0
I like this approach. Thanks for putting extra work to make this PR fit.
Consider a simple use case:
This line adds 1 + CCN(conditional_expression) if the assertion is counted as a part of a function.
Since assertions are mostly used to check (pre, post)-conditions, to explicitly state assumptions, and to catch programmer errors, they are not expected to be a part of the flow of a function. Moreover, assertions with side-effects is a very bad idea. The function should stay the same if all the assertions are removed (in release mode, for example).