[rubygems/rubygems] use Rubocop Lint/Debugger check rather than custom spec

We have a quality spec that check for debugger statements. Rubocop has a
cop that tests for the same thing. As such it makes sense to remove the
spec and activate the cop.

https://github.com/rubygems/rubygems/commit/dc1eb6eec5
This commit is contained in:
Frederik Dudzik 2021-10-22 10:28:30 -07:00 committed by Hiroshi SHIBATA
parent 27220b2fe4
commit 2a90ad7aa5

View File

@ -3,25 +3,6 @@
require "set"
RSpec.describe "The library itself" do
def check_for_debugging_mechanisms(filename)
debugging_mechanisms_regex = /
(binding\.pry)|
(debugger)|
(sleep\s*\(?\d+)|
(fit\s*\(?("|\w))
/x
failing_lines = []
each_line(filename) do |line, number|
if line =~ debugging_mechanisms_regex && !line.end_with?("# ignore quality_spec\n")
failing_lines << number + 1
end
end
return if failing_lines.empty?
"#{filename} has debugging mechanisms (like binding.pry, sleep, debugger, rspec focusing, etc.) on lines #{failing_lines.join(", ")}"
end
def check_for_git_merge_conflicts(filename)
merge_conflicts_regex = /
<<<<<<<|
@ -125,16 +106,6 @@ RSpec.describe "The library itself" do
expect(error_messages.compact).to be_well_formed
end
it "does not include any leftover debugging or development mechanisms" do
exempt = %r{quality_spec.rb|support/helpers|vcr_cassettes|\.md|\.ronn|index\.txt|\.5|\.1}
error_messages = []
tracked_files.each do |filename|
next if filename =~ exempt
error_messages << check_for_debugging_mechanisms(filename)
end
expect(error_messages.compact).to be_well_formed
end
it "does not include any unresolved merge conflicts" do
error_messages = []
exempt = %r{lock/lockfile_spec|quality_spec|vcr_cassettes|\.ronn|lockfile_parser\.rb}