Merge pull request #403 from openSUSE/review_140730_proceed_with_styling

[Review] Request from 'kalabiyau' @ 'openSUSE/osem/review_140730_proceed_with_styling'
This commit is contained in:
Artem Chernikov 2014-07-31 15:18:24 +02:00
commit d39d10d3f7
10 changed files with 50 additions and 59 deletions

View file

@ -80,6 +80,34 @@ Lint/UselessAssignment:
Lint/Void:
Enabled: true
# Align the elements of a hash literal if they span more than one line
Style/AlignHash:
Enabled: true
# Align the parameters of a method call if they span more than one line
Style/AlignParameters:
Enabled: true
# Use && instead of and, use || instead of or
Style/AndOr:
Enabled: true
# avoid deep blocks nesting
Style/BlockNesting:
Max: 4
# use do instead of {...} in multiline blocks
Style/Blocks:
Enabled: true
# avoid redundunt curly braces when it is obvious that hash is used
Style/BracesAroundHashParameters:
Enabled: true
#
Style/CaseEquality:
Enabled: true
AllCops:
Include:
- '**/Rakefile'

View file

@ -5,42 +5,6 @@
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
Style/AlignHash:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/AlignParameters:
Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
Style/AndOr:
Enabled: false
# Offense count: 1
Style/BlockNesting:
Max: 4
# Offense count: 2
# Cop supports --auto-correct.
Style/Blocks:
Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/BracesAroundHashParameters:
Enabled: false
# Offense count: 1
Style/CaseEquality:
Enabled: false
# Offense count: 20
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassAndModuleChildren:

View file

@ -128,7 +128,7 @@ module Admin
day_ticket_count = @tickets.where('supporter_registrations.created_at LIKE ?
AND supporter_levels.title LIKE ?',
"%#{day}%", "%#{level.title}%").count
"%#{day}%", "%#{level.title}%").count
index = @tickets_time.index { |v| v['key'] == "#{level.title}" }
@tickets_time[index]['values'] << { 'label' => "#{day}", 'value' => day_ticket_count }

View file

@ -6,7 +6,7 @@ class ApplicationController < ActionController::Base
helper_method :date_string
def store_location
session[:return_to] = request.fullpath if request.get? and controller_name != "user_sessions" and controller_name != "sessions"
session[:return_to] = request.fullpath if request.get? && controller_name != "user_sessions" && controller_name != "sessions"
end
def after_sign_in_path_for(resource)

View file

@ -66,11 +66,11 @@ class EventAttachmentsController < ApplicationController
respond_to do |format|
if @upload.save
format.html {
format.html do
render json: [@upload.to_jq_upload].to_json,
content_type: 'text/html',
layout: false
}
end
format.json do
render json: [@upload.to_jq_upload].to_json, status: :created,
location: conference_proposal_event_attachment_path(@upload.event.conference.short_title, @upload.event, @upload)

View file

@ -2,12 +2,12 @@ class ScheduleController < ApplicationController
layout "application"
def index
@conference = Conference.includes(:rooms, {events: [:speakers, :track, :event_type]}).where("conferences.short_title" => params[:conference_id]).first
@conference = Conference.includes(:rooms, events: [:speakers, :track, :event_type]).where("conferences.short_title" => params[:conference_id]).first
@rooms = @conference.rooms
@events = @conference.events
@dates = @conference.start_date..@conference.end_date
if @dates === Date.current
if @dates == Date.current
@today = Date.current.strftime("%Y-%m-%d")
else
@today = @conference.start_date.strftime("%Y-%m-%d")

View file

@ -195,7 +195,7 @@ class Event < ActiveRecord::Base
begin
if mail
self.send(transition,
send_mail: send_mail_param)
send_mail: send_mail_param)
else
self.send(transition)
end

View file

