UNPKG

mcp-server-semgrep

Version:

MCP Server for Semgrep Integration - static code analysis with AI

35 lines (34 loc) 953 B
rules: - id: list-modify-while-iterate message: >- It appears that `$LIST` is a list that is being modified while in a for loop. This will likely cause a runtime error or an infinite loop. languages: [python] severity: ERROR pattern-either: - pattern: | for $ELEMENT in $LIST: ... $LIST.pop(...) - pattern: | for $ELEMENT in $LIST: ... $LIST.push(...) - pattern: | for $ELEMENT in $LIST: ... $LIST.append(...) - pattern: | for $ELEMENT in $LIST: ... $LIST.extend(...) - pattern: | for $ELEMENT in $LIST: ... $LIST.remove(...) metadata: category: correctness technology: - python references: - https://unspecified.wordpress.com/2009/02/12/thou-shalt-not-modify-a-list-during-iteration/