Repository: spyder-ide/spyder

Issue:
Clicking an item in Analyze pane does nothing but return to post-scan initial state
Environment: Xubuntu 20.0.4 up-to-date.
sudo apt update, sudo apt dist-upgrade
I followed the checklist!
Also, I deleted the pip cache and reinstalled spyder and all of its dependencies.

## Problem Description
After analysis has completed, the Analyze pane shows the results correctly.  But, it seems non-functional / buggy in terms of the mouse interface.

### What steps reproduce the problem?
1. Press F8.
2. Click on any item in the Analyze output list.

### What is the expected output?
Analyze pane: The pane contents would stay as-is in terms of opened categories with the selected item highlighted.
Source pane: The referenced source line would get focus and be highlighted.

### What do you see instead?
Analyze pane: All of the categories (Convention, Refactor, Warning, and Error) are closed (returned to initial post-scan state?).  The Analyze pane is still usable by reopening any of the categories.
Source pane: Nothing is selected in the source pane.

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 4.1.4
* Python version: 3.8.2 64-bit 
* Qt version: 5.12.9
* PyQt version: 5.12.3
* Operating System name/version: Xubuntu 20.0.4 up-to-date

### Dependencies
```
# Mandatory:
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.5.0 (OK)
diff_match_patch >=20181111    :  20200713 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.16.1 (OK)
jedi =0.17.1                   :  0.17.1 (OK)
keyring                        :  None (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  1.1.0 (OK)
parso =0.7.0                   :  0.7.0 (OK)
pexpect >=4.4.0                :  4.6.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.5.1 (OK)
pygments >=2.0                 :  2.3.1 (OK)
pylint >=1.0                   :  2.5.3 (OK)
pyls >=0.34.0;<1.0.0           :  0.34.1 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  0.7.2 (OK)
qtconsole >=4.6.0              :  4.7.5 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
sphinx >=0.6.6                 :  3.1.2 (OK)
spyder_kernels >=1.9.2;<1.10.0 :  1.9.2 (OK)
watchdog                       :  None (OK)
xdg >=0.26                     :  None (OK)
zmq >=17                       :  18.1.1 (OK)

# Optional:
cython >=0.21                  :  0.29.21 (OK)
matplotlib >=2.0.0             :  3.3.0 (OK)
numpy >=1.7                    :  1.19.0 (OK)
pandas >=0.13.1                :  1.0.5 (OK)
scipy >=0.17.0                 :  1.4.1 (OK)
sympy >=0.7.3                  :  1.6.1 (OK)
```



Discussion:
Actually, any mouse click in any pane closes the opened categories in the Analyze pane.
Hi @texadactyl,
Thanks for reporting, I can reproduce this issue. We will work on fixing this for our next release!
@steff456 Can you recommend the last stable version before 4.1.4?  I need this feature while reviewing VERY UGLY project code.

You can try in older versions of Spyder 4, I'm not sure when this feature started to fail.
I was hoping for a precise version number.  Anyone nearby you using an older Spyder version or is everyone using 4.1.4?
@ccordoba12 please take a look at this one :)
Fell back to 4.0.1.
No worries.
@texadactyl thanks for your help and diligence troubleshooting and reporting this issue, and sorry no one else answered your repeated question. This behavior appears to be a side effect of a number of recent improvements to the Code Analsyis for 4.1.4, so downgrading to 4.1.3 for now should resolve it. I use Code Analysis extensively in that version and previous, and have never run into this issue prior to the 4.1.4 changes, so hopefully the same will be true for you. Thanks!

@steff456 @juanis2112 @ccordoba12 We ran into this while we were testing your PRs together, but IIRC either we weren't able to reliably reproduce it, or @ccordoba12 mentioned he was able to and knew how to fix it. Lmk if I can help with testing, etc.
and fell forward to 4.1.3!  (=:

If you want a guinea pig for a testing branch, let me know.
@CAM-Gerlach  Hey its all good.  I'm a developer too and have been on the perpetrator side and the victim side of bugs for decades.  It's all part of the excitement.
Hahaha yeah, it certainly gives some some perspective working both! Even as a Spyder developer but also a heavy Spyder user I see both sides of it, heh.

> If you want a guinea pig for a testing branch, let me know.

We'd be happy to have your help! @steff456 @ccordoba12 make sure you tag both of us on the PR, as I'd like to do the same. Thanks!
As a *tester*, yes.  I am up to my eyeballs in SETI development projects.

On Wed, Jul 22, 2020 at 4:11 PM CAM Gerlach <notifications@github.com>
wrote:

> Hahaha yeah, it certainly gives some some perspective working both! Even
> as a Spyder developer but also a heavy Spyder user I see both sides of it,
> heh.
>
> If you want a guinea pig for a testing branch, let me know.
>
> We'd be happy to have your help! @steff456 <https://github.com/steff456>
> @ccordoba12 <https://github.com/ccordoba12> make sure you tag both of us
> on the PR, as I'd like to do the same. Thanks!
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/spyder-ide/spyder/issues/13347#issuecomment-662698689>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ACWLLZFZMCEIJOAY3RZZ2NDR45IXHANCNFSM4PDW5A3Q>
> .
>

@texadactyl Yep, that's the plan.

Sounds like some really cool work you're doing, by the way!
Tried Spyder 4.1.5.  This problem still exists.  Fell back to 4.1.3.

@steff456 @ccordoba12 - What is your experience?

Resolving patch:
diff --git a/spyder/plugins/pylint/widgets/pylintgui.py b/spyder/plugins/pylint/widgets/pylintgui.py
--- a/spyder/plugins/pylint/widgets/pylintgui.py
+++ b/spyder/plugins/pylint/widgets/pylintgui.py
@@ -265,6 +265,13 @@ def get_filename(self):
     def set_filename(self, filename):
         """Set filename without performing code analysis."""
         filename = to_text_string(filename)  # filename is a QString instance
+
+        # Don't try to reload saved analysis for filename, if filename
+        # is the one currently displayed.
+        # Fixes spyder-ide/spyder#13347
+        if self.get_filename() == filename:
+            return
+
         self.kill_if_running()
         index, _data = self.get_data(filename)
         is_parent = self.parent is not None


Test patch: