mcp-server-semgrep
Version:
MCP Server for Semgrep Integration - static code analysis with AI
193 lines (192 loc) • 6.89 kB
YAML
rules:
- id: python37-compatibility-importlib
pattern: importlib.source_hash()
message:
source_hash' is only available on Python 3.7+. This does not work in lower versions, and therefore is not backwards
compatible. Instead, use another hash function.
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python
- id: python37-compatibility-importlib2
pattern: import importlib.resources
message:
Found 'importlib.resources', which is a module only available on Python 3.7+. This does not work in lower versions,
and therefore is not backwards compatible. Use importlib_resources instead for older Python versions.
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python
- id: python37-compatibility-httpconn
pattern: http.client.HTTPConnection(blocksize=$X,...)
message:
Found usage of the 'blocksize' argument in a HTTPConnection call. This is only available on Python 3.7+ and is
therefore not backwards compatible. Remove this in order for this code to work in Python 3.6 and below.
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python
- id: python37-compatibility-httpsconn
pattern: http.client.HTTPSConnection(blocksize=$X,...)
message:
Found usage of the 'blocksize' argument in a HTTPSConnection call. This is only available on Python 3.7+ and is
therefore not backwards compatible. Remove this in order for this code to work in Python 3.6 and below.
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python
- id: python37-compatibility-importlib3
pattern: import importlib.abc.ResourceReader
message:
Found usage of 'importlib.abc.ResourceReader'. This module is only available on Python 3.7+ and is therefore not
backwards compatible. Instead, use another loader.
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python
- id: python37-compatibility-textiowrapper
pattern: TextIOWrapper.reconfigure(...)
message:
Found usage of 'importlib.abc.ResourceReader'. This module is only available on Python 3.7+ and is therefore not
backwards compatible. Instead, use another loader.
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python
- id: python37-compatibility-ipv6network1
pattern: ipaddress.IPv6Network.subnet_of($X)
message:
IPv6Network.subnet_of is only available on Python 3.7+ and is therefore not backwards compatible. Instead, check
if the subnet is in 'subnets'.
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python
- id: python37-compatibility-ipv6network2
pattern: ipaddress.IPv6Network.supernet_of($X)
message:
IPv6Network.supernet_of is only available on Python 3.7+ and is therefore not backwards compatible. Instead, check
if the supernet is in 'supernet'.
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python
- id: python37-compatibility-ipv4network1
pattern: ipaddress.IPv4Network.subnet_of($X)
message:
IPv4Network.subnet_of is only available on Python 3.7+ and is therefore not backwards compatible. Instead, check
if the subnet is in 'subnets'.
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python
- id: python37-compatibility-ipv4network2
pattern: ipaddress.IPv4Network.supernet_of($X)
message:
IPv4Network.supernet_of is only available on Python 3.7+ and is therefore not backwards compatible. Instead, check
if the supernet is in 'supernet'.
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python
- id: python37-compatibility-locale1
pattern: locale.format_string(monetary=$X, ...)
message:
Found usage of the 'monetary' argument in a function call of 'locale.format_string'. This is only available on
Python 3.7+ and is therefore not backwards compatible. Instead, remove the 'monetary' argument.
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python
- id: python37-compatibility-math1
pattern: math.remainder($X, $Y)
message:
math.remainder is only available on Python 3.7+ and is therefore not backwards compatible. Instead, use math.fmod()
or calculate $X - n* $Y.
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python
- id: python37-compatibility-multiprocess1
pattern: multiprocessing.Process.close()
message:
multiprocessing.Process.close() is only available on Python 3.7+ and is therefore not backwards compatible. Instead,
use join().
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python
- id: python37-compatibility-multiprocess2
pattern: multiprocessing.Process.kill()
message:
multiprocessing.Process.kill() is only available on Python 3.7+ and is therefore not backwards compatible. Instead,
use terminate().
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python
- id: python37-compatibility-os1
pattern: os.preadv(...)
message:
os.preadv() is only available on Python 3.7+ and is therefore not backwards compatible. Instead, use a combination
of os.readv() and os.pread().
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python
- id: python37-compatibility-os2-ok2
patterns:
- pattern-not-inside: |
if hasattr(os, 'pwritev'):
...
- pattern: os.pwritev(...)
message:
os.pwritev() is only available on Python 3.3+ and is therefore not backwards compatible. Instead, use a combination
of pwrite() and writev().
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python
- id: python37-compatibility-pdb
pattern: pdb.set_trace(header=$X, ...)
message:
pdb.set_trace() with the header argument is only available on Python 3.7+ and is therefore not backwards compatible.
Instead, use set_trace() without the header argument.
languages: [python]
severity: ERROR
metadata:
category: compatibility
technology:
- python