Skip to content
Snippets Groups Projects
Commit 7d4b52b2 authored by Douwe Maan's avatar Douwe Maan
Browse files

Enable Style/WordArray

parent eacae005
No related branches found
No related tags found
No related merge requests found
Showing
with 38 additions and 38 deletions
Loading
@@ -491,7 +491,7 @@ Style/WhileUntilModifier:
Loading
@@ -491,7 +491,7 @@ Style/WhileUntilModifier:
   
# Use %w or %W for arrays of words. # Use %w or %W for arrays of words.
Style/WordArray: Style/WordArray:
Enabled: false Enabled: true
   
# Metrics ##################################################################### # Metrics #####################################################################
   
Loading
Loading
Loading
@@ -99,7 +99,7 @@ class TodosFinder
Loading
@@ -99,7 +99,7 @@ class TodosFinder
end end
   
def type? def type?
type.present? && ['Issue', 'MergeRequest'].include?(type) type.present? && %w(Issue MergeRequest).include?(type)
end end
   
def type def type
Loading
Loading
Loading
@@ -24,7 +24,7 @@ module EmailsHelper
Loading
@@ -24,7 +24,7 @@ module EmailsHelper
   
def action_title(url) def action_title(url)
return unless url return unless url
["merge_requests", "issues", "commit"].each do |action| %w(merge_requests issues commit).each do |action|
if url.split("/").include?(action) if url.split("/").include?(action)
return "View #{action.humanize.singularize}" return "View #{action.humanize.singularize}"
end end
Loading
Loading
Loading
@@ -99,7 +99,7 @@ module TabHelper
Loading
@@ -99,7 +99,7 @@ module TabHelper
return 'active' return 'active'
end end
   
if ['services', 'hooks', 'deploy_keys', 'protected_branches'].include? controller.controller_name if %w(services hooks deploy_keys protected_branches).include? controller.controller_name
"active" "active"
end end
end end
Loading
Loading
Loading
@@ -150,6 +150,6 @@ module TodosHelper
Loading
@@ -150,6 +150,6 @@ module TodosHelper
private private
   
def show_todo_state?(todo) def show_todo_state?(todo)
(todo.target.is_a?(MergeRequest) || todo.target.is_a?(Issue)) && ['closed', 'merged'].include?(todo.target.state) (todo.target.is_a?(MergeRequest) || todo.target.is_a?(Issue)) && %w(closed merged).include?(todo.target.state)
end end
end end
Loading
@@ -182,7 +182,7 @@ module Issuable
Loading
@@ -182,7 +182,7 @@ module Issuable
def grouping_columns(sort) def grouping_columns(sort)
grouping_columns = [arel_table[:id]] grouping_columns = [arel_table[:id]]
   
if ["milestone_due_desc", "milestone_due_asc"].include?(sort) if %w(milestone_due_desc milestone_due_asc).include?(sort)
milestone_table = Milestone.arel_table milestone_table = Milestone.arel_table
grouping_columns << milestone_table[:id] grouping_columns << milestone_table[:id]
grouping_columns << milestone_table[:due_date] grouping_columns << milestone_table[:due_date]
Loading
Loading
Loading
@@ -8,7 +8,7 @@ class DiffNote < Note
Loading
@@ -8,7 +8,7 @@ class DiffNote < Note
validates :position, presence: true validates :position, presence: true
validates :diff_line, presence: true validates :diff_line, presence: true
validates :line_code, presence: true, line_code: true validates :line_code, presence: true, line_code: true
validates :noteable_type, inclusion: { in: ['Commit', 'MergeRequest'] } validates :noteable_type, inclusion: { in: %w(Commit MergeRequest) }
validates :resolved_by, presence: true, if: :resolved? validates :resolved_by, presence: true, if: :resolved?
validate :positions_complete validate :positions_complete
validate :verify_supported validate :verify_supported
Loading
Loading
Loading
@@ -47,7 +47,7 @@ class Event < ActiveRecord::Base
Loading
@@ -47,7 +47,7 @@ class Event < ActiveRecord::Base
def contributions def contributions
where("action = ? OR (target_type IN (?) AND action IN (?)) OR (target_type = ? AND action = ?)", where("action = ? OR (target_type IN (?) AND action IN (?)) OR (target_type = ? AND action = ?)",
Event::PUSHED, Event::PUSHED,
["MergeRequest", "Issue"], [Event::CREATED, Event::CLOSED, Event::MERGED], %w(MergeRequest Issue), [Event::CREATED, Event::CLOSED, Event::MERGED],
"Note", Event::COMMENTED) "Note", Event::COMMENTED)
end end
   
