Skip to content

Commit

Permalink
Disable broken semgrep rules
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasjuhrich committed Oct 5, 2024
1 parent dbf56a9 commit 7f0ed4f
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions tools/semgrep.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# run with `pip install semgrep && semgrep --config=tools/semgrep.yml pycroft web`
# …or let `pre-commit` do the heavy lifting for you!
rules:
- id: f-string-in-deferred-gettext
pattern: pycroft.helpers.i18n.deferred_gettext(f"...")
message: Don't use f-strings in `deferred_gettext`
languages: [python]
severity: ERROR
# - id: f-string-in-deferred-gettext
# pattern: pycroft.helpers.i18n.deferred_gettext(f"...")
# message: Don't use f-strings in `deferred_gettext`
# languages: [python]
# severity: ERROR

- id: format-in-deferred-gettext
patterns:
Expand Down Expand Up @@ -41,20 +41,20 @@ rules:
languages: [python]
severity: ERROR

- id: log-event-with-f-string
patterns:
- pattern-either:
- pattern: ("...".format($...ARGS))
- pattern: (f"...")
- pattern-inside: $LOG_FN(...)
- metavariable-regex:
metavariable: $LOG_FN
regex: (pycroft.lib.logging.)?log_.*event
message: |
Don't use $LOG_FN with a pre-formatted string literal.
Replace the message by `deferred_gettext(...).format(...).to_json()`.
languages: [python]
severity: ERROR
# - id: log-event-with-f-string
# patterns:
# - pattern-either:
# - pattern: ("...".format($...ARGS))
# - pattern: (f"...")
# - pattern-inside: $LOG_FN(...)
# - metavariable-regex:
# metavariable: $LOG_FN
# regex: (pycroft.lib.logging.)?log_.*event
# message: |
# Don't use $LOG_FN with a pre-formatted string literal.
# Replace the message by `deferred_gettext(...).format(...).to_json()`.
# languages: [python]
# severity: ERROR

- id: use-format-instead-of-strftime
pattern: $DT.strftime("$FORMAT")
Expand Down

0 comments on commit 7f0ed4f

Please sign in to comment.