diff options
Diffstat (limited to 'lib')
30 files changed, 49 insertions, 49 deletions
diff --git a/lib/api/deploy_keys.rb b/lib/api/deploy_keys.rb index 825e05fbae3..f743cbb5cca 100644 --- a/lib/api/deploy_keys.rb +++ b/lib/api/deploy_keys.rb @@ -19,7 +19,7 @@ module API # Routing "projects/:id/keys/..." is DEPRECATED and WILL BE REMOVED in version 9.0 # Use "projects/:id/deploy_keys/..." instead. # - %w(keys deploy_keys).each do |path| + %w[keys deploy_keys].each do |path| desc "Get a specific project's deploy keys" do success Entities::SSHKey end diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 714d4ea3dc6..f00937ce94c 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -338,7 +338,7 @@ module API end def project_order_by - order_fields = %w(id name path created_at updated_at last_activity_at) + order_fields = %w[id name path created_at updated_at last_activity_at] if order_fields.include?(params['order_by']) params['order_by'] @@ -367,7 +367,7 @@ module API # sanitize file paths # this requires all paths to exist - required_attributes! %W(#{field}.path) + required_attributes! %W[#{field}.path] uploads_path = File.realpath(uploads_path) file_path = File.realpath(params["#{field}.path"]) bad_request!('Bad file path') unless file_path.start_with?(uploads_path) diff --git a/lib/banzai/filter/autolink_filter.rb b/lib/banzai/filter/autolink_filter.rb index 799b83b1069..475ea86a999 100644 --- a/lib/banzai/filter/autolink_filter.rb +++ b/lib/banzai/filter/autolink_filter.rb @@ -29,7 +29,7 @@ module Banzai LINK_PATTERN = %r{([a-z][a-z0-9\+\.-]+://\S+)(?<!,|\.)} # Text matching LINK_PATTERN inside these elements will not be linked - IGNORE_PARENTS = %w(a code kbd pre script style).to_set + IGNORE_PARENTS = %w[a code kbd pre script style].to_set # The XPath query to use for finding text nodes to parse. TEXT_QUERY = %Q(descendant-or-self::text()[ diff --git a/lib/banzai/filter/emoji_filter.rb b/lib/banzai/filter/emoji_filter.rb index 2492b5213ac..5f665964f48 100644 --- a/lib/banzai/filter/emoji_filter.rb +++ b/lib/banzai/filter/emoji_filter.rb @@ -8,7 +8,7 @@ module Banzai # :asset_root # :asset_host class EmojiFilter < HTML::Pipeline::Filter - IGNORED_ANCESTOR_TAGS = %w(pre code tt).to_set + IGNORED_ANCESTOR_TAGS = %w[pre code tt].to_set def call search_text_nodes(doc).each do |node| diff --git a/lib/banzai/filter/gollum_tags_filter.rb b/lib/banzai/filter/gollum_tags_filter.rb index d08267a9d6c..696cffc77b0 100644 --- a/lib/banzai/filter/gollum_tags_filter.rb +++ b/lib/banzai/filter/gollum_tags_filter.rb @@ -133,7 +133,7 @@ module Banzai end def url?(path) - path.start_with?(*%w(http https)) + path.start_with?(*%w[http https]) end # Attempt to process the tag as a page link tag. diff --git a/lib/banzai/filter/inline_diff_filter.rb b/lib/banzai/filter/inline_diff_filter.rb index beb21b19ab3..8744e8063d1 100644 --- a/lib/banzai/filter/inline_diff_filter.rb +++ b/lib/banzai/filter/inline_diff_filter.rb @@ -1,7 +1,7 @@ module Banzai module Filter class InlineDiffFilter < HTML::Pipeline::Filter - IGNORED_ANCESTOR_TAGS = %w(pre code tt).to_set + IGNORED_ANCESTOR_TAGS = %w[pre code tt].to_set def call search_text_nodes(doc).each do |node| diff --git a/lib/banzai/filter/reference_filter.rb b/lib/banzai/filter/reference_filter.rb index 2d221290f7e..686f76b124d 100644 --- a/lib/banzai/filter/reference_filter.rb +++ b/lib/banzai/filter/reference_filter.rb @@ -40,7 +40,7 @@ module Banzai def ignore_ancestor_query @ignore_ancestor_query ||= begin - parents = %w(pre code a style) + parents = %w[pre code a style] parents << 'blockquote' if context[:ignore_blockquotes] parents.map { |n| "ancestor::#{n}" }.join(' or ') diff --git a/lib/banzai/filter/sanitization_filter.rb b/lib/banzai/filter/sanitization_filter.rb index 2470362e019..419ba27ba15 100644 --- a/lib/banzai/filter/sanitization_filter.rb +++ b/lib/banzai/filter/sanitization_filter.rb @@ -4,7 +4,7 @@ module Banzai # # Extends HTML::Pipeline::SanitizationFilter with a custom whitelist. class SanitizationFilter < HTML::Pipeline::SanitizationFilter - UNSAFE_PROTOCOLS = %w(data javascript vbscript).freeze + UNSAFE_PROTOCOLS = %w[data javascript vbscript].freeze def whitelist whitelist = super @@ -25,19 +25,19 @@ module Banzai return if customized?(whitelist[:transformers]) # Allow code highlighting - whitelist[:attributes]['pre'] = %w(class) - whitelist[:attributes]['span'] = %w(class) + whitelist[:attributes]['pre'] = %w[class] + whitelist[:attributes]['span'] = %w[class] # Allow table alignment - whitelist[:attributes]['th'] = %w(style) - whitelist[:attributes]['td'] = %w(style) + whitelist[:attributes]['th'] = %w[style] + whitelist[:attributes]['td'] = %w[style] # Allow span elements whitelist[:elements].push('span') # Allow abbr elements with title attribute whitelist[:elements].push('abbr') - whitelist[:attributes]['abbr'] = %w(title) + whitelist[:attributes]['abbr'] = %w[title] # Allow any protocol in `a` elements... whitelist[:protocols].delete('a') diff --git a/lib/banzai/filter/table_of_contents_filter.rb b/lib/banzai/filter/table_of_contents_filter.rb index a4eda6fdf76..36e19ea24e3 100644 --- a/lib/banzai/filter/table_of_contents_filter.rb +++ b/lib/banzai/filter/table_of_contents_filter.rb @@ -41,7 +41,7 @@ module Banzai end end - result[:toc] = %Q{<ul class="section-nav">\n#{result[:toc]}</ul>} unless result[:toc].empty? + result[:toc] = %Q(<ul class="section-nav">\n#{result[:toc]}</ul>) unless result[:toc].empty? doc end @@ -49,11 +49,11 @@ module Banzai private def anchor_tag(href) - %Q{<a id="#{href}" class="anchor" href="##{href}" aria-hidden="true"></a>} + %Q(<a id="#{href}" class="anchor" href="##{href}" aria-hidden="true"></a>) end def push_toc(href, text) - result[:toc] << %Q{<li><a href="##{href}">#{text}</a></li>\n} + result[:toc] << %Q(<li><a href="##{href}">#{text}</a></li>\n) end end end diff --git a/lib/banzai/pipeline/base_pipeline.rb b/lib/banzai/pipeline/base_pipeline.rb index 321fd5bbe14..88b73a846a1 100644 --- a/lib/banzai/pipeline/base_pipeline.rb +++ b/lib/banzai/pipeline/base_pipeline.rb @@ -14,7 +14,7 @@ module Banzai end class << self - %i(call to_document to_html).each do |meth| + %i[call to_document to_html].each do |meth| define_method(meth) do |text, context| context = transform_context(context) diff --git a/lib/banzai/pipeline/description_pipeline.rb b/lib/banzai/pipeline/description_pipeline.rb index 042fb2e6e14..e1301943b3c 100644 --- a/lib/banzai/pipeline/description_pipeline.rb +++ b/lib/banzai/pipeline/description_pipeline.rb @@ -2,7 +2,7 @@ module Banzai module Pipeline class DescriptionPipeline < FullPipeline WHITELIST = Banzai::Filter::SanitizationFilter::LIMITED.deep_dup.merge( - elements: Banzai::Filter::SanitizationFilter::LIMITED[:elements] - %w(pre code img ol ul li) + elements: Banzai::Filter::SanitizationFilter::LIMITED[:elements] - %w[pre code img ol ul li] ) def self.transform_context(context) diff --git a/lib/ci/ansi2html.rb b/lib/ci/ansi2html.rb index 229050151d3..12d5eeaf4ad 100644 --- a/lib/ci/ansi2html.rb +++ b/lib/ci/ansi2html.rb @@ -170,13 +170,13 @@ module Ci return if css_classes.empty? - @out << %{<span class="#{css_classes.join(' ')}">} + @out << %(<span class="#{css_classes.join(' ')}">) @n_open_tags += 1 end def close_open_tags while @n_open_tags > 0 - @out << %{</span>} + @out << %(</span>) @n_open_tags -= 1 end end diff --git a/lib/event_filter.rb b/lib/event_filter.rb index 668d2fa41b3..a6e07be76a2 100644 --- a/lib/event_filter.rb +++ b/lib/event_filter.rb @@ -3,7 +3,7 @@ class EventFilter class << self def default_filter - %w{ push issues merge_requests team} + %w[push issues merge_requests team] end def push diff --git a/lib/gitlab/backend/shell.rb b/lib/gitlab/backend/shell.rb index 79eac66b364..b836d72f59d 100644 --- a/lib/gitlab/backend/shell.rb +++ b/lib/gitlab/backend/shell.rb @@ -124,7 +124,7 @@ module Gitlab # Ex. # batch_add_keys { |adder| adder.add_key("key-42", "sha-rsa ...") } def batch_add_keys(&block) - IO.popen(%W(#{gitlab_shell_path}/bin/gitlab-keys batch-add-keys), 'w') do |io| + IO.popen(%W[#{gitlab_shell_path}/bin/gitlab-keys batch-add-keys], 'w') do |io| block.call(KeyAdder.new(io)) end end diff --git a/lib/gitlab/bitbucket_import/importer.rb b/lib/gitlab/bitbucket_import/importer.rb index f4b5097adb1..d57daffea5d 100644 --- a/lib/gitlab/bitbucket_import/importer.rb +++ b/lib/gitlab/bitbucket_import/importer.rb @@ -73,7 +73,7 @@ module Gitlab project.issues.create!( description: body, title: issue["title"], - state: %w(resolved invalid duplicate wontfix closed).include?(issue["status"]) ? 'closed' : 'opened', + state: %w[resolved invalid duplicate wontfix closed].include?(issue["status"]) ? 'closed' : 'opened', author_id: gitlab_user_id(project, reporter) ) end diff --git a/lib/gitlab/checks/force_push.rb b/lib/gitlab/checks/force_push.rb index 5fe86553bd0..7ea197e4d81 100644 --- a/lib/gitlab/checks/force_push.rb +++ b/lib/gitlab/checks/force_push.rb @@ -8,7 +8,7 @@ module Gitlab if Gitlab::Git.blank_ref?(oldrev) || Gitlab::Git.blank_ref?(newrev) false else - missed_ref, _ = Gitlab::Popen.popen(%W(#{Gitlab.config.git.bin_path} --git-dir=#{project.repository.path_to_repo} rev-list --max-count=1 #{oldrev} ^#{newrev})) + missed_ref, _ = Gitlab::Popen.popen(%W[#{Gitlab.config.git.bin_path} --git-dir=#{project.repository.path_to_repo} rev-list --max-count=1 #{oldrev} ^#{newrev}]) missed_ref.present? end end diff --git a/lib/gitlab/closing_issue_extractor.rb b/lib/gitlab/closing_issue_extractor.rb index 58f86abc5c4..71e619f434b 100644 --- a/lib/gitlab/closing_issue_extractor.rb +++ b/lib/gitlab/closing_issue_extractor.rb @@ -1,7 +1,7 @@ module Gitlab class ClosingIssueExtractor ISSUE_CLOSING_REGEX = begin - link_pattern = URI.regexp(%w(http https)) + link_pattern = URI.regexp(%w[http https]) pattern = Gitlab.config.gitlab.issue_closing_pattern pattern = pattern.sub('%{issue_ref}', "(?:(?:#{link_pattern})|(?:#{Issue.reference_pattern}))") diff --git a/lib/gitlab/diff/line.rb b/lib/gitlab/diff/line.rb index 80a146b4a5a..425cf4d33b1 100644 --- a/lib/gitlab/diff/line.rb +++ b/lib/gitlab/diff/line.rb @@ -16,7 +16,7 @@ module Gitlab end def serialize_keys - @serialize_keys ||= %i(text type index old_pos new_pos) + @serialize_keys ||= %i[text type index old_pos new_pos] end def to_hash diff --git a/lib/gitlab/email/reply_parser.rb b/lib/gitlab/email/reply_parser.rb index 3411eb1d9ce..904fb19f545 100644 --- a/lib/gitlab/email/reply_parser.rb +++ b/lib/gitlab/email/reply_parser.rb @@ -51,7 +51,7 @@ module Gitlab nil end - REPLYING_HEADER_LABELS = %w(From Sent To Subject Reply To Cc Bcc Date) + REPLYING_HEADER_LABELS = %w[From Sent To Subject Reply To Cc Bcc Date] REPLYING_HEADER_REGEX = Regexp.union(REPLYING_HEADER_LABELS.map { |label| "#{label}:" }) def discourse_email_trimmer(body) diff --git a/lib/gitlab/git.rb b/lib/gitlab/git.rb index 3cd515e4a3a..b6572137413 100644 --- a/lib/gitlab/git.rb +++ b/lib/gitlab/git.rb @@ -50,7 +50,7 @@ module Gitlab end def version - Gitlab::VersionInfo.parse(Gitlab::Popen.popen(%W(#{Gitlab.config.git.bin_path} --version)).first) + Gitlab::VersionInfo.parse(Gitlab::Popen.popen(%W[#{Gitlab.config.git.bin_path} --version]).first) end end end diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb index 799794c0171..ba90ee4d336 100644 --- a/lib/gitlab/git_access.rb +++ b/lib/gitlab/git_access.rb @@ -2,8 +2,8 @@ # class return an instance of `GitlabAccessStatus` module Gitlab class GitAccess - DOWNLOAD_COMMANDS = %w{ git-upload-pack git-upload-archive } - PUSH_COMMANDS = %w{ git-receive-pack } + DOWNLOAD_COMMANDS = %w[git-upload-pack git-upload-archive] + PUSH_COMMANDS = %w[git-receive-pack] attr_reader :actor, :project, :protocol, :user_access, :authentication_abilities diff --git a/lib/gitlab/git_ref_validator.rb b/lib/gitlab/git_ref_validator.rb index 4d83d8e72a8..7b18c04c799 100644 --- a/lib/gitlab/git_ref_validator.rb +++ b/lib/gitlab/git_ref_validator.rb @@ -6,7 +6,7 @@ module Gitlab # Returns true for a valid reference name, false otherwise def validate(ref_name) Gitlab::Utils.system_silent( - %W(#{Gitlab.config.git.bin_path} check-ref-format refs/#{ref_name})) + %W[#{Gitlab.config.git.bin_path} check-ref-format refs/#{ref_name}]) end end end diff --git a/lib/gitlab/import_export/command_line_util.rb b/lib/gitlab/import_export/command_line_util.rb index e522a0fc8f6..d03615f413e 100644 --- a/lib/gitlab/import_export/command_line_util.rb +++ b/lib/gitlab/import_export/command_line_util.rb @@ -10,25 +10,25 @@ module Gitlab end def git_bundle(repo_path:, bundle_path:) - execute(%W(#{git_bin_path} --git-dir=#{repo_path} bundle create #{bundle_path} --all)) + execute(%W[#{git_bin_path} --git-dir=#{repo_path} bundle create #{bundle_path} --all]) end def git_unbundle(repo_path:, bundle_path:) - execute(%W(#{git_bin_path} clone --bare #{bundle_path} #{repo_path})) + execute(%W[#{git_bin_path} clone --bare #{bundle_path} #{repo_path}]) end def git_restore_hooks - execute(%W(#{Gitlab.config.gitlab_shell.path}/bin/create-hooks) + repository_storage_paths_args) + execute(%W[#{Gitlab.config.gitlab_shell.path}/bin/create-hooks] + repository_storage_paths_args) end private def tar_with_options(archive:, dir:, options:) - execute(%W(tar -#{options} #{archive} -C #{dir} .)) + execute(%W[tar -#{options} #{archive} -C #{dir} .]) end def untar_with_options(archive:, dir:, options:) - execute(%W(tar -#{options} #{archive} -C #{dir})) + execute(%W[tar -#{options} #{archive} -C #{dir}]) end def execute(cmd) diff --git a/lib/gitlab/key_fingerprint.rb b/lib/gitlab/key_fingerprint.rb index b75ae512d92..4d132f59627 100644 --- a/lib/gitlab/key_fingerprint.rb +++ b/lib/gitlab/key_fingerprint.rb @@ -39,7 +39,7 @@ module Gitlab # OpenSSH 6.8 introduces a new default output format for fingerprints. # Check the version and decide which command to use. - version_output, version_status = popen(%w(ssh -V)) + version_output, version_status = popen(%w[ssh -V]) return false unless version_status.zero? version_matches = version_output.match(/OpenSSH_(?<major>\d+)\.(?<minor>\d+)/) diff --git a/lib/gitlab/ldap/adapter.rb b/lib/gitlab/ldap/adapter.rb index 82cb8cef754..1a423729021 100644 --- a/lib/gitlab/ldap/adapter.rb +++ b/lib/gitlab/ldap/adapter.rb @@ -42,7 +42,7 @@ module Gitlab ldap_search(base: dn, filter: filter, scope: Net::LDAP::SearchScope_BaseObject, - attributes: %w{dn}).any? + attributes: %w[dn]).any? end def ldap_search(*args) @@ -100,7 +100,7 @@ module Gitlab end def user_attributes - %W(#{config.uid} cn mail dn) + %W[#{config.uid} cn mail dn] end end end diff --git a/lib/gitlab/logger.rb b/lib/gitlab/logger.rb index 59b21149a9a..e3dd271fb11 100644 --- a/lib/gitlab/logger.rb +++ b/lib/gitlab/logger.rb @@ -15,13 +15,13 @@ module Gitlab def self.read_latest path = Rails.root.join("log", file_name) self.build unless File.exist?(path) - tail_output, _ = Gitlab::Popen.popen(%W(tail -n 2000 #{path})) + tail_output, _ = Gitlab::Popen.popen(%W[tail -n 2000 #{path}]) tail_output.split("\n") end def self.read_latest_for(filename) path = Rails.root.join("log", filename) - tail_output, _ = Gitlab::Popen.popen(%W(tail -n 2000 #{path})) + tail_output, _ = Gitlab::Popen.popen(%W[tail -n 2000 #{path}]) tail_output.split("\n") end diff --git a/lib/gitlab/markdown/pipeline.rb b/lib/gitlab/markdown/pipeline.rb index 699d8b9fc07..afaa503c113 100644 --- a/lib/gitlab/markdown/pipeline.rb +++ b/lib/gitlab/markdown/pipeline.rb @@ -19,7 +19,7 @@ module Gitlab end class << self - %i(call to_document to_html).each do |meth| + %i[call to_document to_html].each do |meth| define_method(meth) do |text, context| context = transform_context(context) diff --git a/lib/gitlab/markup_helper.rb b/lib/gitlab/markup_helper.rb index dda371e6554..1582ea52cd7 100644 --- a/lib/gitlab/markup_helper.rb +++ b/lib/gitlab/markup_helper.rb @@ -10,8 +10,8 @@ module Gitlab def markup?(filename) gitlab_markdown?(filename) || asciidoc?(filename) || - filename.downcase.end_with?(*%w(.textile .rdoc .org .creole .wiki - .mediawiki .rst)) + filename.downcase.end_with?(*%w[.textile .rdoc .org .creole .wiki + .mediawiki .rst]) end # Public: Determines if a given filename is compatible with @@ -21,7 +21,7 @@ module Gitlab # # Returns boolean def gitlab_markdown?(filename) - filename.downcase.end_with?(*%w(.mdown .mkd .mkdn .md .markdown)) + filename.downcase.end_with?(*%w[.mdown .mkd .mkdn .md .markdown]) end # Public: Determines if the given filename has AsciiDoc extension. @@ -30,7 +30,7 @@ module Gitlab # # Returns boolean def asciidoc?(filename) - filename.downcase.end_with?(*%w(.adoc .ad .asciidoc)) + filename.downcase.end_with?(*%w[.adoc .ad .asciidoc]) end # Public: Determines if the given filename is plain text. diff --git a/lib/gitlab/reference_extractor.rb b/lib/gitlab/reference_extractor.rb index 11c0b01f0dc..0a0b1f76c6e 100644 --- a/lib/gitlab/reference_extractor.rb +++ b/lib/gitlab/reference_extractor.rb @@ -1,7 +1,7 @@ module Gitlab # Extract possible GFM references from an arbitrary String for further processing. class ReferenceExtractor < Banzai::ReferenceExtractor - REFERABLES = %i(user issue label milestone merge_request snippet commit commit_range) + REFERABLES = %i[user issue label milestone merge_request snippet commit commit_range] attr_accessor :project, :current_user, :author def initialize(project, current_user = nil) diff --git a/lib/gitlab/sidekiq_middleware/memory_killer.rb b/lib/gitlab/sidekiq_middleware/memory_killer.rb index 104280f520a..7ce33f59fe3 100644 --- a/lib/gitlab/sidekiq_middleware/memory_killer.rb +++ b/lib/gitlab/sidekiq_middleware/memory_killer.rb @@ -44,7 +44,7 @@ module Gitlab private def get_rss - output, status = Gitlab::Popen.popen(%W(ps -o rss= -p #{Process.pid})) + output, status = Gitlab::Popen.popen(%W[ps -o rss= -p #{Process.pid}]) return 0 unless status.zero? output.to_i |