| Total Complexity | 1 |
| Total Lines | 10 |
| Duplicated Lines | 100 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | from django.contrib.auth.tokens import default_token_generator |
||
| 9 | View Code Duplication | class ActivationEmail(BaseEmailMessage): |
|
| 10 | template_name = 'email/activation.html' |
||
| 11 | |||
| 12 | def set_context_data(self): |
||
| 13 | super(ActivationEmail, self).set_context_data() |
||
| 14 | |||
| 15 | user = self.context.get('user') |
||
| 16 | self.context['uid'] = utils.encode_uid(user.pk) |
||
| 17 | self.context['token'] = default_token_generator.make_token(user) |
||
| 18 | self.context['url'] = settings.ACTIVATION_URL.format(**self.context) |
||
| 19 | |||
| 35 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.