diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-02 19:30:09 -0800 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-02 19:30:09 -0800 |
commit | 4f1d1fc51baf396d49f6b159c84e15194706847c (patch) | |
tree | 3b4ff8c22e5eaa4276813d661b37192d3f538994 | |
parent | 7dad2663a671be5cc70db63333dfe033984452d0 (diff) | |
download | gitlab-ce-4f1d1fc51baf396d49f6b159c84e15194706847c.tar.gz |
Convert hashes to ruby 1.9 style
-rw-r--r-- | .rubocop.yml | 6 | ||||
-rw-r--r-- | app/controllers/github_imports_controller.rb | 4 | ||||
-rw-r--r-- | app/helpers/emails_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/merge_requests_helper.rb | 2 | ||||
-rw-r--r-- | app/models/merge_request.rb | 2 | ||||
-rw-r--r-- | app/models/project.rb | 8 | ||||
-rw-r--r-- | config/initializers/carrierwave.rb | 10 | ||||
-rw-r--r-- | config/initializers/doorkeeper.rb | 4 | ||||
-rw-r--r-- | config/routes.rb | 6 | ||||
-rw-r--r-- | lib/api/api_guard.rb | 4 | ||||
-rw-r--r-- | lib/api/entities.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/github/importer.rb | 8 |
12 files changed, 27 insertions, 31 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index 8f54d5d3765..807527e8d4b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -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 diff --git a/app/controllers/github_imports_controller.rb b/app/controllers/github_imports_controller.rb index 3c5448bc709..b73e3f7ffac 100644 --- a/app/controllers/github_imports_controller.rb +++ b/app/controllers/github_imports_controller.rb @@ -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 diff --git a/app/helpers/emails_helper.rb b/app/helpers/emails_helper.rb index b336263049c..92cc9c426b8 100644 --- a/app/helpers/emails_helper.rb +++ b/app/helpers/emails_helper.rb @@ -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) diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb index fe6fd5832fc..2c9aeba570a 100644 --- a/app/helpers/merge_requests_helper.rb +++ b/app/helpers/merge_requests_helper.rb @@ -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, diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 715257f905f..ad2e8d7879b 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -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 diff --git a/app/models/project.rb b/app/models/project.rb index f3dddc28adb..f314ed9bd25 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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 diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index d0065b63e54..10dfc30a0c5 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -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 diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb index 4819ab273dc..e9b843e29b4 100644 --- a/config/initializers/doorkeeper.rb +++ b/config/initializers/doorkeeper.rb @@ -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 diff --git a/config/routes.rb b/config/routes.rb index e122777314a..30df1ba0dfe 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/lib/api/api_guard.rb b/lib/api/api_guard.rb index 23975518181..28765b142f6 100644 --- a/lib/api/api_guard.rb +++ b/lib/api/api_guard.rb @@ -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 @@ -172,4 +172,4 @@ module APIGuard @scopes = scopes end end -end
\ No newline at end of file +end diff --git a/lib/api/entities.rb b/lib/api/entities.rb index ac166ed4fba..58339908fd2 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -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 diff --git a/lib/gitlab/github/importer.rb b/lib/gitlab/github/importer.rb index c72a1c25e9e..9f0fc6c4471 100644 --- a/lib/gitlab/github/importer.rb +++ b/lib/gitlab/github/importer.rb @@ -9,12 +9,12 @@ module Gitlab def execute client = octo_client(project.creator.github_access_token) - + #Issues && Comments client.list_issues(project.import_source, state: :all).each do |issue| if issue.pull_request.nil? body = "*Created by: #{issue.user.login}*\n\n#{issue.body}" - + if issue.comments > 0 body += "\n\n\n**Imported comments:**\n" client.issue_comments(project.import_source, issue.number).each do |c| @@ -23,7 +23,7 @@ module Gitlab end project.issues.create!( - description: body, + description: body, title: issue.title, state: issue.state == 'closed' ? 'closed' : 'opened', author_id: gl_user_id(project, issue.user.id) @@ -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) |