Movatterモバイル変換


[0]ホーム

URL:


CodeQL documentation
CodeQL resources

Redundant assignment

ID: py/redundant-assignmentKind: problemSecurity severity: Severity: errorPrecision: very-highTags:   - quality   - reliability   - correctness   - external/cwe/cwe-563Query suites:   - python-security-and-quality.qls

Click to see the query in the CodeQL repository

Assigning a variable to itself is redundant and often an indication of a mistake in the code.

Recommendation

Check the assignment carefully for mistakes. If the assignment is truly redundant and not simply incorrect then remove it.

Example

In this example the programmer clearly intends to assign toself.eggs but made a mistake.

classSpam:def__init__(self,eggs):eggs=eggs

References


[8]ページ先頭

©2009-2025 Movatter.jp