Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
inherit_from: .rubocop_todo.yml

AllCops:
Exclude:
- 'config/initializers/devise.rb'
- 'db/schema*'


Style/Documentation:
Enabled: false

Layout/LineLength:
IgnoredPatterns: ['(\A|\s)#']
74 changes: 74 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# This configuration was generated by
# `rubocop --auto-gen-config`.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 5
Metrics/AbcSize:
Max: 20

# Offense count: 7
# Configuration parameters: CountComments, ExcludedMethods.
# ExcludedMethods: refine
Metrics/BlockLength:
Max: 118

# Offense count: 7
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/MethodLength:
Max: 18

# Offense count: 2
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
# NamePrefix: is_, has_, have_
# ForbiddenPrefixes: is_, has_, have_
# AllowedMethods: is_a?
# MethodDefinitionMacros: define_method, define_singleton_method
Naming/PredicateName:
Exclude:
- 'spec/**/*'
- 'app/helpers/application_helper.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
Exclude:
- 'app/controllers/users/registrations_controller.rb'

# Offense count: 1
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
- 'app/models/ability.rb'

# Offense count: 1
Style/IfUnlessModifier:
Exclude:
- 'spec/rails_helper.rb'

# Offense count: 2
Style/MixinUsage:
Exclude:
- 'bin/setup'
- 'bin/update'

# Offense count: 29
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
Exclude:
- 'app/controllers/houses_controller.rb'
- 'app/controllers/tasks_controller.rb'
- 'app/uploaders/avatar_uploader.rb'
- 'app/uploaders/house_image_uploader.rb'
- 'config/environments/production.rb'
- 'db/migrate/20190521171605_first.rb'
- 'spec/controllers/houses_controller_spec.rb'
- 'spec/models/house_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/rails_helper.rb'
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ group :development, :test do
gem 'pry-rails'
gem 'rails-controller-testing'
gem 'rspec-rails', '~> 3.8'
gem 'rubocop', '~> 0.79.0', require: false
end

group :development do
Expand Down
16 changes: 16 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ GEM
minitest (~> 5.1)
tzinfo (~> 1.1)
arel (8.0.0)
ast (2.4.0)
autoprefixer-rails (9.5.0)
execjs
bcrypt (3.1.13)
Expand Down Expand Up @@ -111,6 +112,7 @@ GEM
i18n (1.7.0)
concurrent-ruby (~> 1.0)
ipaddress (0.8.3)
jaro_winkler (1.5.4)
jbuilder (2.8.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
Expand Down Expand Up @@ -140,6 +142,9 @@ GEM
nokogiri (1.10.5)
mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0)
parallel (1.19.1)
parser (2.7.0.2)
ast (~> 2.4.0)
pg (1.1.4)
popper_js (1.14.5)
pry (0.12.2)
Expand Down Expand Up @@ -181,6 +186,7 @@ GEM
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (3.0.0)
rake (13.0.0)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
Expand All @@ -205,6 +211,14 @@ GEM
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rubocop (0.79.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.7.0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
ruby-progressbar (1.10.1)
ruby_dep (1.5.0)
sass (3.7.3)
sass-listen (~> 4.0.0)
Expand Down Expand Up @@ -234,6 +248,7 @@ GEM
thread_safe (~> 0.1)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.6.1)
warden (1.2.8)
rack (>= 2.0.6)
web-console (3.7.0)
Expand Down Expand Up @@ -270,6 +285,7 @@ DEPENDENCIES
rails (~> 5.1.4)
rails-controller-testing
rspec-rails (~> 3.8)
rubocop (~> 0.79.0)
sass-rails (~> 5.0)
sprockets-rails
turbolinks (~> 5)
Expand Down
13 changes: 10 additions & 3 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@ class ApplicationController < ActionController::Base
rescue_from CanCan::AccessDenied do |_exception|
respond_to do |format|
format.json { head :forbidden }
format.html { redirect_to houses_url, alert: "You're not authorized to perform this action." }
format.html do
redirect_to houses_url,
alert: "You're not authorized to perform this action."
end
end
end

protected

def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: %i[nickname firstname lastname bio birthday avatar])
devise_parameter_sanitizer.permit(:account_update, keys: %i[nickname firstname lastname bio birthday avatar])
devise_parameter_sanitizer.permit(:sign_up,
keys: %i[nickname firstname lastname bio
birthday avatar])
devise_parameter_sanitizer.permit(:account_update,
keys: %i[nickname firstname lastname bio
birthday avatar])
end
end
25 changes: 20 additions & 5 deletions app/controllers/groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,46 @@ def create

respond_to do |format|
if @group.save
format.html { redirect_to house_group_url(@house, @group), notice: 'Group was successfully created.' }
format.html do
redirect_to house_group_url(@house, @group),
notice: 'Group was successfully created.'
end
format.json { render :show, status: :created, location: @group }
else
format.html { render :new }
format.json { render json: @group.errors, status: :unprocessable_entity }
format.json do
render json: @group.errors,
status: :unprocessable_entity
end
end
end
end

def update
respond_to do |format|
if @group.update(group_params)
format.html { redirect_to house_group_url(@house, @group), notice: 'Group was successfully updated.' }
format.html do
redirect_to house_group_url(@house, @group),
notice: 'Group was successfully updated.'
end
format.json { render :show, status: :ok, location: @group }
else
format.html { render :edit }
format.json { render json: @group.errors, status: :unprocessable_entity }
format.json do
render json: @group.errors,
status: :unprocessable_entity
end
end
end
end

def destroy
@group.destroy
respond_to do |format|
format.html { redirect_to house_groups_url, notice: 'Group was successfully destroyed.' }
format.html do
redirect_to house_groups_url,
notice: 'Group was successfully destroyed.'
end
format.json { head :no_content }
end
end
Expand Down
1 change: 0 additions & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ def managed_houses
end
array
end

end