Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

findings not reported until seemingly unrelated code is changed #10113

Open
firewave opened this issue Dec 6, 2024 · 0 comments
Open

findings not reported until seemingly unrelated code is changed #10113

firewave opened this issue Dec 6, 2024 · 0 comments
Labels
Abstract interpretation Complex inference support (control flow, data flow analysis etc.) False Negative 🦋 No message is emitted but something is wrong with the code

Comments

@firewave
Copy link

firewave commented Dec 6, 2024

Bug description

# pylint: disable=missing-module-docstring
import subprocess

def __func():
    comm = None  # disable for warning in f() to appear
    # pylint: disable-next=consider-using-with
    p = subprocess.Popen('')
    try:
        comm = p.communicate(timeout=10)
    except subprocess.TimeoutExpired:
        pass
    stdout, _ = comm  # might be None
    return stdout

# pylint: disable-next=missing-function-docstring
def f():
    s = __func()
    pos = s.find(" ")
    if not pos == -1:  # unnecessary-negation
        pass

No findings are reported for f() although it contains an unnecessary-negation. This is not limited to this warning but any findings in that function.

Configuration

Command used

pylint test.py

Pylint output

no findings reported

Expected behavior

************* Module test
test.py:19:7: C0117: Consider changing "not pos == -1" to "pos != -1" (unnecessary-negation)

I would have also expected a warning about the unpacking of comm potentially not having enough values.

Pylint version

pylint 3.3.1
astroid 3.3.5
Python 3.12.7 (main, Oct  1 2024, 11:15:50) [GCC 14.2.1 20240910]

OS / Environment

Manjaro Linux, bash
Ubuntu 22.04, bash

Additional dependencies

@firewave firewave added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Dec 6, 2024
@zenlyj zenlyj added Abstract interpretation Complex inference support (control flow, data flow analysis etc.) False Negative 🦋 No message is emitted but something is wrong with the code and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Abstract interpretation Complex inference support (control flow, data flow analysis etc.) False Negative 🦋 No message is emitted but something is wrong with the code
Projects
None yet
Development

No branches or pull requests

2 participants