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]
|
||||
patterns:
|
||||
- pattern-either:
|
||||
- pattern: logging.$Y(... .format(...))
|
||||
- pattern: logging.$Y(f"...")
|
||||
- pattern: logger.$Y(... .format(...))
|
||||
- pattern: logger.$Y(f"...")
|
||||
- pattern-where-python: "vars['$Y'] in ['debug', 'info', 'warning', 'error', 'critical', 'exception']"
|
||||
- pattern: $LOGGER.debug($FORMATTED)
|
||||
- pattern: $LOGGER.info($FORMATTED)
|
||||
- pattern: $LOGGER.warning($FORMATTED)
|
||||
- pattern: $LOGGER.error($FORMATTED)
|
||||
- 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
|
||||
message: "Pass format arguments to logging (https://docs.python.org/3/howto/logging.html#optimization)"
|
||||
|
||||
|
|
Loading…
Reference in New Issue