9

I have this piece of code in a Python module open in PyCharm Community Edition 2017.2.

class Sample(object):
    def __init__(self):
        self.prop1 = 5
        self.prop2 = 10

    def method1(self):
        return foo

    def do_work(self):
        not_defined_func()


s = Sample()
s.method1()

bar = call_func

The IDE doesn't give any warnings on some fairly serious issues:

  1. The returned variable foo has not been defined.
  2. I assign not defined variable call_func to the variable bar.
  3. I call not defined function not_defined_func inside the method do_work.

How do I enable PyCharm to highlight these things? I have a fresh installation of PyCharm and have all the Inspections enabled in File > Settings > Editor > Inspections > Python.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
Alex Tereshenkov
  • 3,340
  • 8
  • 36
  • 61
  • Did you solve this? I just had a similar problem [not getting warnings about unresolved references](https://stackoverflow.com/q/66721578). – bad_coder Mar 20 '21 at 12:40

2 Answers2

2

See which python interpreter is enabled go to preference > Project > Project Interpreter. Set python interpreter and then apply it. Also check if inspections are enabled.

ZApatel
  • 85
  • 9
1

Go to Settings > Editor > Inspections and select Python, click settings icon and "Restore Defaults" then apply.

Azikdev
  • 11
  • 1
  • 2