ejplatform/ej-conversations

View on GitHub

Showing 4 of 6 total issues

Function create_comment has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def create_comment(self, author, content, commit=True, *, status=None,
Severity: Major
Found in src/ej_conversations/models/conversation.py - About 1 hr to fix

    Function create_conversation has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def create_conversation(self, question, title, author, *, commit=True, **kwargs):
    Severity: Major
    Found in src/ej_conversations/models/category.py - About 50 mins to fix

      Function conversation_detail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def conversation_detail(request, slug, category_slug):
          conversation = get_object_or_404(models.Conversation, slug=slug)
          if conversation.category.slug != category_slug:
              raise Http404
          comment = conversation.get_next_comment(request.user, None)
      Severity: Minor
      Found in src/ej_conversations/routes.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function set_limits has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_limits(self, limits=None, commit=True, **kwargs):
              """
              Sets the limit object for conversation.
      
              It accepts a simple :cls:`Limits` object, its name as a string or a
      Severity: Minor
      Found in src/ej_conversations/models/conversation.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Severity
      Category
      Status
      Source
      Language