Convert hashes to ruby 1.9 style

This commit is contained in:
Dmitriy Zaporozhets 2015-02-02 19:30:09 -08:00
parent 7dad2663a6
commit 4f1d1fc51b
12 changed files with 27 additions and 31 deletions

View file

@ -267,7 +267,7 @@ Style/HashSyntax:
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
{ :a => 1, :b => 2 }.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-literals'
Enabled: false
Enabled: true
Style/IfUnlessModifier:
Description: >-
@ -817,10 +817,6 @@ Lint/DeprecatedClassMethods:
Description: 'Check for deprecated class method calls.'
Enabled: false
Lint/DuplicateMethods:
Description: 'Check for duplicate methods calls.'
Enabled: false
Lint/ElseLayout:
Description: 'Check for odd code arrangement in an else block.'
Enabled: false

View file

@ -23,7 +23,7 @@ class GithubImportsController < ApplicationController
end
def jobs
jobs = current_user.created_projects.where(import_type: "github").to_json(:only => [:id, :import_status])
jobs = current_user.created_projects.where(import_type: "github").to_json(only: [:id, :import_status])
render json: jobs
end
@ -58,7 +58,7 @@ class GithubImportsController < ApplicationController
def octo_client
Octokit.auto_paginate = true
@octo_client ||= Octokit::Client.new(:access_token => current_user.github_access_token)
@octo_client ||= Octokit::Client.new(access_token: current_user.github_access_token)
end
def github_auth

View file

@ -31,7 +31,7 @@ module EmailsHelper
end
def add_email_highlight_css
Rugments::Themes::Github.render(:scope => '.highlight')
Rugments::Themes::Github.render(scope: '.highlight')
end
def color_email_diff(diffcontent)

View file

@ -15,7 +15,7 @@ module MergeRequestsHelper
end
def new_mr_from_push_event(event, target_project)
return :merge_request => {
return merge_request: {
source_project_id: event.project.id,
target_project_id: target_project.id,
source_branch: event.branch_name,

View file

@ -76,7 +76,7 @@ class MergeRequest < ActiveRecord::Base
merge_request.save
end
after_transition :locked => (any - :locked) do |merge_request, transition|
after_transition locked: (any - :locked) do |merge_request, transition|
merge_request.locked_at = nil
merge_request.save
end

View file

@ -156,22 +156,22 @@ class Project < ActiveRecord::Base
end
event :import_finish do
transition :started => :finished
transition started: :finished
end
event :import_fail do
transition :started => :failed
transition started: :failed
end
event :import_retry do
transition :failed => :started
transition failed: :started
end
state :started
state :finished
state :failed
after_transition any => :started, :do => :add_import_job
after_transition any => :started, do: :add_import_job
end
class << self

View file

@ -23,11 +23,11 @@ if File.exists?(aws_file)
if Rails.env.test?
Fog.mock!
connection = ::Fog::Storage.new(
:aws_access_key_id => AWS_CONFIG['access_key_id'],
:aws_secret_access_key => AWS_CONFIG['secret_access_key'],
:provider => 'AWS',
:region => AWS_CONFIG['region']
aws_access_key_id: AWS_CONFIG['access_key_id'],
aws_secret_access_key: AWS_CONFIG['secret_access_key'],
provider: 'AWS',
region: AWS_CONFIG['region']
)
connection.directories.create(:key => AWS_CONFIG['bucket'])
connection.directories.create(key: AWS_CONFIG['bucket'])
end
end

View file

@ -43,10 +43,10 @@ Doorkeeper.configure do
force_ssl_in_redirect_uri false
# Provide support for an owner to be assigned to each registered application (disabled by default)
# Optional parameter :confirmation => true (default false) if you want to enforce ownership of
# Optional parameter confirmation: true (default false) if you want to enforce ownership of
# a registered application
# Note: you must also run the rails g doorkeeper:application_owner generator to provide the necessary support
enable_application_owner :confirmation => false
enable_application_owner confirmation: false
# Define access token scopes for your provider
# For more information go to

View file

@ -3,9 +3,9 @@ require 'api/api'
Gitlab::Application.routes.draw do
use_doorkeeper do
controllers :applications => 'oauth/applications',
:authorized_applications => 'oauth/authorized_applications',
:authorizations => 'oauth/authorizations'
controllers applications: 'oauth/applications',
authorized_applications: 'oauth/authorized_applications',
authorizations: 'oauth/authorizations'
end
#
# Search

View file

@ -146,7 +146,7 @@ module APIGuard
Rack::OAuth2::Server::Resource::Bearer::Forbidden.new(
:insufficient_scope,
Rack::OAuth2::Server::Resource::ErrorMethods::DEFAULT_DESCRIPTION[:insufficient_scope],
{ :scope => e.scopes})
{ scope: e.scopes})
end
response.finish

View file

@ -55,7 +55,7 @@ module API
expose :path, :path_with_namespace
expose :issues_enabled, :merge_requests_enabled, :wiki_enabled, :snippets_enabled, :created_at, :last_activity_at
expose :namespace
expose :forked_from_project, using: Entities::ForkedFromProject, :if => lambda{ | project, options | project.forked? }
expose :forked_from_project, using: Entities::ForkedFromProject, if: lambda{ | project, options | project.forked? }
end
class ProjectMember < UserBasic

View file

@ -36,7 +36,7 @@ module Gitlab
def octo_client(access_token)
::Octokit.auto_paginate = true
::Octokit::Client.new(:access_token => access_token)
::Octokit::Client.new(access_token: access_token)
end
def gl_user_id(project, github_id)