Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Detect & remove unused functions #170

Closed
Tracked by #213
JackKelly opened this issue Sep 28, 2021 · 6 comments · Fixed by #534
Closed
Tracked by #213

Detect & remove unused functions #170

JackKelly opened this issue Sep 28, 2021 · 6 comments · Fixed by #534
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers refactoring

Comments

@JackKelly
Copy link
Member

JackKelly commented Sep 28, 2021

Detailed Description

It's quite likely that our code implements some functions that are no longer used. We should remove these unused functions :)

Possible Implementation

A manual way to do this would be to do grep -r --include=*.py "<function name>" for all the function names we think might no longer be used. But that's a bit tedious!

It would be nice to automatically detect dead code, possibly every time CI runs. Here's a Stack Overflow thread with some suggestions for how to do that! But anything automated should only warn us; it shouldn't automatically delete code!

@JackKelly JackKelly added enhancement New feature or request refactoring good first issue Good for newcomers labels Sep 28, 2021
@BodaleDenis
Copy link

Hi, I would like to contribute if you can assign to me. thank you!😁

@JackKelly
Copy link
Member Author

Thank you so much - that would be super-helpful!

@BodaleDenis
Copy link

Hello, thanks for assign 😃
I will do my best to deliver this ASAP, but please acknowledge that I'm also a full-employed SW Engineer and I contribute in my spare time. Hope will be good, if this is very urgent please inform me so that I can leave room for someone with more free time, but I will be very glad if I contribute myself to this since it's very interesting 👍

@JackKelly
Copy link
Member Author

Please don't feel under any pressure! You've chosen a great issue to work on: It's definitely important; but it's not blocking anything else, so it's not super-urgent! Thank you so much for diving in and helping out! Hopefully this will help reduce CO2 emissions ASAP :)

@peterdudfield
Copy link
Contributor

I was looking at https://app.codecov.io/gh/openclimatefix/nowcasting_dataset/blob/main/nowcasting_dataset/utils.py
so I took out some functions and all pytests passed.

@BodaleDenis hope I didnt steal this task from you

Repository owner moved this from Todo to Done in Nowcasting Dec 10, 2021
@JackKelly
Copy link
Member Author

JackKelly commented Dec 10, 2021

ah, so, before removing functions please also run grep -r --include=*.py <function_name> in the base path of the repo to search for any other uses of the function because some functions might not be tested?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers refactoring
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants