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
Loading
@@ -491,7 +491,7 @@ Style/WhileUntilModifier:
 
# Use %w or %W for arrays of words.
Style/WordArray:
Enabled: false
Enabled: true
 
# Metrics #####################################################################
 
Loading
Loading
Loading
Loading
@@ -99,7 +99,7 @@ class TodosFinder
end
 
def type?
type.present? && ['Issue', 'MergeRequest'].include?(type)
type.present? && %w(Issue MergeRequest).include?(type)
end
 
def type
Loading
Loading
Loading
Loading
@@ -24,7 +24,7 @@ module EmailsHelper
 
def action_title(url)
return unless url
["merge_requests", "issues", "commit"].each do |action|
%w(merge_requests issues commit).each do |action|
if url.split("/").include?(action)
return "View #{action.humanize.singularize}"
end
Loading
Loading
Loading
Loading
@@ -99,7 +99,7 @@ module TabHelper
return 'active'
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"
end
end
Loading
Loading
Loading
Loading
@@ -150,6 +150,6 @@ module TodosHelper
private
 
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
Loading
Loading
@@ -182,7 +182,7 @@ module Issuable
def grouping_columns(sort)
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
grouping_columns << milestone_table[:id]
grouping_columns << milestone_table[:due_date]
Loading
Loading
Loading
Loading
@@ -8,7 +8,7 @@ class DiffNote < Note
validates :position, presence: true
validates :diff_line, presence: 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?
validate :positions_complete
validate :verify_supported
Loading
Loading
Loading
Loading
@@ -47,7 +47,7 @@ class Event < ActiveRecord::Base
def contributions
where("action = ? OR (target_type IN (?) AND action IN (?)) OR (target_type = ? AND action = ?)",
Event::PUSHED,
["MergeRequest", "Issue"], [Event::CREATED, Event::CLOSED, Event::MERGED],
%w(MergeRequest Issue), [Event::CREATED, Event::CLOSED, Event::MERGED],
"Note", Event::COMMENTED)
end
 
Loading
Loading
Loading
Loading
@@ -72,7 +72,7 @@ class Note < ActiveRecord::Base
scope :inc_author, ->{ includes(:author) }
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 :with_associations, -> do
Loading
Loading
Loading
Loading
@@ -114,7 +114,7 @@ class DroneCiService < CiService
end
 
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'
end
end
Loading
Loading
@@ -36,7 +36,7 @@ class HipchatService < Service
{ type: 'text', name: 'token', placeholder: 'Room token' },
{ type: 'text', name: 'room', placeholder: 'Room name or ID' },
{ 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',
placeholder: 'Leave blank for default (v2)' },
{ type: 'text', name: 'server',
Loading
Loading
Loading
Loading
@@ -34,19 +34,19 @@ class PushoverService < Service
[
['Device default sound', nil],
['Pushover (default)', 'pushover'],
['Bike', 'bike'],
['Bugle', 'bugle'],
%w(Bike bike),
%w(Bugle bugle),
['Cash Register', 'cashregister'],
['Classical', 'classical'],
['Cosmic', 'cosmic'],
['Falling', 'falling'],
['Gamelan', 'gamelan'],
['Incoming', 'incoming'],
['Intermission', 'intermission'],
['Magic', 'magic'],
['Mechanical', 'mechanical'],
%w(Classical classical),
%w(Cosmic cosmic),
%w(Falling falling),
%w(Gamelan gamelan),
%w(Incoming incoming),
%w(Intermission intermission),
%w(Magic magic),
%w(Mechanical mechanical),
['Piano Bar', 'pianobar'],
['Siren', 'siren'],
%w(Siren siren),
['Space Alarm', 'spacealarm'],
['Tug Boat', 'tugboat'],
['Alien Alarm (long)', 'alien'],
Loading
Loading
Loading
Loading
@@ -25,7 +25,7 @@ module Projects
end
 
def http?(url)
url =~ /\A#{URI.regexp(['http', 'https'])}\z/
url =~ /\A#{URI.regexp(%w(http https))}\z/
end
 
def valid_domain?(url)
Loading
Loading
HealthCheck.setup do |config|
config.standard_checks = ['database', 'migrations', 'cache']
config.full_checks = ['database', 'migrations', 'cache']
config.standard_checks = %w(database migrations cache)
config.full_checks = %w(database migrations cache)
end
Loading
Loading
@@ -20,13 +20,13 @@ def instrument_classes(instrumentation)
 
# Path to search => prefix to strip from constant
paths_to_instrument = {
['app', 'finders'] => ['app', 'finders'],
['app', 'mailers', 'emails'] => ['app', 'mailers'],
['app', 'services', '**'] => ['app', 'services'],
['lib', 'gitlab', 'conflicts'] => ['lib'],
['lib', 'gitlab', 'diff'] => ['lib'],
['lib', 'gitlab', 'email', 'message'] => ['lib'],
['lib', 'gitlab', 'checks'] => ['lib']
%w(app finders) => %w(app finders),
%w(app mailers emails) => %w(app mailers),
['app', 'services', '**'] => %w(app services),
%w(lib gitlab conflicts) => ['lib'],
%w(lib gitlab diff) => ['lib'],
%w(lib gitlab email message) => ['lib'],
%w(lib gitlab checks) => ['lib']
}
 
paths_to_instrument.each do |(path, prefix)|
Loading
Loading
Loading
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 :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", "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 :milestones, column: :project_id if index_exists?(:milestones, :project_id)
remove_index :notes, column: :project_id if index_exists?(:notes, :project_id)
Loading
Loading
@@ -24,7 +24,7 @@ class RemoveUnnecessaryIndexes < ActiveRecord::Migration
add_concurrent_index :award_emoji, :user_id
add_concurrent_index :ci_builds, :commit_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 :milestones, :project_id
add_concurrent_index :notes, :project_id
Loading
Loading
Loading
Loading
@@ -76,7 +76,7 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps
base64_params = send_data.sub(/\Aartifacts\-entry:/, '')
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['Entry']).to eq(Base64.encode64('ci_artifacts.txt'))
end
Loading
Loading
Loading
Loading
@@ -40,7 +40,7 @@ module API
requires :id, type: String, desc: 'The ID of a project'
requires :sha, type: String, desc: 'The commit hash'
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 :target_url, type: String, desc: 'The target URL to associate with this status'
optional :description, type: String, desc: 'A short description of the status'
Loading
Loading
Loading
Loading
@@ -157,7 +157,7 @@ module API
optional :path, type: String, desc: 'The file path'
given :path do
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
post ':id/repository/commits/:sha/comments' do
Loading
Loading
Loading
Loading
@@ -14,7 +14,7 @@ module API
end
params do
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'
end
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