Whenever editing code, try to follow the "Boy Scout Rule", i.e., leave code surrounding your in a better state than before. For Mantid in particular, pay attention to the following:
- Do not pass
shared_ptr
unless you are passing ownership. Just passconst MyClass &
orMyClass &
instead. - Replace uses of
new
bystd::make_unique
, where possible. - Split large functions/methods into smaller functions/methods. Consider using free functions since that facilitates unit testing and code reuse.
- Remove trivial or obvious comments. If a comment can be changed into a better variable name, do so.
- Where it makes sense, replace boolean or integer flags by
enum
or preferablyenum class
. Even better: Avoid them entirely, e.g., by moving code into two separate free functions. - Use
auto
to capture complex return types such asstd::vector<...>
orstd::map<...>
. - If you encounter unit tests that look incomplete, such as not verifying that algorithm output, either fix it (if possible in reasonable time), or add a note to mantidproject#25461.