Open tino opened 3 years ago
Oh btw, how does one disable this single rule? I mean there is no way to do #nosemgrep python.django.correctness.nontext-field-must-set-null-true.nontext-field-must-set-null-true
without going over my 88 line-length...
I noticed this also fails for subclassed fields. For example with fields that serialize in some way (json, encryption, etc), this also fails:
class EncryptedField(models.TextField):
# implement en/decryption in .get_prep_value() & .from_db_value
...
class FakeModel(models.Model):
# ok: nontext-field-must-set-null-true
fieldText = EncryptedField(blank=True)
Can we update the rule so it is smart enough to deal with this?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Stale-bot has closed this stale item. Please reopen it if this is in error.
Thanks @ievans. Anything I can do to make this more clear? Or what should I expect in terms of answers here?
Oh btw, how does one disable this single rule? I mean there is no way to do
#nosemgrep python.django.correctness.nontext-field-must-set-null-true.nontext-field-must-set-null-true
without going over my 88 line-length...
There's not currently a way to exclude individual rules... 😅 There is an old issue on the Semgrep repo (here) that you can add your voice to if you feel inclined.
I noticed this also fails for subclassed fields. For example with fields that serialize in some way (json, encryption, etc), this also fails ... Can we update the rule so it is smart enough to deal with this?
We can make a small update, but it will only work if the subclassed field is defined in the same file. Semgrep analysis is limited to single files right now so if the subclass is in a different file, Semgrep won't pick it up.
Describe the bug The
rule:python.django.correctness.nontext-field-must-set-null-true.nontext-field-must-set-null-true
triggers false positives whenmodels
is imported fromdjango.contrib.gis.db
.To Reproduce
output:
Expected behavior Shouldn't fail
Priority How important is this to you?
#nosemgrep
for now :)Version: 0.61.0