@ -10,9 +10,9 @@ Devise.setup do |config|
# Pass each provider to User model in :omniauth_providers (for open_id providers use their name)
config.omniauth :open_id, name: 'novell', identifier: 'http://www.opensuse.org/openid/user'
config.omniauth :google_oauth2, Rails.application.secrets.google_key, Rails.application.secrets.google_secret, {
name: 'google',
scope: 'email' }
config.omniauth :google_oauth2, Rails.application.secrets.google_key, Rails.application.secrets.google_secret,
name: 'google',
scope: 'email'
config.omniauth :facebook, Rails.application.secrets.facebook_key, Rails.application.secrets.facebook_secret
# ==> Mailer Configuration

View file

@ -19,15 +19,14 @@ describe Admin::ConferenceController do
context 'valid attributes' do
it 'locates the requested conference' do
patch :update, id: conference.short_title, conference:
attributes_for(:conference, title: 'Example Con')
patch :update, id: conference.short_title, conference: attributes_for(:conference, title: 'Example Con')
expect(assigns(:conference)).to eq(conference)
end
it 'changes conference attributes' do
patch :update, id: conference.short_title, conference:
attributes_for(:conference, title: 'Example Con',
short_title: 'ExCon')
short_title: 'ExCon')
conference.reload
expect(conference.title).to eq('Example Con')
@ -67,7 +66,7 @@ describe Admin::ConferenceController do
it 'does not change conference attributes' do
patch :update, id: conference.short_title, conference:
attributes_for(:conference, title: 'Example Con',
short_title: nil)
short_title: nil)
conference.reload
expect(flash[:alert]).
@ -79,7 +78,7 @@ describe Admin::ConferenceController do
it 're-renders the #show template' do
patch :update, id: conference.short_title, conference:
attributes_for(:conference, title: 'Example Con',
short_title: nil)
short_title: nil)
expect(flash[:alert]).
to eq("Updating conference failed. Short title can't be blank.")
@ -266,8 +265,8 @@ describe Admin::ConferenceController do
describe 'PATCH #update' do
it 'requires admin privileges' do
patch :update, id: conference.short_title,
conference: attributes_for(:conference,
short_title: 'ExCon')
conference: attributes_for(:conference,
short_title: 'ExCon')
expect(response).to redirect_to(send(success_path))
end
end

View file

@ -15,7 +15,7 @@ describe Campaign do
describe '#url_parameters' do
it 'returns the parameters in the correct format' do
campaign = create(:campaign, utm_source: 'google+', utm_medium: 'advertisement',
utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent')
utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent')
campaign.conference = create(:conference)
result = '?utm_source=google+&utm_medium=advertisement&utm_term=opensource&utm_content=content&utm_campaign=20percent'
@ -32,17 +32,17 @@ describe Campaign do
describe '#visits' do
it 'returns one if there is one visit' do
campaign = create(:campaign, utm_source: 'google+', utm_medium: 'advertisement',
utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent')
utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent')
campaign.conference = build(:conference)
create(:visit, utm_source: 'google+', utm_medium: 'advertisement',
utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent', started_at: Time.now)
utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent', started_at: Time.now)
expect(campaign.visits_count).to eq(1)
end
it 'returns zero if there are no visits' do
campaign = create(:campaign, utm_source: 'google+', utm_medium: 'advertisement',
utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent')
utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent')
campaign.conference = create(:conference)
expect(campaign.visits_count).to eq(0)
@ -52,7 +52,7 @@ describe Campaign do
describe '#registrations' do
it 'returns zero if there are no registration' do
campaign = build(:campaign, utm_source: 'google+', utm_medium: 'advertisement',
utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent')
utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent')
campaign.conference = build(:conference)
expect(campaign.registrations_count).to eq(0)
@ -62,7 +62,7 @@ describe Campaign do
describe '#submissions' do
it 'returns zero if there are no submissions' do
campaign = build(:campaign, utm_source: 'google+', utm_medium: 'advertisement',
utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent')
utm_term: 'opensource', utm_content: 'content', utm_campaign: '20percent')
campaign.conference = build(:conference)
expect(campaign.submissions_count).to eq(0)