nipraxis-fall-2022 / diagnostics-NME

0 stars 4 forks source link

Clean up unreachable code #28

Open oesteban opened 1 year ago

oesteban commented 1 year ago

Hi team,

I'm going through your project. A minor thing that would require some cleanup is at the end of the metrics.py file:

https://github.com/nipraxis-fall-2022/diagnostics-NME/blob/6653c8051c82cfd7d70e009b4d01cc82d02d74f0/solutions/metrics.py#L41-L44

Because of the return, that code will not be executed. Therefore, it is better to just remove it.

oesteban commented 1 year ago

Another one here:

https://github.com/nipraxis-fall-2022/diagnostics-NME/blob/6653c8051c82cfd7d70e009b4d01cc82d02d74f0/solutions/validate_data.py#L30-L35

oesteban commented 1 year ago

One more here:

https://github.com/nipraxis-fall-2022/diagnostics-NME/blob/6653c8051c82cfd7d70e009b4d01cc82d02d74f0/solutions/validate_data.py#L74-L80

This one has also that ending return. If you clean up the code, the return becomes unnecessary as functions that do not have a return instruction will return None.

If you want to be very explicit (which is not a bad idea), then it's better to do:

    return None