rosedu/wouso

View on GitHub

Showing 2,707 of 2,707 total issues

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

    html: function( value ) {
        return access( this, function( value ) {
            var elem = this[ 0 ] || {},
                i = 0,
                l = this.length;
Severity: Minor
Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

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

        toggleClass: function( value, stateVal ) {
            var type = typeof value;
    
            if ( typeof stateVal === "boolean" && type === "string" ) {
                return stateVal ? this.addClass( value ) : this.removeClass( value );
    Severity: Minor
    Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

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

          fix: function( event ) {
              if ( event[ jQuery.expando ] ) {
                  return event;
              }
      
      
      Severity: Minor
      Found in wouso/resources/static/js/jquery.js - About 1 hr to fix

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

            finish: function( type ) {
                if ( type !== false ) {
                    type = type || "fx";
                }
                return this.each(function() {
        Severity: Minor
        Found in wouso/resources/static/js/jquery.js - About 1 hr to fix

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

              fix: function( event ) {
                  if ( event[ jQuery.expando ] ) {
                      return event;
                  }
          
          
          Severity: Minor
          Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

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

                finish: function( type ) {
                    if ( type !== false ) {
                        type = type || "fx";
                    }
                    return this.each(function() {
            Severity: Minor
            Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

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

                  def process_response(self, request, response):
                      """ Handle redirects
                      """
                      if not hasattr(request, 'user') or not hasattr(request, 'session'):
                          return response
              Severity: Minor
              Found in wouso/middleware/impersonation.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 main has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def main():
                  if len(sys.argv) != 2:
                      print 'Usage: python add_users.py <file.csv>'
                      print " CSV columns: username, first name, last name, email, password, cookie, race"
                      sys.exit(1)
              Severity: Minor
              Found in wouso/utils/add_users_force_to_race.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 stats has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def stats(request):
              
                  data = {}
              
                  # now
              Severity: Minor
              Found in wouso/interface/apps/statistics/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 authenticate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def authenticate(self, username=None, password=None):
                      if password == "" or password is None or username is None:
                          raise Exception('Invalid user or password')
              
                      username, password = username.strip(), password.strip()
              Severity: Minor
              Found in wouso/middleware/ldap_connection.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 searchone has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def searchone(request):
                  """ Get one user, based on his/her name """
                  logger.debug('Initiating search one')
                  form = SearchOneForm(request.GET)
                  if form.is_valid():
              Severity: Minor
              Found in wouso/interface/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 main has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def main():
              
                  if len(sys.argv) != 2:
                      print 'Usage: import_users.py <file.csv>'
                      print " CSV columns: last name, first name, uid, group"
              Severity: Minor
              Found in wouso/utils/import_users.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 main has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def main():
                  if len(sys.argv) != 5:
                      print >>sys.stderr, 'Usage: add_questions.py <file> <category> <proposed-by> <endorsed_by>'
                      sys.exit(1)
              
              
              Severity: Minor
              Found in wouso/utils/add_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

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

                  def create(self, request):
                      attrs = self.flatten_dict(request.POST)
                      sender = request.user.get_profile()
              
                      try:
              Severity: Minor
              Found in wouso/interface/api/handlers.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 save has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def save(self):
                      data = self.cleaned_data
              
                      self.instance.category = get_object_or_404(Category, name=data['category'])
              
              
              Severity: Minor
              Found in wouso/interface/cpanel/forms.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 index has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def index(request):
                  quest = QuestGame.get_current()
              
                  if quest == None:
                      return render_to_response('quest/none.html', context_instance=RequestContext(request))
              Severity: Minor
              Found in wouso/games/quest/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

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

                  def save(self):
                      self.instance.set_password(self.cleaned_data.get('password'))
                      self.instance.save()
                      return self.instance
              Severity: Major
              Found in wouso/interface/cpanel/forms.py and 2 other locations - About 1 hr to fix
              wouso/interface/cpanel/forms.py on lines 278..281
              wouso/interface/cpanel/forms.py on lines 306..309

              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 39.

              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 3 locations. Consider refactoring.
              Open

                  def created(self):
                      if self.challenge.WARRANTY:
                          # take 3 points from user_from
                          scoring.score(self.challenge.user_from.user, ChallengeGame, 'chall-warranty', external_id=self.challenge.id)
              Severity: Major
              Found in wouso/games/challenge/models.py and 2 other locations - About 1 hr to fix
              wouso/games/challenge/models.py on lines 580..583
              wouso/games/challenge/models.py on lines 606..609

              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 39.

              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 get_or_create_assessment has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_or_create_assessment(self, player):
                      """ Return existing or new assessment for player
                      """
                      try:
                          assessment, is_new = Assessment.objects.get_or_create(player=player, workshop=self)
              Severity: Minor
              Found in wouso/games/workshop/models.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

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

                      def save(self):
                          self.instance.set_password(self.cleaned_data.get('password'))
                          self.instance.save()
                          return self.instance
              Severity: Major
              Found in wouso/interface/cpanel/forms.py and 2 other locations - About 1 hr to fix
              wouso/interface/cpanel/forms.py on lines 306..309
              wouso/interface/cpanel/forms.py on lines 336..339

              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 39.

              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

              Severity
              Category
              Status
              Source
              Language