Passed
Pull Request — master (#15)
by
unknown
02:13
created

LocalizedCharField   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 11
ccs 3
cts 6
cp 0.5
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A formfield() 0 8 1
1 1
from ..forms import LocalizedCharFieldForm
0 ignored issues
show
Bug introduced by
There seems to be a cyclic import (localized_fields.fields -> localized_fields.fields.localized_file_field).

Cyclic imports may cause partly loaded modules to be returned. This might lead to unexpected runtime behavior which is hard to debug.

Loading history...
2 1
from .field import LocalizedField
3 1
from ..value import LocalizedStringValue
4
5
6 1
class LocalizedCharField(LocalizedField):
7 1
    attr_class = LocalizedStringValue
8
9 1
    def formfield(self, **kwargs):
10
        """Gets the form field associated with this field."""
11
        defaults = {
12
            'form_class': LocalizedCharFieldForm
13
        }
14
15
        defaults.update(kwargs)
16
        return super().formfield(**defaults)
0 ignored issues
show
Coding Style introduced by
Usage of * or ** arguments should usually be done with care.

Generally, there is nothing wrong with usage of * or ** arguments. For readability of the code base, we suggest to not over-use these language constructs though.

For more information, we can recommend this blog post from Ned Batchelder including its comments which also touches this aspect.

Loading history...
17