Redundant default arguments

Stating defaults add complexity when reading the code but does not change Django's behaviour.

Python allows function arguments to have default values. The default value is used when the function is called without the argument.

Redundant default arguments are explicitly passing in default values when calling a function.

Redundant default arguments are noise. They don't add value but do add maintenance overhead. The code will execute the same without specifying them. Reduce the amount of code that needs to be read and maintained by deleting redundant default arguments.

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

django-doctorbotsuggested changes just now
models.py
1
+
class CommentModel(models.Model):
2
+
    body = models.TextField(null=False,editable=True)
Suggested changes
-
    body = models.TextField(null=False,editable=True)
+
    body = models.TextField()
Commit suggestion

Stating defaults add complexity when reading the code but does not change Django's behaviour.

Read more
3
+
    date = models.DateField()
Update models.py
We're your Django code review copilot. Get code improvements right in your pull request with our GitHub code review bot.

Configuring this check

Code Review Doctor will run this check by default. No configuration is needed but the check can be turned on/off using check code redundant-default-args in your pyproject.toml file.

Read more about configuring Code Review Doctor.