These are chat archives for spyder-ide/public

1st
May 2019
Massimo Pinto
@massimopinto
May 01 01:13
Hi, I am running Spyder 3.3.4 on both Ubuntu and Mac OSX 10.11.6, and when I load the exact same Python code on both machines I get a rather different set of Code Analysis errors and warnings. These make more sense on my Ubuntu installation of Spyder. Where do I need to look at, to edit the Code Analysis preferences? Thx
CAM Gerlach
@CAM-Gerlach
May 01 02:27

Code Analysis errors and warnings

Not sure if you mean the real-time code analysis, which is powered by pyflakes (and the code style analysis by pycodestyle), or the static code analysis pane (by pylint). Either way, Spyder 3 doesn't directly control what errors and warnings you see (Spyder 4, currently under development, allows you rather extensive configuration of this inside its own GUI), other than being able to enable and disable real-time code style analysis under Editor -> Introspection -> Enable real-time code style analysis. Rather, the user or project config files for each of these packages do; you may have them set to show/hide different errors and warnings. Other than that, you may simply have two different versions of one of these on either machine, which would naturally show different errors.

@massimopinto
Massimo Pinto
@massimopinto
May 01 07:57
@CAM-Gerlach thank you for your comment. I need to figure out the difference between real time and static code analysis before I can reply ;-). In any case, I have not familiarised with Spyder yet to the point of modifying any config file. But I will. It's such a cool code editing platform.
CAM Gerlach
@CAM-Gerlach
May 01 13:05

I need to figure out the difference between real time and static code analysis before I can reply

@massimopinto Real time code and style analysis works in the Editor, as you type, and is what causes the little error and warning icons to appear to the left of the line numbers as you type your code. Code analysis (pyflakes) detects syntax errors, undefined variables, etc, while style analysis highlights breaches of the PEP 8 style guide widely adopted for Python programs. Meanwhile, Static code analysis (pylint) is much more detailed and comprehensive than either in analyzing your code, but must be run on demand (Source -> Run Static Code Analysis), and has its own dedicated pane to control it and show its results. A general workflow is using real-time analysis while you're typing to catch basic errors, typos, and style goofs, while running Static Code Anaysis on your code before committing it or merging it to production to detect bad practices, more insidious possible mistakes, and other less obvious issues.

Massimo Pinto
@massimopinto
May 01 16:41
@CAM-Gerlach wonderfully put. So I was definitely referring to Real Time code analysis earlier on. Cheers