'Error during SonarScanner execution java.lang.StackOverflowError' for Bitbucket Pipeline

I am getting the following error : Error during SonarScanner execution java.lang.StackOverflowError when I configured a bitbucket pipeline to deploy a python code to sonarcloud I am aware there are similar questions in this forum regarding this issue but I am unable to pinpoint my error .

image: python:3.8 
options:
  docker: true
  size: 2x
clone:
  depth: full 
definitions:
  services:
    docker:
      memory: 4096
  caches:
    sonar: ~/.sonar/cache 
  steps:
    - step: &build-test-sonarcloud
        name: Build, test and analyze on SonarCloud
        caches:
          - pip 
          - sonar
        script:
          #- python3 -m unittest discover 
          - pipe: sonarsource/sonarcloud-scan:1.2.0

    - step: &check-quality-gate-sonarcloud
        name: Check the Quality Gate on SonarCloud
        script:
          - pipe: sonarsource/sonarcloud-quality-gate:0.1.4

pipelines: 
  branches:
    feature/*:
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud
    master:
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud

  pull-requests:
    "**":
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud

The pipeline logs for the above pipeline is here pipelineLog-2.txt (73.5 KB)

Hi @Ali_Hussaini ,

we are aware of this bug in the Python analyzer: https://jira.sonarsource.com/browse/SONARPY-799
This may happen because the analyzer wrongly believes that there is a loop in class inheritance.

We plan to provide a fix in the next release of SonarPython (v3.2), which is expected to be delivered in SonarCloud in the middle of January.

In the meanwhile, as a workaround, you may try to find if there is a python file containing a class which inherits from itself, like:

class MyClass(MyClass): ...

If that’s the case, you may exclude that file from analysis.

Thanks excluding those files helped !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.