Missing f prefix in f-string

An f-string will not work if the f prefix is missing.

Literal String Interpolation aka f-strings (because of the leading character preceding the string literal) were introduced by PEP 498. Prefix a string with the letter "f" and it’s now an f-string:

String interpolation is meant to be simpler with f-strings. However our research show 10% of repositories have one of these f-string mistakes:

Missing prefix:

bad
good
-
"hello {name}"
+
f"hello {name}"

Prefix was written inside the string:

bad
good
-
"fhello {name}"
+
f"hello {name}"

Concatenated strings uses the prefix on only the first string.

bad
good
-
f"hello {name}" + "do you like {food}?"
+
f"hello {name}" + f"do you like {food}?"

If our GitHub code review bot spots this issue in your pull request it gives this advice:

code-review-doctorbotsuggested changes just now
settings.py
1
+
raise ValidationError('{value} is not allowed')

An f-string will not work if the f prefix is missing.

Read more
Suggested changes
-
raise ValidationError('{value} is not allowed')
+
raise ValidationError(f'{value} is not allowed')
Commit suggestion
Update settings.py

Instantly check if you have this issue for free

    Works with tools you use

    Read about how it works.