NoNameItem/django-magnificent-messages

View on GitHub

Showing 33 of 33 total issues

Function "primary" has 9 parameters, which is greater than the 7 authorized.
Open

def primary(request: HttpRequest,
            text: str,
            subject: str = None,
            extra: object = None,
            to_users_pk: Iterable = tuple(),

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Function "warning" has 9 parameters, which is greater than the 7 authorized.
Open

def warning(request: HttpRequest,
            text: str,
            subject: str = None,
            extra: object = None,
            to_users_pk: Iterable = tuple(),

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Remove this commented out code.
Open

# """

Programmers should not comment out code as it bloats programs and reduces readability.

Unused code should be deleted and can be retrieved from source control history if required.

See

  • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
  • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
  • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
  • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

Function "info" has 9 parameters, which is greater than the 7 authorized.
Open

def info(request: HttpRequest,
         text: str,
         subject: str = None,
         extra: object = None,
         to_users_pk: Iterable = tuple(),

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Function "error" has 9 parameters, which is greater than the 7 authorized.
Open

def error(request: HttpRequest,
          text: str,
          subject: str = None,
          extra: object = None,
          to_users_pk: Iterable = tuple(),

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Function "secondary" has 9 parameters, which is greater than the 7 authorized.
Open

def secondary(request: HttpRequest,
              text: str,
              subject: str = None,
              extra: object = None,
              to_users_pk: Iterable = tuple(),

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Function "success" has 9 parameters, which is greater than the 7 authorized.
Open

def success(request: HttpRequest,
            text: str,
            subject: str = None,
            extra: object = None,
            to_users_pk: Iterable = tuple(),

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Method "__init__" has 8 parameters, which is greater than the 7 authorized.
Open

    def __init__(self, convert_function, fetch_all, object_list, number, paginator, *args, **kwargs):

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Remove this commented out code.
Open

# """

Programmers should not comment out code as it bloats programs and reduces readability.

Unused code should be deleted and can be retrieved from source control history if required.

See

  • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
  • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
  • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
  • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

Remove those useless parentheses.
Open

        unique_together = (

The use of parentheses, even those not required to enforce a desired order of operations, can clarify the intent behind a piece of code. But redundant pairs of parentheses could be misleading, and should be removed.

Noncompliant Code Example

return ((3))        # Noncompliant
return ((x + 1))    # Noncompliant
x = ((y / 2)) + 1   # Noncompliant

Compliant Solution

return 3
return (3)
return x + 1
return (x + 1)
x = y / 2 + 1
x = (y / 2) + 1

Method "send_message" has 10 parameters, which is greater than the 7 authorized.
Open

    def send_message(self,
                     level: int,
                     text: str,
                     subject: str = None,
                     extra: object = None,

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Function "error" has 9 parameters, which is greater than the 7 authorized.
Open

def error(request: HttpRequest,
          text: str,
          subject: str = None,
          extra: object = None,
          to_users_pk: Iterable = tuple(),

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Remove this commented out code.
Open

    # @property

Programmers should not comment out code as it bloats programs and reduces readability.

Unused code should be deleted and can be retrieved from source control history if required.

See

  • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
  • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
  • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
  • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"
Severity
Category
Status
Source
Language