Loading
Loading
Loading
@@ -72,7 +72,7 @@ class Note < ActiveRecord::Base
Loading
@@ -72,7 +72,7 @@ class Note < ActiveRecord::Base
scope :inc_author, ->{ includes(:author) } scope :inc_author, ->{ includes(:author) }
scope :inc_relations_for_view, ->{ includes(:project, :author, :updated_by, :resolved_by, :award_emoji) } scope :inc_relations_for_view, ->{ includes(:project, :author, :updated_by, :resolved_by, :award_emoji) }
   
scope :diff_notes, ->{ where(type: ['LegacyDiffNote', 'DiffNote']) } scope :diff_notes, ->{ where(type: %w(LegacyDiffNote DiffNote)) }
scope :non_diff_notes, ->{ where(type: ['Note', nil]) } scope :non_diff_notes, ->{ where(type: ['Note', nil]) }
   
scope :with_associations, -> do scope :with_associations, -> do
Loading
Loading
Loading
@@ -114,7 +114,7 @@ class DroneCiService < CiService
Loading
@@ -114,7 +114,7 @@ class DroneCiService < CiService
end end
   
def merge_request_valid?(data) def merge_request_valid?(data)
['opened', 'reopened'].include?(data[:object_attributes][:state]) && %w(opened reopened).include?(data[:object_attributes][:state]) &&
data[:object_attributes][:merge_status] == 'unchecked' data[:object_attributes][:merge_status] == 'unchecked'
end end
end end
Loading
@@ -36,7 +36,7 @@ class HipchatService < Service
Loading
@@ -36,7 +36,7 @@ class HipchatService < Service
{ type: 'text', name: 'token', placeholder: 'Room token' }, { type: 'text', name: 'token', placeholder: 'Room token' },
{ type: 'text', name: 'room', placeholder: 'Room name or ID' }, { type: 'text', name: 'room', placeholder: 'Room name or ID' },
{ type: 'checkbox', name: 'notify' }, { type: 'checkbox', name: 'notify' },
{ type: 'select', name: 'color', choices: ['yellow', 'red', 'green', 'purple', 'gray', 'random'] }, { type: 'select', name: 'color', choices: %w(yellow red green purple gray random) },
{ type: 'text', name: 'api_version', { type: 'text', name: 'api_version',
placeholder: 'Leave blank for default (v2)' }, placeholder: 'Leave blank for default (v2)' },
{ type: 'text', name: 'server', { type: 'text', name: 'server',
Loading
Loading
Loading
@@ -34,19 +34,19 @@ class PushoverService < Service
Loading
@@ -34,19 +34,19 @@ class PushoverService < Service
[ [
['Device default sound', nil], ['Device default sound', nil],
['Pushover (default)', 'pushover'], ['Pushover (default)', 'pushover'],
['Bike', 'bike'], %w(Bike bike),
['Bugle', 'bugle'], %w(Bugle bugle),
['Cash Register', 'cashregister'], ['Cash Register', 'cashregister'],
['Classical', 'classical'], %w(Classical classical),
['Cosmic', 'cosmic'], %w(Cosmic cosmic),
['Falling', 'falling'], %w(Falling falling),
['Gamelan', 'gamelan'], %w(Gamelan gamelan),
['Incoming', 'incoming'], %w(Incoming incoming),
['Intermission', 'intermission'], %w(Intermission intermission),
['Magic', 'magic'], %w(Magic magic),
['Mechanical', 'mechanical'], %w(Mechanical mechanical),
['Piano Bar', 'pianobar'], ['Piano Bar', 'pianobar'],
['Siren', 'siren'], %w(Siren siren),
['Space Alarm', 'spacealarm'], ['Space Alarm', 'spacealarm'],
['Tug Boat', 'tugboat'], ['Tug Boat', 'tugboat'],
['Alien Alarm (long)', 'alien'], ['Alien Alarm (long)', 'alien'],
Loading
Loading
Loading
@@ -25,7 +25,7 @@ module Projects
Loading
@@ -25,7 +25,7 @@ module Projects
end end
   
def http?(url) def http?(url)
url =~ /\A#{URI.regexp(['http', 'https'])}\z/ url =~ /\A#{URI.regexp(%w(http https))}\z/
end end
   
def valid_domain?(url) def valid_domain?(url)
Loading
Loading
HealthCheck.setup do |config| HealthCheck.setup do |config|
config.standard_checks = ['database', 'migrations', 'cache'] config.standard_checks = %w(database migrations cache)
config.full_checks = ['database', 'migrations', 'cache'] config.full_checks = %w(database migrations cache)
end end
Loading
@@ -20,13 +20,13 @@ def instrument_classes(instrumentation)
Loading
@@ -20,13 +20,13 @@ def instrument_classes(instrumentation)
   
# Path to search => prefix to strip from constant # Path to search => prefix to strip from constant
paths_to_instrument = { paths_to_instrument = {
['app', 'finders'] => ['app', 'finders'], %w(app finders) => %w(app finders),
['app', 'mailers', 'emails'] => ['app', 'mailers'], %w(app mailers emails) => %w(app mailers),
['app', 'services', '**'] => ['app', 'services'], ['app', 'services', '**'] => %w(app services),
['lib', 'gitlab', 'conflicts'] => ['lib'], %w(lib gitlab conflicts) => ['lib'],
['lib', 'gitlab', 'diff'] => ['lib'], %w(lib gitlab diff) => ['lib'],
['lib', 'gitlab', 'email', 'message'] => ['lib'], %w(lib gitlab email message) => ['lib'],
['lib', 'gitlab', 'checks'] => ['lib'] %w(lib gitlab checks) => ['lib']
} }
   
paths_to_instrument.each do |(path, prefix)| paths_to_instrument.each do |(path, prefix)|
Loading
Loading
Loading
@@ -12,7 +12,7 @@ class RemoveUnnecessaryIndexes < ActiveRecord::Migration
Loading
@@ -12,7 +12,7 @@ class RemoveUnnecessaryIndexes < ActiveRecord::Migration
remove_index :award_emoji, column: :user_id if index_exists?(:award_emoji, :user_id) remove_index :award_emoji, column: :user_id if index_exists?(:award_emoji, :user_id)
remove_index :ci_builds, column: :commit_id if index_exists?(:ci_builds, :commit_id) remove_index :ci_builds, column: :commit_id if index_exists?(:ci_builds, :commit_id)
remove_index :deployments, column: :project_id if index_exists?(:deployments, :project_id) remove_index :deployments, column: :project_id if index_exists?(:deployments, :project_id)
remove_index :deployments, column: ["project_id", "environment_id"] if index_exists?(:deployments, ["project_id", "environment_id"]) remove_index :deployments, column: %w(project_id environment_id) if index_exists?(:deployments, %w(project_id environment_id))
remove_index :lists, column: :board_id if index_exists?(:lists, :board_id) remove_index :lists, column: :board_id if index_exists?(:lists, :board_id)
remove_index :milestones, column: :project_id if index_exists?(:milestones, :project_id) remove_index :milestones, column: :project_id if index_exists?(:milestones, :project_id)
remove_index :notes, column: :project_id if index_exists?(:notes, :project_id) remove_index :notes, column: :project_id if index_exists?(:notes, :project_id)
Loading
@@ -24,7 +24,7 @@ class RemoveUnnecessaryIndexes < ActiveRecord::Migration
Loading
@@ -24,7 +24,7 @@ class RemoveUnnecessaryIndexes < ActiveRecord::Migration
add_concurrent_index :award_emoji, :user_id add_concurrent_index :award_emoji, :user_id
add_concurrent_index :ci_builds, :commit_id add_concurrent_index :ci_builds, :commit_id
add_concurrent_index :deployments, :project_id add_concurrent_index :deployments, :project_id
add_concurrent_index :deployments, ["project_id", "environment_id"] add_concurrent_index :deployments, %w(project_id environment_id)
add_concurrent_index :lists, :board_id add_concurrent_index :lists, :board_id
add_concurrent_index :milestones, :project_id add_concurrent_index :milestones, :project_id
add_concurrent_index :notes, :project_id add_concurrent_index :notes, :project_id
Loading
Loading
Loading
@@ -76,7 +76,7 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps
Loading
@@ -76,7 +76,7 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps
base64_params = send_data.sub(/\Aartifacts\-entry:/, '') base64_params = send_data.sub(/\Aartifacts\-entry:/, '')
params = JSON.parse(Base64.urlsafe_decode64(base64_params)) params = JSON.parse(Base64.urlsafe_decode64(base64_params))
   
expect(params.keys).to eq(['Archive', 'Entry']) expect(params.keys).to eq(%w(Archive Entry))
expect(params['Archive']).to end_with('build_artifacts.zip') expect(params['Archive']).to end_with('build_artifacts.zip')
expect(params['Entry']).to eq(Base64.encode64('ci_artifacts.txt')) expect(params['Entry']).to eq(Base64.encode64('ci_artifacts.txt'))
end end
Loading
Loading
Loading
@@ -40,7 +40,7 @@ module API
Loading
@@ -40,7 +40,7 @@ module API
requires :id, type: String, desc: 'The ID of a project' requires :id, type: String, desc: 'The ID of a project'
requires :sha, type: String, desc: 'The commit hash' requires :sha, type: String, desc: 'The commit hash'
requires :state, type: String, desc: 'The state of the status', requires :state, type: String, desc: 'The state of the status',
values: ['pending', 'running', 'success', 'failed', 'canceled'] values: %w(pending running success failed canceled)
optional :ref, type: String, desc: 'The ref' optional :ref, type: String, desc: 'The ref'
optional :target_url, type: String, desc: 'The target URL to associate with this status' optional :target_url, type: String, desc: 'The target URL to associate with this status'
optional :description, type: String, desc: 'A short description of the status' optional :description, type: String, desc: 'A short description of the status'
Loading
Loading
Loading
@@ -157,7 +157,7 @@ module API
Loading
@@ -157,7 +157,7 @@ module API
optional :path, type: String, desc: 'The file path' optional :path, type: String, desc: 'The file path'
given :path do given :path do
requires :line, type: Integer, desc: 'The line number' requires :line, type: Integer, desc: 'The line number'
requires :line_type, type: String, values: ['new', 'old'], default: 'new', desc: 'The type of the line' requires :line_type, type: String, values: %w(new old), default: 'new', desc: 'The type of the line'
end end
end end
post ':id/repository/commits/:sha/comments' do post ':id/repository/commits/:sha/comments' do
Loading
Loading
Loading
@@ -14,7 +14,7 @@ module API
Loading
@@ -14,7 +14,7 @@ module API
end end
params do params do
use :pagination use :pagination
optional :scope, type: String, values: ['running', 'branches', 'tags'], optional :scope, type: String, values: %w(running branches tags),
desc: 'Either running, branches, or tags' desc: 'Either running, branches, or tags'
end end
get ':id/pipelines' do get ':id/pipelines' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment