UNPKG

mcp-server-semgrep

Version:

MCP Server for Semgrep Integration - static code analysis with AI

55 lines (54 loc) 1.45 kB
rules: - id: state-variable-read-in-a-loop message: Replace state variable reads and writes within loops with local variable reads and writes. metadata: category: performance technology: - solidity references: - https://github.com/devanshbatham/Solidity-Gas-Optimization-Tips#10--replace-state-variable-reads-and-writes-within-loops-with-local-variable-reads-and-writes patterns: - pattern-either: - pattern-inside: | contract $C { ... $TYPE $X = ... ; ... } - pattern-inside: | contract $C { ... $TYPE $X; ... } - pattern-not-inside: | contract $C { ... $TYPE immutable $X; ... } - pattern-not-inside: | contract $C { ... $TYPE immutable $X = ...; ... } - pattern-not-inside: | contract $C { ... $TYPE constant $X = ...; ... } - pattern: $X - pattern-either: - pattern-inside: | for (...) { ... } - pattern-inside: | while (...) { ... } languages: - solidity severity: INFO