diff --git a/.rubocop_todo/naming/heredoc_delimiter_case.yml b/.rubocop_todo/naming/heredoc_delimiter_case.yml deleted file mode 100644 index 2d2337b82ee2a81e27902ba6dc84b679bed36ac0..0000000000000000000000000000000000000000 --- a/.rubocop_todo/naming/heredoc_delimiter_case.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -# Cop supports --autocorrect. -Naming/HeredocDelimiterCase: - Exclude: - - 'spec/lib/gitlab/diff/parser_spec.rb' - - 'spec/lib/json_web_token/rsa_token_spec.rb' - - 'spec/models/commit_spec.rb' - - 'spec/support/helpers/repo_helpers.rb' - - 'spec/support/helpers/seed_repo.rb' diff --git a/.rubocop_todo/performance/string_replacement.yml b/.rubocop_todo/performance/string_replacement.yml deleted file mode 100644 index db22bba0897f35a8c77fee32864c784f23485643..0000000000000000000000000000000000000000 --- a/.rubocop_todo/performance/string_replacement.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -# Cop supports --autocorrect. -Performance/StringReplacement: - Details: grace period - Exclude: - - 'ee/app/models/saml_provider.rb' - - 'lib/gitlab/uploads/migration_helper.rb' - - 'lib/kramdown/parser/atlassian_document_format.rb' diff --git a/ee/app/models/saml_provider.rb b/ee/app/models/saml_provider.rb index 269d27480ff5cd7ca669452f48eac8a3d98a2738..586016a3dcade2145a75e4696a879c75a6e1d7fe 100644 --- a/ee/app/models/saml_provider.rb +++ b/ee/app/models/saml_provider.rb @@ -118,6 +118,6 @@ def set_defaults end def strip_left_to_right_chars(input) - input&.gsub(/\u200E/, '') + input&.delete("\u200E") end end diff --git a/lib/gitlab/uploads/migration_helper.rb b/lib/gitlab/uploads/migration_helper.rb index 712512d0e028b25e410f97994341dba853566cae..3804b7139cb472858206e3dfca31397f3a91c534 100644 --- a/lib/gitlab/uploads/migration_helper.rb +++ b/lib/gitlab/uploads/migration_helper.rb @@ -28,7 +28,7 @@ def batch_size end def prepare_variables(args, logger) - @mounted_as = args.mounted_as&.gsub(':', '') + @mounted_as = args.mounted_as&.delete(':') @uploader_class = args.uploader_class @model_class = args.model_class&.constantize @logger = logger diff --git a/lib/kramdown/parser/atlassian_document_format.rb b/lib/kramdown/parser/atlassian_document_format.rb index 5a481042b158f5a3cdf0c40052aa46db0ed2eaa5..0b259058f01a7f3becf8f391c1e36003c833c4d5 100644 --- a/lib/kramdown/parser/atlassian_document_format.rb +++ b/lib/kramdown/parser/atlassian_document_format.rb @@ -218,7 +218,7 @@ def process_mention(element, ast_node) # a valid username in our system. This gives us an # opportunity to replace it later. Mention name can have # spaces, so double quote it - mention_text = ast_node.dig('attrs', 'text')&.gsub('@', '') + mention_text = ast_node.dig('attrs', 'text')&.delete('@') mention_text = %("#{mention_text}") if mention_text&.include?(' ') mention_text = %(@adf-mention:#{mention_text}) diff --git a/spec/lib/gitlab/diff/parser_spec.rb b/spec/lib/gitlab/diff/parser_spec.rb index c8069f82f0475922985098305c4a3fd69d707b0e..0b9d9f44d470832b9792e4c4426bbc7aac516939 100644 --- a/spec/lib/gitlab/diff/parser_spec.rb +++ b/spec/lib/gitlab/diff/parser_spec.rb @@ -12,7 +12,7 @@ describe '#parse' do let(:diff) do - <<eos + <<EOS --- a/files/ruby/popen.rb +++ b/files/ruby/popen.rb @@ -6,12 +6,18 @@ module Popen @@ -45,7 +45,7 @@ def popen(cmd, path=nil) Open3.popen3(vars, *cmd, options) do |stdin, stdout, stderr, wait_thr| @cmd_output << stdout.read @cmd_output << stderr.read -eos +EOS end before do diff --git a/spec/lib/json_web_token/rsa_token_spec.rb b/spec/lib/json_web_token/rsa_token_spec.rb index fd553eb181eade633fb323597a9b3ef74d7b327e..81f583322575f31695ef0e47cfccfe5d353340c3 100644 --- a/spec/lib/json_web_token/rsa_token_spec.rb +++ b/spec/lib/json_web_token/rsa_token_spec.rb @@ -2,7 +2,7 @@ RSpec.describe JSONWebToken::RSAToken do let_it_be(:rsa_key) do - OpenSSL::PKey::RSA.new <<-eos.strip_heredoc + OpenSSL::PKey::RSA.new <<-EOS.strip_heredoc -----BEGIN RSA PRIVATE KEY----- MIIBOgIBAAJBAMA5sXIBE0HwgIB40iNidN4PGWzOyLQK0bsdOBNgpEXkDlZBvnak OUgAPF+rME4PB0Yl415DabUI40T5UNmlwxcCAwEAAQJAZtY2pSwIFm3JAXIh0cZZ @@ -12,7 +12,7 @@ A6PRG/PSTpQtAiBxtBg6zdf+JC3GH3zt/dA0/10tL4OF2wORfYQghRzyYQIhAL2l 0ZQW+yLIZAGrdBFWYEAa52GZosncmzBNlsoTgwE4 -----END RSA PRIVATE KEY----- - eos + EOS end let(:rsa_token) { described_class.new(nil) } diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index a098ac2a4ab0e04bba1af173e28255c761c80f48..47fd1222fece85792d7689e53c4c2f60dc46d8c4 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -408,10 +408,10 @@ end it "does not truncates a message with a newline after 80 but less 100 characters" do - message = <<eos + message = <<EOS Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit. Vivamus egestas lacinia lacus, sed rutrum mauris. -eos +EOS allow(commit).to receive(:safe_message).and_return(message) expect(commit.title).to eq(message.split("\n").first) @@ -460,20 +460,20 @@ end it 'returns description of commit message if title less than 100 characters' do - message = <<eos + message = <<EOS Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit. Vivamus egestas lacinia lacus, sed rutrum mauris. -eos +EOS allow(commit).to receive(:safe_message).and_return(message) expect(commit.description).to eq('Vivamus egestas lacinia lacus, sed rutrum mauris.') end it 'returns full commit message if commit title more than 100 characters' do - message = <<eos + message = <<EOS Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit. Vivamus egestas lacinia lacus, sed rutrum mauris. Vivamus egestas lacinia lacus, sed rutrum mauris. -eos +EOS allow(commit).to receive(:safe_message).and_return(message) expect(commit.description).to eq(message) diff --git a/spec/support/helpers/repo_helpers.rb b/spec/support/helpers/repo_helpers.rb index b51afaac40e78511ce6ad98985fe28054b5d8446..5578e6350cf65efa149f16db8fd9329b0f305091 100644 --- a/spec/support/helpers/repo_helpers.rb +++ b/spec/support/helpers/repo_helpers.rb @@ -19,14 +19,14 @@ def sample_blob OpenStruct.new( oid: '5f53439ca4b009096571d3c8bc3d09d30e7431b3', path: "files/js/commit.js.coffee", - data: <<eos + data: <<EOS class Commit constructor: -> $('.files .diff-file').each -> new CommitFile(this) @Commit = Commit -eos +EOS ) end @@ -42,10 +42,10 @@ def sample_commit line_code_path: 'files/ruby/popen.rb', del_line_code: '2f6fcd96b88b36ce98c38da085c795a27d92a3dd_13_13', referenced_by: [], - message: <<eos + message: <<EOS Change some files Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> -eos +EOS ) end @@ -58,7 +58,7 @@ def another_sample_commit author_email: "sytse@gitlab.com", files_changed_count: 1, referenced_by: [], - message: <<eos + message: <<EOS Add directory structure for tree_helper spec This directory structure is needed for a testing the method flatten_tree(tree) in the TreeHelper module @@ -66,7 +66,7 @@ def another_sample_commit See [merge request #275](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/275#note_732774) See merge request !2 -eos +EOS ) end @@ -77,10 +77,10 @@ def sample_big_commit author_full_name: "Dmitriy Zaporozhets", author_email: "dmitriy.zaporozhets@gmail.com", referenced_by: [], - message: <<eos + message: <<EOS Files, encoding and much more Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> -eos +EOS ) end @@ -93,10 +93,10 @@ def sample_image_commit old_blob_id: '33f3729a45c02fc67d00adb1b8bca394b0e761d9', new_blob_id: '2f63565e7aac07bcdadb654e253078b727143ec4', referenced_by: [], - message: <<eos + message: <<EOS Modified image Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> -eos +EOS ) end diff --git a/spec/support/helpers/seed_repo.rb b/spec/support/helpers/seed_repo.rb index b0bd0dfb60e758b08b35b05494c00fda9d5444fd..b6afa46d217600a851048afa8d1046eb815be0cd 100644 --- a/spec/support/helpers/seed_repo.rb +++ b/spec/support/helpers/seed_repo.rb @@ -113,7 +113,7 @@ module Repo module RubyBlob ID = "7e3e39ebb9b2bf433b4ad17313770fbe4051649c" NAME = "popen.rb" - CONTENT = <<-eos + CONTENT = <<-EOS require 'fileutils' require 'open3' @@ -151,6 +151,6 @@ def popen(cmd, path=nil) return @cmd_output, @cmd_status end end - eos + EOS end end