ejplatform/ej-server

View on GitHub

Showing 137 of 185 total issues

Function login has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def login(request, redirect_to="/"):
    form = forms.LoginForm(request=request)
    error_msg = _("Invalid email or password")
    next_url = request.GET.get("next", redirect_to)
    fast = request.GET.get("fast", "false") == "true" or "fast" in request.GET
Severity: Minor
Found in src/ej_users/routes.py - About 55 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 show_votes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def show_votes(votes, method="pca", display=True, title=None, labels=None, legend=None, **kwargs):
    """
    Show votes dataset in a 2D plot.
    """

Severity: Minor
Found in src/ej_clusters/math/factories.py - About 55 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 create_stereotype_coords has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def create_stereotype_coords(conversation, table, comments: list, transformer: Callable, kwargs: dict):
    if apps.is_installed("ej_clusters") and getattr(conversation, "clusterization", None):
        from ej_clusters.models import Stereotype

        labels = conversation.clusterization.clusters.all().dataframe("name", index="users")
Severity: Minor
Found in src/ej_dataviz/utils.py - About 55 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 collect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def collect(ctx, theme=None):
    """
    Runs Django's collectstatic command
    """
    theme, root = set_theme(theme)
Severity: Minor
Found in etc/tasklib/django_tasks.py - About 55 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 user_statistics has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def user_statistics(
Severity: Major
Found in src/ej_conversations/math.py - About 50 mins to fix

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

    def comment_statistics(
    Severity: Major
    Found in src/ej_conversations/math.py - About 50 mins to fix

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

      def show_votes(votes, method="pca", display=True, title=None, labels=None, legend=None, **kwargs):
      Severity: Major
      Found in src/ej_clusters/math/factories.py - About 50 mins to fix

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

            def votes_table(
        Severity: Major
        Found in src/ej_clusters/models/cluster_queryset.py - About 50 mins to fix

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

              def statistics_summary_dataframe(
          Severity: Major
          Found in src/ej_conversations/mixins.py - About 50 mins to fix

            Function edit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def edit(request, conversation_id, slug, board_slug, **kwargs):
                conversation = Conversation.objects.get(id=conversation_id)
                board = Board.objects.get(slug=board_slug)
                form = forms.ConversationForm(request=request, instance=conversation)
                can_publish = request.user.has_perm("ej_conversations.can_publish_promoted")
            Severity: Minor
            Found in src/ej_conversations/views.py - About 45 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 conversation_comment_form has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def conversation_comment_form(conversation, request=None, content=None, user=None, form=None, target=None):
            Severity: Minor
            Found in src/ej_conversations/roles/conversations.py - About 45 mins to fix

              Function kmeans_run has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def kmeans_run(data, k: int, max_iter=10, init_centroids=None, distance=None, aggregator=None):
              Severity: Minor
              Found in src/ej_clusters/math/kmeans.py - About 45 mins to fix

                Function queryset_closure has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                def queryset_closure():
                    """
                    Register function that handle rendering of querysets.
                    """
                    registry = {}
                Severity: Minor
                Found in src/ej/roles/utils.py - About 45 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 sass has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def sass(ctx, theme=None, watch=False, background=False, suffix="default", minify=False):
                Severity: Minor
                Found in etc/tasklib/build_tasks.py - About 45 mins to fix

                  Function comment_card has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def comment_card(comment: Comment, request=None, target=None, show_actions=None, message=None, **kwargs):
                  Severity: Minor
                  Found in src/ej_conversations/roles/comments.py - About 45 mins to fix

                    Function save_hook has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def save_hook(self, request, vote):
                            user = request.user
                            author = vote.comment.conversation.author
                            user_signature = SignatureFactory.get_user_signature(author)
                            create_mautic_contact_from_author(request, vote)
                    Severity: Minor
                    Found in src/ej_conversations/serializers.py - About 45 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 exec_watch has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def exec_watch(path, func, name, watch=False, background=False, poll_time=0.5):
                    Severity: Minor
                    Found in etc/tasklib/base.py - About 45 mins to fix

                      Function cluster_shapes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def cluster_shapes(clusterization, clusters=None, user=None):
                          """
                          Return a list of cluster shapes from given clusterization object.
                      
                          Args:
                      Severity: Minor
                      Found in src/ej_clusters/utils.py - About 45 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 js has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def js(ctx, watch=False, minify=False):
                          """
                          Build js assets
                          """
                          build_cmd = "npm run watch" if watch else "npm run build"
                      Severity: Minor
                      Found in etc/tasklib/build_tasks.py - About 45 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 conversation_download_data has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def conversation_download_data(conversation, *, which, formats=None, cluster=None, **url_kwargs):
                      Severity: Minor
                      Found in src/ej_dataviz/roles.py - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language