rosedu/wouso

View on GitHub

Showing 2,707 of 2,707 total issues

Identical blocks of code found in 3 locations. Consider refactoring.
Open

        def clean(self):
            password1 = self.cleaned_data.get('password')
            password2 = self.cleaned_data.get('confirm_password')
            if password1 != password2:
                raise forms.ValidationError("Passwords don't match")
Severity: Major
Found in wouso/interface/cpanel/forms.py and 2 other locations - About 2 hrs to fix
wouso/interface/cpanel/forms.py on lines 271..276
wouso/interface/cpanel/forms.py on lines 329..334

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if race_id:
            try:
                race = Race.objects.get(pk=race_id)
            except Race.DoesNotExist:
                return rc.NOT_FOUND
Severity: Major
Found in wouso/interface/api/handlers.py and 1 other location - About 2 hrs to fix
wouso/interface/api/handlers.py on lines 443..450

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function superMatcher has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        superMatcher = function( seed, context, xml, results, outermost ) {
            var elem, j, matcher,
                matchedCount = 0,
                i = "0",
                unmatched = seed && [],
Severity: Major
Found in wouso/resources/static/js/jquery.js - About 2 hrs to fix

    Function superMatcher has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            superMatcher = function( seed, context, xml, results, outermost ) {
                var elem, j, matcher,
                    matchedCount = 0,
                    i = "0",
                    unmatched = seed && [],
    Severity: Major
    Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 2 hrs to fix

      Function login_view has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def login_view(request):
          # TODO: rethink and rewrite
          next = request.GET.get('next', '')
          if request.method != 'POST':
              form = AuthenticationForm(request)
      Severity: Minor
      Found in wouso/interface/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 context has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def context(request):
          """ Make all configuration settings available as config_name
          and also define some game context
          """
          settings_dict = {}
      Severity: Minor
      Found in wouso/interface/context_processors.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 can_cast has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def can_cast(self, spell, source, destination):
              """ Check if destination can receive spell from source
      
              Return: a tuple of (can_cast, error_message)
              """
      Severity: Minor
      Found in wouso/core/god/god.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 force_round_close has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def force_round_close(cls, round):
              """
               Finish every challenge in the round
              """
              for c in round.challenges():
      Severity: Minor
      Found in wouso/games/grandchallenge/models.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 init has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          init = jQuery.fn.init = function( selector, context ) {
              var match, elem;
      
              // HANDLE: $(""), $(null), $(undefined), $(false)
              if ( !selector ) {
      Severity: Major
      Found in wouso/resources/static/js/jquery.js - About 2 hrs to fix

        Function send has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                        send: function( headers, complete ) {
                            var i,
                                xhr = options.xhr(),
                                id = ++xhrId;
        
        
        Severity: Major
        Found in wouso/resources/static/js/jquery.js - About 2 hrs to fix

          Function domManip has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              domManip: function( args, callback ) {
          
                  // Flatten any nested arrays
                  args = concat.apply( [], args );
          
          
          Severity: Major
          Found in wouso/resources/static/js/jquery.js - About 2 hrs to fix

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

                init = jQuery.fn.init = function( selector, context ) {
                    var match, elem;
            
                    // HANDLE: $(""), $(null), $(undefined), $(false)
                    if ( !selector ) {
            Severity: Major
            Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 2 hrs to fix

              Function send has 60 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                              send: function( headers, complete ) {
                                  var i,
                                      xhr = options.xhr(),
                                      id = ++xhrId;
              
              
              Severity: Major
              Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 2 hrs to fix

                Function domManip has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    domManip: function( args, callback ) {
                
                        // Flatten any nested arrays
                        args = concat.apply( [], args );
                
                
                Severity: Major
                Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 2 hrs to fix

                  Function Deferred has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      Deferred: function( func ) {
                          var tuples = [
                                  // action, add listener, listener list, final state
                                  [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
                                  [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
                  Severity: Major
                  Found in wouso/resources/static/js/jquery.js - About 2 hrs to fix

                    Function CHILD has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            "CHILD": function( type, what, argument, first, last ) {
                                var simple = type.slice( 0, 3 ) !== "nth",
                                    forward = type.slice( -4 ) !== "last",
                                    ofType = what === "of-type";
                    
                    
                    Severity: Major
                    Found in wouso/resources/static/js/jquery.js - About 2 hrs to fix

                      Function formToArray has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      $.fn.formToArray = function(semantic, elements) {
                          var a = [];
                          if (this.length === 0) {
                              return a;
                          }
                      Severity: Major
                      Found in wouso/resources/static/js/jquery.form.js - About 2 hrs to fix

                        Function CHILD has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                "CHILD": function( type, what, argument, first, last ) {
                                    var simple = type.slice( 0, 3 ) !== "nth",
                                        forward = type.slice( -4 ) !== "last",
                                        ofType = what === "of-type";
                        
                        
                        Severity: Major
                        Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 2 hrs to fix

                          Function Deferred has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              Deferred: function( func ) {
                                  var tuples = [
                                          // action, add listener, listener list, final state
                                          [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
                                          [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
                          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 ( 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.js - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language