Sonar reporting blocker issue post upgrade

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension) - 25.6.0.109173
  • how is SonarQube deployed: zip, Docker, Helm - zip
  • what are you trying to achieve: Find issues in python application.
  • what have you tried so far to achieve this - False Positives appearning in sonar report

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

We recently upgraded to 25.6.0.109173, and after running the first scan on the new version, Sonar started reporting the following issue as a blocker. This is surprising because the calling function is invoking a helper function located in the same directory, but the reported path of the called function points to a different directory. Could you please help us understand this?

Calling function path - advertisement_masterworks_sync/main.py

helper.create_response(
            True,
            200,
            message,
            "",
        formatted_new_projects_data_for_advertisement_projects,**
     )

Called function path - app/backend/utils/helper.py

def create_response(success: bool, status_code: int, message=None, errors=None):

# Remove 1 unexpected arguments; 'create_response' expects at most 4 positional arguments.

The number and name of arguments passed to a function should match its parameterspython:S930 

Hi @seenunandagiri,

Thank you for reaching out.

Before I try to reproduce the issue I just wanted to clarify some things to not make any assumptions. This would help narrowing down the issue more easily.

So you have a helper method called create_response in: advertisement_masterworks_sync/<helper_module>.py and this method has 5 or more arguments. Is that correct?

Also could I ask how do you import the helper module?
And also to make sure, is there an __init__.py file in the advertisement_masterworks_sync folder?

Thank you again for your feedback we really appreciate it!

By the way, our Product Manager would love to speak to you about any other feedback you have with us. Would you have 30 minutes to spare? We’d really appreciate it. If so, you can find a time that works for you on this calendar.

Cheers,

David

Thank you David for your response.

So you have a helper method called create_response in: advertisement_masterworks_sync/<helper_module>.py and this method has 5 or more arguments. Is that correct?

advertisement_masterworks_sync/main.py - 5 parameters

return helper.create_response(
    True,
    200,
    message,
    "",
    formatted_new_projects_data_for_advertisement_projects,
)

Expected calling Helper file --advertisement_masterworks_sync/utils/helper.py - 5 parameters

def create_response(
    success: bool, status_code: int, message=None, errors=None, data=None
):

Actual calling Helper file –
app/backend/utils/helper.py - 4 parameters

def create_response(success: bool, status_code: int, message=None, errors=None):

Also could I ask how do you import the helper module?

import utils.helper as helper – Imported helper file using import statement

And also to make sure, is there an __init__.py file in the advertisement_masterworks_sync folder?

NO __init__.py statement in any of the files

Make a note that this false postivie not shown in earlier version 9.9, started appearning post upgrade to 25.6

Hi @seenunandagiri,
Thanks for the response.

I was able to reproduce your error but only if there is a __init__.py file in app/backend/utils.
The analyzer at the moment requires an __init__.py file in every folder to properly construct the fully qualified name of a module. If there is no __init__.py file, the FQN is truncated to just the name of the file (e.g. app/backend/utils/helper.py gets the FQN helper instead of app.backend.utils.helper).

There already exists a ticket for this bug in our internal Jira. Unfortunately, fixing this is not as trivial as it may sound.

Best,
Sebastian