Find out if a function/definition is being used

Answered

Pycharm greys out unused variables but it seems that they do not do anything to alert the coder if a function/definition is unused.  Some functions are underlined with grey lines but those functions are used.

0
3 comments

so my question is, is this true?

0

Hi Kyle! Unfortunately PyCharm doesn't warn user about unused functions/methods. Due to dynamic nature of the language it's not possible to reliably identify it.

0
Avatar
Permanently deleted user

You are asking 2 thing. 1. Is there an inspection for unused functions. 2. Why are your function names being marked.

1.

Not a checker, but you and CTRL+Click on a class/function definition and it will show all of the places in the project where it is used. 

I'm not sure why a checker couldn't do this, although it would probably take a very long time.

2.

If your function is being underlined, hover over it with your cursor and there should be a little balloon that pops up saying what is wrong. Also Code -> inspect code is pretty useful. You can adjust the things which get flagged as well.

I'm guessing your function name does not follow PEP8 standards and that's why it's flagged.

0

Please sign in to leave a comment.