Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

lint: Prohibit percent formatting on literal format strings.

Anders Kaseorg769e198ab006
diff --git a/tools/semgrep.yml b/tools/semgrep.yml
index fbe63de40f1..5f4d2eafd80 100644
--- a/tools/semgrep.yml
+++ b/tools/semgrep.yml
@@ -116,3 +116,11 @@ rules:
...
severity: ERROR
message: "Guard mutable default with read-only type (Sequence, Mapping, AbstractSet)"
+
+ - id: percent-formatting
+ languages: [python]
+ pattern-either:
+ - pattern: '"..." % ...'
+ - pattern: '("...") % ...'
+ severity: ERROR
+ message: "Prefer f-strings or .format for string formatting"