aceleradora-TW/nao-me-calo

View on GitHub

Showing 17 of 66 total issues

Method get_bad_word has 597 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def get_bad_word
    bad_words = ["babaca",
      "babacÊo",
      "babacão",
      "babacaum",
Severity: Major
Found in app/helpers/application_helper.rb - About 2 days to fix

    File application_helper.rb has 639 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module ApplicationHelper
    
      def set_average_style(average)
        case average
        when "Péssimo"
    Severity: Major
    Found in app/helpers/application_helper.rb - About 1 day to fix

      Method create has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

        def create
          if params[:accepted_terms] && params[:rating][:rating_date] && params[:rating][:cpf]
      
            if Obscenity.profane?(rating_params[:description])
              redirect_to controller: :ratings, action: :new, placeId: params[:placeId]
      Severity: Minor
      Found in app/controllers/ratings_controller.rb - About 4 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 initAutocomplete has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function initAutocomplete () {
        var mapField = $('#map')[0]
        map = new google.maps.Map(mapField, {
          center: {lat: -30.0277, lng: -51.2287},
          zoom: 12
      Severity: Major
      Found in app/assets/javascripts/welcome.js - About 2 hrs to fix

        Consider simplifying this complex logical expression.
        Open

            if ( strCPF === '00000000000' || strCPF === '11111111111' || strCPF === '22222222222' || strCPF === '33333333333' || strCPF === '44444444444' || strCPF === '55555555555' || strCPF === '66666666666' || strCPF === '77777777777' || strCPF === '88888888888' || strCPF === '99999999999' || strCPF === '01234567890') return true;
        Severity: Critical
        Found in app/assets/javascripts/ratings.js - About 2 hrs to fix

          File welcome.js has 258 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          //= require header-mobile
          
          var autocomplete;
          var map;
          
          
          Severity: Minor
          Found in app/assets/javascripts/welcome.js - About 2 hrs to fix

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

              function patternLinks(){
                $('#abuse-first').click(function(){
                  $('#article-1').fadeToggle("slow");
                  $('#discriminacao_down').toggleClass('hidden');
                  $('#discriminacao_right').toggleClass('hidden');
            Severity: Minor
            Found in app/assets/javascripts/help.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                  if(!(errors['cpfEvaluate'] || isNull($('#cpfEvaluate')) || errors['rating'] || isNull($('#dateEvaluate')) || errors['dateEvaluate'] || errors['nameEvaluate'] || errors['emailEvaluate'] || errors['description'])){
                    enableButtonTerms();    }
              Severity: Critical
              Found in app/assets/javascripts/ratings.js - About 1 hr to fix

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

                  def create
                    if params[:accepted_terms] && params[:rating][:rating_date] && params[:rating][:cpf]
                
                      if Obscenity.profane?(rating_params[:description])
                        redirect_to controller: :ratings, action: :new, placeId: params[:placeId]
                Severity: Minor
                Found in app/controllers/ratings_controller.rb - About 1 hr to fix

                  Function createPin has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function createPin(){
                      for(var i = 0; i<locations.length; i++){
                        var locate = locations[i];
                        var iconColor = locate[3];
                        var myLatLng = {lat: locate[1], lng: locate[2]};
                  Severity: Minor
                  Found in app/assets/javascripts/welcome.js - About 1 hr to fix

                    Avoid deeply nested control flow statements.
                    Open

                                  @rating.description.empty? ? notice = "Avaliação feita com sucesso!" : notice = "Avaliação feita com sucesso! Sua avaliação irá passar pela moderação."
                    Severity: Major
                    Found in app/controllers/ratings_controller.rb - About 45 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if(!(@rating.woman.nil? && @rating.lgbtqia.nil? && @rating.race.nil? && @rating.disability.nil? && @rating.elder.nil? && @rating.obese.nil?))
                                if(@establishment.nil?)
                                  @place = @client.spot(params[:placeId])
                                  @establishment = Establishment.create!(name: @place.name, address: @place.formatted_address, lat: @place.lat, lng: @place.lng, id_places: @place.place_id, city: @place.city)
                                end
                      Severity: Major
                      Found in app/controllers/ratings_controller.rb - About 40 mins to fix

                        Avoid too many return statements within this method.
                        Open

                              return nil
                        Severity: Major
                        Found in app/helpers/application_helper.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                return 'concept-excellent'
                          Severity: Major
                          Found in app/helpers/application_helper.rb - About 30 mins to fix

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

                              def moderated
                                respond_to do |format|
                                  if(@rating.moderated == false)
                                    @rating.moderated = true
                                  else
                            Severity: Minor
                            Found in app/controllers/ratings_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

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

                              def generate_concept(establishment)
                            
                                if establishment.has_more_than_2_ratings?
                                  general_average = []
                                  establishment.ratings.each do |rating|
                            Severity: Minor
                            Found in lib/concept.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

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

                              def populate_rate_array(ratings)
                                rate_array = []
                                ratings.each do |rating|
                                  if rating.average_rating < 1.8
                                    rate_array.push([rating,"Péssimo"])
                            Severity: Minor
                            Found in app/models/establishment.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