Issues (463)

testproject/testapp/tests/common.py (25 issues)

1
from django.contrib.auth import get_user_model
0 ignored issues
show
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2
from django.db import IntegrityError
3
4
from djoser.conf import settings as djoser_settings
0 ignored issues
show
The name conf does not seem to exist in module djoser.
Loading history...
Unable to import 'djoser.conf'
Loading history...
5
6
try:
7
    from unittest import mock
8
except ImportError:
9
    import mock
10
11
__all__ = [
12
    "get_user_model",
13
    "IntegrityError",
14
    "mock",
15
    "RunCheck",
16
    "PermCheckClass",
17
    "SerializerCheckClass",
18
]
19
20
Token = djoser_settings.TOKEN_MODEL
0 ignored issues
show
Coding Style Naming introduced by
The name Token does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
21
22
23
def create_user(use_custom_data=False, **kwargs):
0 ignored issues
show
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
24
    data = (
25
        {"username": "john", "password": "secret", "email": "[email protected]"}
26
        if not use_custom_data
27
        else {
28
            "custom_username": "john",
29
            "password": "secret",
30
            "custom_email": "[email protected]",
31
            "custom_required_field": "42",
32
        }
33
    )
34
    data.update(kwargs)
35
    user = get_user_model().objects.create_user(**data)
36
    user.raw_password = data["password"]
37
    return user
38
39
40
def login_user(client, user):
0 ignored issues
show
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
41
    token = Token.objects.create(user=user)
42
    client.credentials(HTTP_AUTHORIZATION="Token " + token.key)
43
44
45
def perform_create_mock(x):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
The argument x seems to be unused.
Loading history...
46
    raise IntegrityError
47
48
49
class RunCheck(Exception):
0 ignored issues
show
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
50
    pass
51
52
53
class PermCheckClass:
0 ignored issues
show
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Old-style class defined.
Loading history...
This class has no __init__ method.
Loading history...
54
    def has_permission(self, *args, **kwargs):
0 ignored issues
show
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
The argument args seems to be unused.
Loading history...
The argument kwargs seems to be unused.
Loading history...
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
55
        raise RunCheck("working")
56
57
    def has_object_permission(self, *args, **kwargs):
0 ignored issues
show
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
The argument args seems to be unused.
Loading history...
The argument kwargs seems to be unused.
Loading history...
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
58
        raise RunCheck("working")
59
60
61
class SerializerCheckClass:
0 ignored issues
show
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Old-style class defined.
Loading history...
62
    def __init__(self, *args, **kwargs):
0 ignored issues
show
The argument args seems to be unused.
Loading history...
The argument kwargs seems to be unused.
Loading history...
63
        raise RunCheck("working")
64