UNPKG

mcp-server-semgrep

Version:

MCP Server for Semgrep Integration - static code analysis with AI

38 lines (37 loc) 1.15 kB
rules: - id: avoid-sosl-in-loops min-version: 1.44.0 severity: ERROR languages: - generic metadata: category: performance references: - https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm technology: - salesforce message: >- Database class methods, DML operations, SOQL queries, SOSL queries, Approval class methods, Email sending, async scheduling or queueing within loops can cause governor limit exceptions. Instead, try to batch up the data into a list and invoke the operation once on that list of data outside the loop. patterns: - pattern-either: - pattern-inside: | for (...) { ... } - pattern-inside: | while (...) { ... } - pattern-inside: | do { ... } while (...); - pattern-either: - pattern: | $OBJECTS = ... Search.query(...) - pattern: | $OBJECTS = ... [FIND...IN ALL FIELDS RETURNING...]