rosedu/wouso

View on GitHub

Showing 551 of 2,707 total issues

Consider simplifying this complex logical expression.
Open

                        if ( forward && useCache ) {
                            // Seek `elem` from a previously-cached index
                            outerCache = parent[ expando ] || (parent[ expando ] = {});
                            cache = outerCache[ type ] || [];
                            nodeIndex = cache[0] === dirruns && cache[1];
Severity: Critical
Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 2 hrs to fix

    File views.py has 261 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import datetime
    import logging
    from django.conf import settings
    from django.contrib.auth import authenticate, login, logout
    from django.contrib.auth.models import User
    Severity: Minor
    Found in wouso/interface/views.py - About 2 hrs to fix

      Function add has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

              add: function(element, interval, label, fn, times, belay) {
                  var counter = 0;
                  
                  if (jQuery.isFunction(label)) {
                      if (!times) 
      Severity: Minor
      Found in wouso/resources/static/js/jquery.timers.js - About 2 hrs 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 karma_group_view has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def karma_group_view(request, id):
          group = get_object_or_404(PlayerGroup, pk=id)
          players = group.players.all()
      
          if request.method == 'POST':
      Severity: Minor
      Found in wouso/interface/cpanel/views.py - About 2 hrs 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 grandchalls_round has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def grandchalls_round(request):
          """ Play a round """
          # TODO: move logic to models.
          """ regular round """
          over = 0
      Severity: Minor
      Found in wouso/games/grandchallenge/cpanel_views.py - About 2 hrs 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 artifact has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def artifact(artifact):
          if not artifact:
              return '(no artifact)'
      
          if isinstance(artifact, PlayerArtifactAmount):
      Severity: Minor
      Found in wouso/core/magic/templatetags/artifacts.py - About 2 hrs 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 ajaxConvert has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function ajaxConvert( s, response, jqXHR, isSuccess ) {
          var conv2, current, conv, tmp, prev,
              converters = {},
              // Work with a copy of dataTypes in case we need to modify it for conversion
              dataTypes = s.dataTypes.slice();
      Severity: Major
      Found in wouso/resources/static/js/jquery.js - About 2 hrs to fix

        Function ajaxConvert has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function ajaxConvert( s, response, jqXHR, isSuccess ) {
            var conv2, current, conv, tmp, prev,
                converters = {},
                // Work with a copy of dataTypes in case we need to modify it for conversion
                dataTypes = s.dataTypes.slice();
        Severity: Major
        Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 2 hrs to fix

          Function qpool_home has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          def qpool_home(request, cat='qotd', page=u'1', tag=None):
              categories = Category.objects.all()
          
              qs = get_questions_with_category(str(cat), active_only=False,
                                               endorsed_only=False)
          Severity: Minor
          Found in wouso/interface/cpanel/views.py - About 2 hrs 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 artifact_edit has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          def artifact_edit(request, id=None):
              if id is not None:
                  instance = get_object_or_404(Artifact, pk=id)
              else:
                  instance = None
          Severity: Minor
          Found in wouso/interface/cpanel/views.py - About 2 hrs 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 has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            Tooltip.prototype.show = function () {
              var e = $.Event('show.bs.' + this.type)
          
              if (this.hasContent() && this.enabled) {
                this.$element.trigger(e)
          Severity: Major
          Found in wouso/resources/static/js/bootstrap.js - About 2 hrs to fix

            Function remove has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                remove: function( elem, types, handler, selector, mappedTypes ) {
                    var j, handleObj, tmp,
                        origCount, t, events,
                        special, handlers, type,
                        namespaces, origType,
            Severity: Major
            Found in wouso/resources/static/js/jquery.js - About 2 hrs to fix

              Function remove has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  remove: function( elem, types, handler, selector, mappedTypes ) {
                      var j, handleObj, tmp,
                          origCount, t, events,
                          special, handlers, type,
                          namespaces, origType,
              Severity: Major
              Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 2 hrs to fix

                Consider simplifying this complex logical expression.
                Open

                                if ( ( mappedTypes || origType === handleObj.origType ) &&
                                    ( !handler || handler.guid === handleObj.guid ) &&
                                    ( !tmp || tmp.test( handleObj.namespace ) ) &&
                                    ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
                                    handlers.splice( j, 1 );
                Severity: Critical
                Found in wouso/resources/static/js/jquery.js - About 2 hrs to fix

                  Consider simplifying this complex logical expression.
                  Open

                                  if ( ( mappedTypes || origType === handleObj.origType ) &&
                                      ( !handler || handler.guid === handleObj.guid ) &&
                                      ( !tmp || tmp.test( handleObj.namespace ) ) &&
                                      ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
                                      handlers.splice( j, 1 );
                  Severity: Critical
                  Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 2 hrs to fix

                    Function test_grading has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def test_grading(self):
                            p1 = self._get_player(1)
                            p2 = self._get_player(2)
                            semig = Semigroup.objects.create(day=datetime.today().day, hour=datetime.today().hour - datetime.today().hour % 2)
                            semig.players.add(p1, p2)
                    Severity: Minor
                    Found in wouso/games/workshop/tests.py - About 2 hrs to fix

                      Function slide has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        Carousel.prototype.slide = function (type, next) {
                          var $active   = this.$element.find('.item.active')
                          var $next     = next || $active[type]()
                          var isCycling = this.interval
                          var direction = type == 'next' ? 'left' : 'right'
                      Severity: Minor
                      Found in wouso/resources/static/js/bootstrap.js - About 1 hr to fix

                        Function internalRemoveData has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function internalRemoveData( elem, name, pvt ) {
                            if ( !jQuery.acceptData( elem ) ) {
                                return;
                            }
                        
                        
                        Severity: Minor
                        Found in wouso/resources/static/js/jquery.js - About 1 hr to fix

                          Function internalRemoveData has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function internalRemoveData( elem, name, pvt ) {
                              if ( !jQuery.acceptData( elem ) ) {
                                  return;
                              }
                          
                          
                          Severity: Minor
                          Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

                            Function add has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def add(question, answers, category=None, tags=None, file_tags=None):
                                ''' question is a dict with the following keys: text, endorsed_by, answer_type
                                [, proposed_by, active, type, code]
                                answers is a list of dicts with the following keys: text, correct [, explanation]
                                '''
                            Severity: Minor
                            Found in wouso/utils/import_questions.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

                            Severity
                            Category
                            Status
                            Source
                            Language