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.

semgrep: Lint unnecessary type=str in argparse.

Alex Vandiver75c0f0286f14
diff --git a/tools/semgrep-py.yml b/tools/semgrep-py.yml
index 4bd0d135c1f..65ed91791bb 100644
--- a/tools/semgrep-py.yml
+++ b/tools/semgrep-py.yml
@@ -379,3 +379,15 @@ rules:
- pattern: urllib.parse.ParseResult
severity: ERROR
message: "Use urlsplit rather than urlparse"
+
+ - id: argparse-redundant-str
+ patterns:
+ - pattern: |
+ ....add_argument(..., type=str, ...)
+ message: |
+ The `type=str` argument is redundant in `argparse` because `str` is the default type.
+ fix-regex:
+ regex: ',\s*type=str'
+ replacement: ""
+ languages: [python]
+ severity: ERROR