tonybaloney / perflint

Python Linter for performance anti patterns
MIT License
666 stars 10 forks source link

Heisenbug Error when using `--reports=yes` flag #41

Open dmaljovec opened 1 year ago

dmaljovec commented 1 year ago

Hi, we have an experimental CI build where we are testing this tool out, and recently I have noticed that it intermittently fails on our codebase with this stack trace:

Executing command: perflint $SRC_DIR --exit-zero --reports=yes > perflint.txt                         
Traceback (most recent call last):                                                                    
  File "/usr/local/bin/perflint", line 5, in <module>                                                 
    from perflint import __main__                                                                     
  File "/usr/local/lib/python3.10/site-packages/perflint/__main__.py", line 26, in <module>           
    PylintRun(args)                                                                                   
  File "/usr/local/lib/python3.10/site-packages/pylint/lint/run.py", line 214, in __init__            
    score_value = linter.generate_reports()                                                           
  File "/usr/local/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 1149, in generate_reports                                                                                                                               
    sect = self.make_reports(self.stats, previous_stats)                                              
  File "/usr/local/lib/python3.10/site-packages/pylint/reporters/reports_handler_mix_in.py", line 76, in make_reports                                                                                                                  
    r_cb(report_sect, stats, old_stats)                                                               
  File "/usr/local/lib/python3.10/site-packages/pylint/checkers/imports.py", line 981, in _report_external_dependencies                                                                                                                
    dep_info = _make_tree_defs(self._external_dependencies_info().items())                            
  File "/usr/local/lib/python3.10/site-packages/pylint/checkers/imports.py", line 179, in _make_tree_defs                                                                                                                              
    node[1] += files                                                                                  
TypeError: 'tuple' object does not support item assignment 

The funny part is with no changes to our underlying code, if I re-trigger the same build on the same state of the code, it will usually pass. Happy to provide further information if I can.