No warning at undefined variables in PyCharm Community 2017.2 [duplicate]
Asked Answered
O

2

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.

Oliana answered 5/10, 2017 at 10:2 Comment(1)
Did you solve this? I just had a similar problem not getting warnings about unresolved references.Hastie
W
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.

Winstonwinstonn answered 14/11, 2017 at 11:48 Comment(1)
Both of those things are set, but I still have the issue.Ariella
H
2

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

Heyday answered 14/12, 2021 at 11:35 Comment(1)
This removes any custom changes you've made. It also doesn't help if this setting was already turned on.Osmund

© 2022 - 2024 — McMap. All rights reserved.