X Tutup
The Wayback Machine - https://web.archive.org/web/20260114000257/https://github.com/github/codeql/issues/6457
Skip to content

LGTM.com - false positive (captured variable) #6457

@theasianpianist

Description

@theasianpianist

Description of the false positive

A variable is defined inside a function, and later used/access from a nested function as follows:

def manage_dvs(request) -> str:
	...
	curr_fake_platform = None
	...
	def update_dvs(log_path, new_fake_platform=None):
		...
		nonlocal curr_fake_platform
		if new_fake_platform != curr_fake_platform:
		...

The curr_fake_platform incorrectly triggers an unused variable alert

URL to the alert on the project page on LGTM.com
https://lgtm.com/projects/g/Azure/sonic-swss/snapshot/b5ac9505d8ac0a7830488d825aae7e616480cc86/files/tests/conftest.py?sort=name&dir=ASC&mode=heatmap#xd660241c258f5ae6:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup