meurio/verdade-ou-consequencia

View on GitHub

Showing 62 of 62 total issues

Function left has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        left: function( position, data ) {
            var within = data.within,
                withinOffset = within.offset.left + within.scrollLeft,
                outerWidth = within.width,
                offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
Severity: Minor
Found in app/assets/javascripts/jquery-ui.js - About 1 hr to fix

    Method create has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create
        # Now we can identify if login is from an user or from an candidate
        # type = "user" ou "candidate"
        type = request.env['omniauth.params']["type"]
        auth = request.env['omniauth.auth']
    Severity: Minor
    Found in app/controllers/sessions_controller.rb - About 1 hr to fix

      Function _createWidget has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _createWidget: function( options, element ) {
              element = $( element || this.defaultElement || this )[ 0 ];
              this.element = $( element );
              this.uuid = widgetUuid++;
              this.eventNamespace = "." + this.widgetName + this.uuid;
      Severity: Minor
      Found in app/assets/javascripts/jquery-ui.js - About 1 hr to fix

        Function option has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            option: function( key, value ) {
                var options = key;
                var parts;
                var curOption;
                var i;
        Severity: Minor
        Found in app/assets/javascripts/jquery-ui.js - About 1 hr to fix

          Method responderam has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def responderam
                  if params[:city_id]
                      @city_id = params[:city_id]
                      @city = City.find @city_id
                      @candidates = Candidate.
          Severity: Minor
          Found in app/controllers/dataclip_controller.rb - About 1 hr to fix

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

                _classes: function( options ) {
                    var full = [];
                    var that = this;
            
                    options = $.extend( {
            Severity: Minor
            Found in app/assets/javascripts/jquery-ui.js - About 1 hr to fix

              Method initialize has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def initialize(user, request)
                  can :read, :all
              
                  if request.format == "csv"
                    cannot :read, Candidate
              Severity: Minor
              Found in app/models/ability.rb - About 1 hr to fix

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

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

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

                      _initSource: function() {
                          var array, url,
                              that = this;
                          if ( $.isArray( this.options.source ) ) {
                              array = this.options.source;
                  Severity: Minor
                  Found in app/assets/javascripts/jquery-ui.js - About 1 hr to fix

                    Method matchup has 28 lines of code (exceeds 25 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

                      Method index has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def index
                              if session[:candidate_id]
                                  candidate_id = session[:candidate_id]
                                  if not Candidate.exists? candidate_id
                                      reset_session
                      Severity: Minor
                      Found in app/controllers/main_controller.rb - About 1 hr to fix

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

                                left: function( position, data ) {
                                    var within = data.within,
                                        withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
                                        outerWidth = within.width,
                                        collisionPosLeft = position.left - data.collisionPosition.marginLeft,
                        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

                            def self.insert_or_identify_segment segmentos, match, titulo
                              id = ''
                              ss =  segmentos.select{|s| s['name'].match(match) }
                              if ss.count == 0
                                begin
                          Severity: Major
                          Found in app/models/user.rb and 1 other location - About 1 hr to fix
                          app/models/candidate.rb on lines 166..178

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

                          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

                            def self.insert_or_identify_segment segmentos, match, titulo
                              id = ''
                              ss =  segmentos.select{|s| s['name'].match(match) }
                              if ss.count == 0
                                begin
                          Severity: Major
                          Found in app/models/candidate.rb and 1 other location - About 1 hr to fix
                          app/models/user.rb on lines 161..173

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

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

                          function getDimensions( elem ) {
                              var raw = elem[ 0 ];
                              if ( raw.nodeType === 9 ) {
                                  return {
                                      width: elem.width(),
                          Severity: Minor
                          Found in app/assets/javascripts/jquery-ui.js - About 1 hr to fix

                            Function focus has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                focus: function( event, item ) {
                                    var nested, focused, activeParent;
                                    this.blur( event, event && event.type === "focus" );
                            
                                    this._scrollIntoView( item );
                            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

                                              atOffset = data.at[ 1 ] === "top" ?
                                                  data.targetHeight :
                                                  data.at[ 1 ] === "bottom" ?
                                                      -data.targetHeight :
                                                      0,
                              Severity: Minor
                              Found in app/assets/javascripts/jquery-ui.js and 1 other location - About 50 mins to fix
                              app/assets/javascripts/jquery-ui.js on lines 1164..1168

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

                              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

                                              atOffset = data.at[ 0 ] === "left" ?
                                                  data.targetWidth :
                                                  data.at[ 0 ] === "right" ?
                                                      -data.targetWidth :
                                                      0,
                              Severity: Minor
                              Found in app/assets/javascripts/jquery-ui.js and 1 other location - About 50 mins to fix
                              app/assets/javascripts/jquery-ui.js on lines 1201..1205

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

                              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 ligaCidades has a Cognitive Complexity of 7 (exceeds 5 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 35 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

                              Method create_user_question_through_session has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def create_user_question_through_session
                                  if session[:question] and current_user
                                    @question = Question.new session[:question]
                                    @question.user = current_user
                                    respond_to do |format|
                              Severity: Minor
                              Found in app/controllers/application_controller.rb - About 25 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