Ticket #6152 (closed: fixed)
TimeSeriesProperty: Duplicate if-else branches highlighted by cppcheck
Reported by: | Russell Taylor | Owned by: | Russell Taylor |
---|---|---|---|
Priority: | major | Milestone: | Release 2.4 |
Component: | Mantid | Keywords: | |
Cc: | reuterma@…, martyn.gigg@… | Blocked By: | |
Blocking: | Tester: | Wenduo Zhou |
Description
Cppcheck is flagging lines 495-506 and 623-626 (link below) as a duplicate if statements. And it's right, so they're clearly wrong or nonsensical in some way.
Change History
comment:2 Changed 8 years ago by Russell Taylor
Re #6152. Fix if-else construct that was identical on either branch.
Changeset: c65099a99e2d33152008dd52a20e1f4540547031
comment:3 Changed 8 years ago by Russell Taylor
The code for the other highlighted place first appeared in https://github.com/mantidproject/mantid/commit/10c600459a977fc363155af5fbe29df1b3fc39bc and at that point the branches were ever so slightly different. I need to go through the history again to spot where they became identical (missed it the first time). The reason for adding a tolerance in the 'else' case is not clear to me (though it's always been there).
comment:4 Changed 8 years ago by Russell Taylor
https://github.com/mantidproject/mantid/commit/b9d9c3e5fe1c5c2b3f8aa32a516f1fc19944e587 is where they became identical, under #1661.
comment:5 Changed 8 years ago by Russell Taylor
Re #6152. Fix if-else construct that was identical on either branch.
There's also a slight change in behaviour. If a 'good' region contains more than one log value, and log values are considered to represent the left of a bin, then the end time will be the point it went 'bad' (previously it was the time of the last good value + a tolerance).
Changeset: dd2b10fe7fa766b6cf4de8f9cedb8022cec711c8
comment:6 Changed 8 years ago by Russell Taylor
Re #6152. Wiki documentation update.
Changeset: e95f127e96531bc6044cb8a49f6589b454708b9a
comment:7 Changed 8 years ago by Russell Taylor
Re #6152. Fix out-of-bounds error.
Highlighted by failing FilterByLogValueTest on mac, confirmed by valgrind.
Changeset: e39192cd9fc6012332eb684b52840c3a17c6f893
comment:8 Changed 8 years ago by Russell Taylor
Re #6152. In test, create algorithms on stack, not heap.
Cleans valgrind output because previously the test leaked memory.
Changeset: 203b6da23cc7560277f52f2cf1422856adc51537
comment:9 Changed 8 years ago by Russell Taylor
Re #6267 & Re #6152. Fix stop time for left-aligned time boundaries.
Changeset: 12e197a233c4cc35c00ed481830ef97b7354e281
comment:10 Changed 8 years ago by Russell Taylor
Re #6152. Fix if-else construct that was identical on either branch.
Changeset: c65099a99e2d33152008dd52a20e1f4540547031
comment:11 Changed 8 years ago by Russell Taylor
Re #6152. Fix if-else construct that was identical on either branch.
There's also a slight change in behaviour. If a 'good' region contains more than one log value, and log values are considered to represent the left of a bin, then the end time will be the point it went 'bad' (previously it was the time of the last good value + a tolerance).
Changeset: dd2b10fe7fa766b6cf4de8f9cedb8022cec711c8
comment:12 Changed 8 years ago by Russell Taylor
Re #6152. Wiki documentation update.
Changeset: e95f127e96531bc6044cb8a49f6589b454708b9a
comment:13 Changed 8 years ago by Russell Taylor
Re #6152. Fix out-of-bounds error.
Highlighted by failing FilterByLogValueTest on mac, confirmed by valgrind.
Changeset: e39192cd9fc6012332eb684b52840c3a17c6f893
comment:14 Changed 8 years ago by Russell Taylor
Re #6152. In test, create algorithms on stack, not heap.
Cleans valgrind output because previously the test leaked memory.
Changeset: 203b6da23cc7560277f52f2cf1422856adc51537
comment:15 Changed 8 years ago by Russell Taylor
Re #6267 & Re #6152. Fix stop time for left-aligned time boundaries.
Changeset: 12e197a233c4cc35c00ed481830ef97b7354e281
comment:16 Changed 8 years ago by Russell Taylor
- Status changed from accepted to verify
- Resolution set to fixed
To test: Observe that the cppcheck entries complaining of duplicate branches are gone, and check the code as well. Make note of the slight changes in functionality and make yourself confident that this is correct (note the new/changed unit tests).
comment:17 Changed 8 years ago by Wenduo Zhou
- Status changed from verify to verifying
- Tester set to Wenduo Zhou
comment:19 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 6998