mne-tools / mne-cpp

MNE-CPP: A Framework for Electrophysiology
https://mne-cpp.org/
BSD 3-Clause "New" or "Revised" License
152 stars 139 forks source link

Remove unnecessary null pointer checks #857

Open elfring opened 2 years ago

elfring commented 2 years ago

Extra null pointer checks are not needed in functions like the following.

juangpc commented 2 years ago

All these are very good catches. Thanks. Would you be willing to PR the changes?

elfring commented 2 years ago

:thought_balloon: Would you become interested to use a development tool like “clang-tidy” for corresponding source code adjustments?


How do you think about to adjust any more source code places? :thinking:

juangpc commented 2 years ago

Yes, we use it. As shown in different places here https://mne-cpp.github.io/pages/development/contribute.html, we use qtcreator for development and that brings clang-tidy by default. But we have an unsurmountable amount of warnings. So I guess the ones you are mentioning are probably there... We keep addressing them frequently, although not frequently enough.

elfring commented 2 years ago

How do you think about to improve the software situation any more by influencing evolution according to development tools for automatic source code adjustments? :thinking:

juangpc commented 2 years ago

That's a good idea. But I think that the chances of a fix generating more harm than good are, in my opinion too high. Our testing pipeline, or our coverage, aren't in great either. So it would mean that it would be hard to catch the generated problem. Bear in mind that some of our libraries inherit from c libraries which implement a particular way of managing memory. This means that these components live a long way from raii.

elfring commented 2 years ago

Search patterns can be specified for questionable source code places. They can become more sophisticated on demand, can't they? :thinking: