ejplatform/ej-server

View on GitHub

Showing 137 of 185 total issues

Function statistics_summary_dataframe has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def statistics_summary_dataframe(
        self,
        normalization=1,
        votes=None,
        comments=None,
Severity: Minor
Found in src/ej_conversations/mixins.py - About 1 hr 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 prepare_dataframe has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def prepare_dataframe(df, id="stats-table", pc=False):
    """
    Renders dataframe in a HTML table.
    """
    if pc is True:
Severity: Minor
Found in src/ej_dataviz/roles.py - About 1 hr 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 registerAllRoutes has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function registerAllRoutes(workbox) {
    log('[sw] Starting service worker');

    // Cache javascript
    workbox.routing.registerRoute(
Severity: Minor
Found in src/ej/templates/jinja2/js/sw.js - About 1 hr to fix

    Function enableFadeBottomDiv has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function enableFadeBottomDiv() {
        $(document).ready(function () {
            var lastScrollTop = 0;
            function hideLowerNav(windowWidth) {
                if (windowWidth <= 550) {
    Severity: Minor
    Found in lib/js/legacy/utils.ts - About 1 hr to fix

      Function registerElementForComponent has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function registerElementForComponent(component, elem) {
          let $elem = $(elem),
              name = $elem.attr('is-element'),
              parts = name.split(':'),
              event = 'click',
      Severity: Minor
      Found in lib/js/components/base.ts - About 1 hr to fix

        Function init has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                init: function(options) {
                    var o = $.extend({
                        items: 1,
                        itemsOnPage: 1,
                        pages: 0,
        Severity: Minor
        Found in lib/assets/js/simplePagination.js - About 1 hr to fix

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

          def create_conversation(
          Severity: Major
          Found in src/ej_conversations/__init__.py - About 1 hr to fix

            Function _appendItem has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    _appendItem: function(pageIndex, opts) {
                        var self = this, options, $link, o = self.data('pagination'), $linkWrapper = $('<li></li>'), $ul = self.find('ul');
            
                        pageIndex = pageIndex < 0 ? 0 : (pageIndex < o.pages ? pageIndex : o.pages - 1);
            
            
            Severity: Minor
            Found in lib/assets/js/simplePagination.js - About 1 hr to fix

              Function fix_profile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def fix_profile(profile, log=lambda *args, **kwargs: None, fix=True):
                  profile_id = profile["id"]
                  email = profile["user__email"]
                  state = profile["state"]
                  gender = profile["gender"]
              Severity: Minor
              Found in src/ej_profiles/management/commands/fixprofiles.py - About 1 hr 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 random_votes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def random_votes(self, users=None, probs=(0.1, 0.15, 0.25)):
                      """
                      Cast random votes for the list of users.
              
                      Args:
              Severity: Minor
              Found in src/ej_conversations/models/conversation_queryset.py - About 1 hr 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 moderate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def moderate(request, conversation_id, slug, board_slug):
                  conversation = Conversation.objects.get(id=conversation_id)
              
                  if request.method == "POST":
                      post_parameters = dict(request.POST)
              Severity: Minor
              Found in src/ej_conversations/views.py - About 1 hr 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 link_kwargs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def link_kwargs(href="#", action=NOT_GIVEN, args=(), **kwargs):
                  kwargs = {
                      "href": _normalize_href(href, kwargs.pop("url_args", None), kwargs.pop("query", None)),
                      "class": _normalize_class(kwargs),
                      "up-instant": kwargs.pop("instant", True),
              Severity: Minor
              Found in src/ej/roles/tags.py - About 1 hr 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 db_fake has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def db_fake(
              Severity: Major
              Found in etc/tasklib/db_tasks.py - About 1 hr to fix

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

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

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

                      def handle(
                  Severity: Major
                  Found in src/ej_users/management/commands/createfakeusers.py - About 1 hr to fix

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

                    def sass(ctx, theme=None, watch=False, background=False, suffix="default", minify=False):
                        """
                        Run Sass compiler
                        """
                    
                    
                    Severity: Minor
                    Found in etc/tasklib/build_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 exec_watch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def exec_watch(path, func, name, watch=False, background=False, poll_time=0.5):
                        path = str(path)
                        if watch and background:
                            go = lambda: watch_path(path, func, name=name, poll_time=poll_time)
                            return exec_watch(path, go, name, background=True)
                    Severity: Minor
                    Found in etc/tasklib/base.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 _patch_conversation_app has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _patch_conversation_app():
                        from ej.components import register_menu
                        from ej_conversations.models import Conversation
                        from django.utils.translation import gettext as _
                        from sidekick import delegate_to, lazy
                    Severity: Minor
                    Found in src/ej_clusters/models/__init__.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 _get_annotations has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _get_annotations(self, kwargs, prefix, user):
                            annotations = {}
                    
                            # First tag
                            if kwargs.pop("first_tag", False):
                    Severity: Minor
                    Found in src/ej_conversations/models/conversation_queryset.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 conversation_can_receive_channel_vote has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def conversation_can_receive_channel_vote(func):
                        """
                        Checks if conversation is allowed to receive votes from a given channel (tool).
                        If  conversation author signature does not have permission, a 403 error is raised.
                        """
                    Severity: Minor
                    Found in src/ej_conversations/decorators.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

                    Severity
                    Category
                    Status
                    Source
                    Language