Unnecessary pass¶
ID: py/unnecessary-passKind: problemSecurity severity: Severity: warningPrecision: very-highTags: - quality - maintainability - useless-codeQuery suites: - python-security-and-quality.qls
Click to see the query in the CodeQL repository
Apass statement is only necessary when it is the only statement in a block (the list of statements forming part of a compound statement). This is because the purpose of thepass statement is to allow empty blocks where they would otherwise be syntactically invalid. If the block already contains other statements then thepass statement is unnecessary.
Recommendation¶
Remove thepass statement.
References¶
Python:pass.