mirror of https://github.com/zulip/zulip.git
semgrep: Replace pattern-where-python with metavariable-regex.
pattern-where-python is deprecated and doesn’t work in 0.62.0. This should be faster, too. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
3e78de4ce8
commit
e3a3519913
|
@ -45,11 +45,24 @@ rules:
|
||||||
languages: [python]
|
languages: [python]
|
||||||
patterns:
|
patterns:
|
||||||
- pattern-either:
|
- pattern-either:
|
||||||
- pattern: logging.$Y(... .format(...))
|
- pattern: $LOGGER.debug($FORMATTED)
|
||||||
- pattern: logging.$Y(f"...")
|
- pattern: $LOGGER.info($FORMATTED)
|
||||||
- pattern: logger.$Y(... .format(...))
|
- pattern: $LOGGER.warning($FORMATTED)
|
||||||
- pattern: logger.$Y(f"...")
|
- pattern: $LOGGER.error($FORMATTED)
|
||||||
- pattern-where-python: "vars['$Y'] in ['debug', 'info', 'warning', 'error', 'critical', 'exception']"
|
- pattern: $LOGGER.critical($FORMATTED)
|
||||||
|
- pattern: $LOGGER.exception($FORMATTED)
|
||||||
|
- metavariable-pattern:
|
||||||
|
metavariable: $LOGGER
|
||||||
|
patterns:
|
||||||
|
- pattern-either:
|
||||||
|
- pattern: logging
|
||||||
|
- pattern: logger
|
||||||
|
- metavariable-pattern:
|
||||||
|
metavariable: $FORMATTED
|
||||||
|
patterns:
|
||||||
|
- pattern-either:
|
||||||
|
- pattern: ... .format(...)
|
||||||
|
- pattern: f"..."
|
||||||
severity: ERROR
|
severity: ERROR
|
||||||
message: "Pass format arguments to logging (https://docs.python.org/3/howto/logging.html#optimization)"
|
message: "Pass format arguments to logging (https://docs.python.org/3/howto/logging.html#optimization)"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue