jjeremydiaz/OpenHouse

View on GitHub

Showing 815 of 815 total issues

Class has too many lines. [122/100]
Open

class UsersController < ApplicationController
    def user_params
        params.require(:user).permit(:email, :password, :first_name, :last_name, :billing_street_address, :billing_city, :billing_state, :billing_zip_code, :billing_first_name, :billing_last_name, :credit_card_number, :expiration_date, :cvv, :home_street_address, :home_city, :home_state, :home_zip_code, :personal_description, :house_description, :searchable, :price, :available_time_start, :available_time_end, :title, :capacity)
    end

Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Block has too many lines. [73/25]
Open

ActiveRecord::Schema.define(version: 20171203075752) do

  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"

Severity: Minor
Found in db/schema.rb by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Assignment Branch Condition size for create is too high. [35.52/15]
Open

    def create
        @user = User.create(user_params)
        @user.amenity_list = AmenityList.new
        next_path = new_user_path
        if @user.errors.empty?
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for populateMap is too high. [28.18/15]
Open

    def populateMap()
        all_users = User.where(:searchable => true)
        all_users.near(@full_location).each do |user|
            @users.push(user)
            url = request.base_url + "/users/" + user.id.to_s
Severity: Minor
Found in app/helpers/search_helper.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [23/10]
Open

  def path_to(page_name, user = nil)
    case page_name

    when /^the home\s?page$/
      '/'
Severity: Minor
Found in features/support/paths.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [21/10]
Open

    def create
        @user = User.create(user_params)
        @user.amenity_list = AmenityList.new
        next_path = new_user_path
        if @user.errors.empty?
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for range_to_ampm is too high. [23.17/15]
Open

    def range_to_ampm(range)
        start_hour = range[0..1].to_i
        end_hour = range[6..7].to_i
        (((start_hour-1)%12)+1).to_s + range[2..4] + ((start_hour%24)<12?' a.m. - ':' p.m. - ') + (((end_hour-1)%12)+1).to_s + range[8..10] + ((end_hour%24)<12?' a.m.':' p.m.')
    end
Severity: Minor
Found in app/helpers/time_helper.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for show is too high. [23.79/15]
Open

    def show
        @user = User.find params[:id]
        @current_user = current_user
        @full_location = @user.home_street_address + " " + @user.home_city + " " + @user.home_state
        
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [15/10]
Open

  def index
    @messages = @conversation.messages
    if @messages.length > 10
      @over_ten = true
      @messages = @messages[-10..-1]

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for update_house_picture is too high. [20.78/15]
Open

    def update_house_picture
        @user = current_user
        
        if params[:image_id].present?
            preloaded = Cloudinary::PreloadedFile.new(params[:image_id])         
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for update_profile_picture is too high. [20.78/15]
Open

    def update_profile_picture
        @user = current_user
        
        if params[:image_id].present?
            preloaded = Cloudinary::PreloadedFile.new(params[:image_id])         
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for update_multiple_pictures is too high. [19.47/15]
Open

    def update_multiple_pictures
        @user = current_user
        
        if params[:image_id].present?
            preloaded = Cloudinary::PreloadedFile.new(params[:image_id])         
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [13/10]
Open

    def update_house_picture
        @user = current_user
        
        if params[:image_id].present?
            preloaded = Cloudinary::PreloadedFile.new(params[:image_id])         
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [13/10]
Open

    def update_profile_picture
        @user = current_user
        
        if params[:image_id].present?
            preloaded = Cloudinary::PreloadedFile.new(params[:image_id])         
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [13/10]
Open

    def up
        create_table :users do |u|
            u.string :email
            u.string :password

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [13/10]
Open

  def change
    remove_column :amenity_lists, :couch
    remove_column :amenity_lists, :tv
    add_column :amenity_lists, :coffee,         :boolean
    add_column :amenity_lists, :computer_desk,  :boolean

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

User.create!(email: 'kyle.peyton220268@gmail.com',
             password: 'openhouse',
             first_name: 'Kyle',
             last_name: 'Peyton',
             personal_description: "Hi, I'm Kyle!",
Severity: Major
Found in db/seeds.rb and 1 other location - About 1 hr to fix
db/seeds.rb on lines 107..136

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

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

User.create!(email: 'hunter.johnson222001@gmail.com',
             password: 'openhouse',
             first_name: 'Hunter',
             last_name: 'Johnson',
             personal_description: "Hi, I'm Hunter!",
Severity: Major
Found in db/seeds.rb and 1 other location - About 1 hr to fix
db/seeds.rb on lines 138..167

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

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 has too many lines. [12/10]
Open

    def populateMap()
        all_users = User.where(:searchable => true)
        all_users.near(@full_location).each do |user|
            @users.push(user)
            url = request.base_url + "/users/" + user.id.to_s
Severity: Minor
Found in app/helpers/search_helper.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for send_request is too high. [17.12/15]
Open

    def send_request
        @id = params[:id]
        if Conversation.between(@user.id, @id).present?
            @conversation = Conversation.between(@user.id, @id).first
        else

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Severity
Category
Status
Source
Language