meurio/verdade-ou-consequencia

View on GitHub

Showing 62 of 62 total issues

Function bridge has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

$.widget.bridge = function( name, object ) {
    var fullName = object.prototype.widgetFullName || name;
    $.fn[ name ] = function( options ) {
        var isMethodCall = typeof options === "string";
        var args = widgetSlice.call( arguments, 1 );
Severity: Minor
Found in app/assets/javascripts/jquery-ui.js - About 1 hr to fix

    Method matchup has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def matchup
        @user = nil
        @user = User.find params[:user_id] if User.exists? params[:user_id]
        if @user == nil
            flash[:error] = 'Usuário inexistente'
    Severity: Minor
    Found in app/controllers/users_controller.rb - 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 ligaCidades has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var ligaCidades = function(componenteBusca, selecionaValores) {
      cBusca = $( componenteBusca );
      cBusca.autocomplete({
        source: function( request, response ) {
          $.ajax({
    Severity: Minor
    Found in app/assets/stylesheets/cidades.js - About 1 hr to fix

      Function name has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          $.fn[ name ] = function( options ) {
              var isMethodCall = typeof options === "string";
              var args = widgetSlice.call( arguments, 1 );
              var returnValue = this;
      
      
      Severity: Minor
      Found in app/assets/javascripts/jquery-ui.js - About 1 hr to fix

        Function refresh has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            refresh: function() {
                var menus, items, newSubmenus, newItems, newWrappers,
                    that = this,
                    icon = this.options.icons.submenu,
                    submenus = this.element.find( this.options.menus );
        Severity: Minor
        Found in app/assets/javascripts/jquery-ui.js - About 1 hr to fix

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

                      respond_to do |format| 
                          format.xml {
                              render :xml => @candidates, :except=>[:cpf, :born_at, :created_at, :updated_at, :city_id, :party_id], :include=>{:city=>{:only=>[:name, :state]}, :party=>{:only=>[:number, :symbol]}}
                          }
                          format.json {
          Severity: Major
          Found in app/controllers/dataclip_controller.rb and 1 other location - About 1 hr to fix
          app/controllers/dataclip_controller.rb on lines 45..55

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

          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

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

                      respond_to do |format| 
                          format.xml {
                              render :xml => @candidates, :except=>[:cpf, :born_at, :created_at, :updated_at, :city_id, :party_id], :include=>{:city=>{:only=>[:name, :state]}, :party=>{:only=>[:number, :symbol]}}
                          }
                          format.json {
          Severity: Major
          Found in app/controllers/dataclip_controller.rb and 1 other location - About 1 hr to fix
          app/controllers/dataclip_controller.rb on lines 23..33

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

          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

          Method matches has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def matches
              ors = answers.select{|a| a.weight > 0}.map{|a| "ca.question_id = #{a.question_id}"}.join(" or ")
              ors = "1=1" if (ors == '')
              match_data = Candidate.
                select(
          Severity: Minor
          Found in app/models/user.rb - About 1 hr to fix

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

                    left: function() {
                        $.ui.position.flip.left.apply( this, arguments );
                        $.ui.position.fit.left.apply( this, arguments );
                    },
            Severity: Major
            Found in app/assets/javascripts/jquery-ui.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/jquery-ui.js on lines 1229..1232

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

            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

                    top: function() {
                        $.ui.position.flip.top.apply( this, arguments );
                        $.ui.position.fit.top.apply( this, arguments );
                    }
            Severity: Major
            Found in app/assets/javascripts/jquery-ui.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/jquery-ui.js on lines 1225..1228

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

            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 _on has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _on: function( suppressDisabledCheck, element, handlers ) {
                    var delegateElement;
                    var instance = this;
            
                    // No suppressDisabledCheck flag, shuffle arguments
            Severity: Minor
            Found in app/assets/javascripts/jquery-ui.js - About 1 hr to fix

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

                  if ( options.at[ 1 ] === "bottom" ) {
                      basePosition.top += targetHeight;
                  } else if ( options.at[ 1 ] === "center" ) {
                      basePosition.top += targetHeight / 2;
                  }
              Severity: Major
              Found in app/assets/javascripts/jquery-ui.js and 3 other locations - About 1 hr to fix
              app/assets/javascripts/jquery-ui.js on lines 939..943
              app/assets/javascripts/jquery-ui.js on lines 969..973
              app/assets/javascripts/jquery-ui.js on lines 975..979

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

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

                      if ( options.my[ 0 ] === "right" ) {
                          position.left -= elemWidth;
                      } else if ( options.my[ 0 ] === "center" ) {
                          position.left -= elemWidth / 2;
                      }
              Severity: Major
              Found in app/assets/javascripts/jquery-ui.js and 3 other locations - About 1 hr to fix
              app/assets/javascripts/jquery-ui.js on lines 939..943
              app/assets/javascripts/jquery-ui.js on lines 945..949
              app/assets/javascripts/jquery-ui.js on lines 975..979

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

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

                  if ( options.at[ 0 ] === "right" ) {
                      basePosition.left += targetWidth;
                  } else if ( options.at[ 0 ] === "center" ) {
                      basePosition.left += targetWidth / 2;
                  }
              Severity: Major
              Found in app/assets/javascripts/jquery-ui.js and 3 other locations - About 1 hr to fix
              app/assets/javascripts/jquery-ui.js on lines 945..949
              app/assets/javascripts/jquery-ui.js on lines 969..973
              app/assets/javascripts/jquery-ui.js on lines 975..979

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

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

                      if ( options.my[ 1 ] === "bottom" ) {
                          position.top -= elemHeight;
                      } else if ( options.my[ 1 ] === "center" ) {
                          position.top -= elemHeight / 2;
                      }
              Severity: Major
              Found in app/assets/javascripts/jquery-ui.js and 3 other locations - About 1 hr to fix
              app/assets/javascripts/jquery-ui.js on lines 939..943
              app/assets/javascripts/jquery-ui.js on lines 945..949
              app/assets/javascripts/jquery-ui.js on lines 969..973

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

              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

              Method matches has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def matches
                  ors = answers.select{|a| a.weight > 0}.map{|a| "ca.question_id = #{a.question_id}"}.join(" or ")
                  ors = "1=1" if (ors == '')
                  match_data = Candidate.
                    select(
              Severity: Minor
              Found in app/models/user.rb - 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

              Method subscribe_all has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.subscribe_all
                  lista_segmentos = segment_list
                  cands = Candidate.where("nickname is not null and party_id is not null and city_id is not null").
                    each{ |c|
                      alvo = ''
              Severity: Minor
              Found in app/models/candidate.rb - About 1 hr to fix

                Function top has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        top: function( position, data ) {
                            var within = data.within,
                                withinOffset = within.offset.top + within.scrollTop,
                                outerHeight = within.height,
                                offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
                Severity: Minor
                Found in app/assets/javascripts/jquery-ui.js - About 1 hr to fix

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

                          elsif u.city.name == 'São Paulo' and u.city.state == 'SP'
                            alvo = :sampa
                          elsif u.city.name == 'Rio de Janeiro' and u.city.state == 'RJ'
                            alvo = :rio
                          elsif u.city.name == 'Porto Alegre' and u.city.state == 'RS'
                  Severity: Major
                  Found in app/models/user.rb and 1 other location - About 1 hr to fix
                  app/models/candidate.rb on lines 119..129

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

                  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 c.city.name == 'São Paulo' and c.city.state == 'SP'
                            alvo = :sampa
                          elsif c.city.name == 'Rio de Janeiro' and c.city.state == 'RJ'
                            alvo = :rio
                          elsif c.city.name == 'Porto Alegre' and c.city.state == 'RS'
                  Severity: Major
                  Found in app/models/candidate.rb and 1 other location - About 1 hr to fix
                  app/models/user.rb on lines 99..109

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

                  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