False positive `display` shadows a builtin

version: Enterprise EditionVersion 9.4 (build 54424)

A python:S5806 is raised on the following. It claims that display is a builtin, but it isn’t and afaik it wasn’t in Python 2.7 either. Perhaps it means to say that display is being overwritten from the input argument?

we have sonar.python.version=3.10 in our sonar-project.properties.

Hey there.

Make sure to read this post before raising a thread here:

Specifically, we need a full code snippet, not a screenshot of code.

Forgive me, I realize my post is not helpful in reproducing the issue!

Here is an MRE:

def simple_assign():
    display = "hello there"
    return display

I checked the two links at the bottom of “Why is this an issue?” and could not find any display.

See

Hello @spagh-eddie,

Thank you for reporting this. I believe the reason for this is that display is actually a built-in in IPython and that the original implementation of the rule aims to avoid problems should you execute your code in this context.

I agree it doesn’t make sense to have this behavior by default, though. I created the following ticket to fix it.

Cheers,
Guillaume

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